-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Enumerable
& co. have several convenience methods which make it a joy to work with. For example #max
and #max_of
(and the #min
equivalents). These are really trivial to implement, but it's so nice to have them because they tell clearly what's happening.
In the macro language we're missing many of those methods on ArrayLiteral
. It would be nice to have them there as well.
The workarounds you have to employ currently are quite ugly compared to the beauty of Crystal.
Example: #15927 (comment)
Now we certainly should not mirror the entire stdlib collection API in macro land. The macro language is intentionally limited because it has fewer use cases.
But some more convenience features would be very helpful. Finding the maximum or minimum value seems a very reasonable use case for macros, for example.