-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Non-ideal discoverability of Janet divergences from other programming languages #197
Comments
The behaviour of the match operator for shorter tuples would also be relevant here. |
Hi @tionis, |
I think it would be convenient for users to be able to discover divergences (to adopt the terminology of the issue's title) and/or potential gotchas. I'm not really sure how to do this well though. A single list might be nice, though for some things, perhaps one would want to learn about individual items in context (e.g. there is an example of slicing with a negative index in an example of this section). I suppose there could be a list which is pointed at from specific sections (or a specific part of the list could be linked to). Note though that for negative index use, this might lead to a fair bit of extra text spread across multiple sections. That might not be so great from a maintenance perspective if certain changes were to be made later. I hope it's clear from the little examination above that it's not necessarily a no-brainer to do this kind of thing in a maintainable manner. That's not to say that things couldn't be improved, just that there may not be a single easy-to-execute approach. Still, perhaps a good idea will come about or individual items might be improved upon. For the moment, may be this issue could collect some potential content -- though if it's distributed throughout the issue, it may become unwieldy to act upon items from a practical perspective.... |
Ok, time to pop my head out for a moment! :) I've seen two of these elsewhere, and thought they were pretty useful (full disclosure, years ago I wrote a few of the ones for Ruby (though I expect they've been updated a bit since then)) :
The ones for Julia are more lumped together -- I think the ones for Ruby are more nicely organized. :) |
@uvtc Thanks for sharing those, will be working on digesting them. P.S. Good to hear from you -- been missing your presence! |
Aw, thanks, sogaiu! |
Along the lines of improving the existing documentation for the case of providing some explanation of how negative indices work in Janet, I think this section is a candidate for an addition. |
Looking at the Ruby and Julia resources I was reminded of this. |
I'm not sure yet whether the following should count, but I'll note it for future reference... The
For the non-negative value cases, For example, if slicing something of length 1,
This was unexpected to me [1], but thinking of the value of
In the case of a string of length 1, that might look like:
I'll note that this may not be a divergence from other programming languages, possibly it might be considered a gotcha (but may be not). [1] On a side note, it looks like one may produce a symbol of length 0:
That seems a bit odd to me. Not sure if that's problematic... |
Hi to all,
this is more of a suggestion than a problem per se.
As a newcomer, I accidentally discovered some peculiar features of the Janet language that set it apart from other programming languages. I'm quite sure they are rock-solid choices made by experienced people, and I'm not going to criticize them or propose changes.
But I think it could be beneficial, at least for beginners like me, to have a section of the Janet documentation devoted to highlighting conventions in Janet that might be different from what one might expect from other, widely used, programming languages.
Just to give some examples, I'm thinking about -2 used to refer to the last item in an array/tuple[1] or the 0-based index for day and month only in os/date[2], and I don't know how many other cases of this kind may exist.
I know that all these behaviors are well and clearly specified in the relevant docstrings but, as I said, I think it could be beneficial for beginners to have them listed on a single page and not scattered all around the documentation.
To be more clear, I'm not advocating changes in language semantic and/or behavior, just more "prime time" in the documentation about these divergences from common practice. I'm thinking about something in the line of "Janet for pythonists/clojurists" or "Janet for C/C++ developer" etc.
Please, above all, take this as a constructive proposal, I do not want to criticize someone else's free time/contribution.
Thank you.
[1] janet-lang/janet#1219 (comment)
[2] janet-lang/janet#1214 (comment)
The text was updated successfully, but these errors were encountered: