Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
add sort_by macro method #3947
bcardiff left a comment
A documentation placeholder should be added at https://github.com/crystal-lang/crystal/blob/master/src/compiler/crystal/macros.cr#L543 .
I'm curious, which scenario forced you sort in macros?
@bcardiff done :) Sorry I forgot about that. I was writing a kind of model interface similar to json mapping and was building an initializer that would take arguments from the mapping named tuple. There i needed to sort the arguments by nilable so that args that are mandatory are leftmost.
There are other ways of doing it of course but i was confused that ArrayLiteral didn't have a sort_by method so i thought it would be nice to have.