-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Adds Array#prepend
and Array#append
.
#5629
Conversation
Aliased `unshift` and `push`.
Array.prepend
and Array.append
.Array#prepend
and Array#append
.
They are controversial. We don't have aliases in Crystal. |
Perhaps rename unshift to prepend, but no aliases please. |
If absolutely no alias's are permitted I would propose replacing I do understand the importance of |
If it helps I can |
Removing |
@Sija - Thats why I am proposing the aliases. |
@chris-huxtable I know, yet Crystal doesn't like/use those (aliases). |
@Sija - Something that I think is unfortunate. In different contexts similar functions have different names. Let alone the issue with |
Whatever gets decided, it will have some downside.
I don't know which way is best. We should look for the least evil. |
I don't really understand the aversion of aliases other then API bloat and support. Which aren't insignificant issues. But an outright 'ban' I think as equally problematic. One of the other things that has confused me is the 'prescriptive' nature of Crystal which is very Python. Where as Ruby is more 'descriptive' which is one of the things I appreciate about it. That is to say there is more then one way to skin a cat. |
No such thing exists, I'd look for better solution :) |
But having direct aliases with no difference always creates more api for no gain. So why bother? I like push and pop for the end of a list, buy also like prepend and ??? For the start of a list. Why not just have insert and delete with, 0 and -1 for both these cases? |
@RX14 - That strikes me as a bit extreme. |
Array as it is now works fine. These aliases were just recently introduced in Ruby, I never needed them. Old Ruby coders will now find these new aliases and wonder why they exist. This means they have to learn new things. Maybe decide what name to use from now on. All of this is a big waste of time, nothing else. |
I'm getting tired of issues and pull requests that merely revolve around "matter of taste and preference". Nobody will agree. We have push, pop, shift and unshift. They're ubiquitous across many languages. They're fine. Close subject. Please. |
I know it came from Ruby but... |
Aliases for
unshift
andpush
.Hopefully this won't be super controversial.
The current
unshift
/push
aren't well matched and a PITA to remember. Ruby recently, in 2.5, finally added them. I think it would make sense to add them to ourArray
as well.