ozra / onyx-lang

The Onyx Programming Language
Other
96 stars 5 forks source link

Feature request: Splat support in block arguments. #28

Open stugol opened 8 years ago

stugol commented 8 years ago
a-function(...args) -> yield args
a-function(1, "", false) ~> |...args| puts args

Currently not possible in Crystal.

ozra commented 8 years ago

Slight correction to the example (and generally, I'd recommend using "say" for informal stdout shout outs - the name reflect the use better imo, but no guns held to the head here ;-) ): a-function 1, "", false, (...args) ~> say args

Anyway, I'd be happy to see some more "practical" examples, because I can't see myself in use of that. Care to enlighten? Also - if you've already posted issues, for instance in crystal issues, links there are acceptable, since I'll undoubtedly make contributions upstream too.

stugol commented 8 years ago

crystal issue

Logically, if you need variadic methods, then you also need variadic blocks.

ozra commented 8 years ago

Looking over there, my instant reaction was "that should be a macro", which I then saw you did use.

It seems you're coding in a very "dynamic lang mindset". All things are solvable by attacking it from a new perspective.

This is a language primarily targeted at performant code. Statically type checked - because it generates faster code, and is scientifically more productive and safer. Those are the pillars.

Trying to "dynamify" that is like building a ladder reaching around a wall sideways instead of just opening the door and go through.

soft lambdas != methods, so there's really no logic "carry over".

If there really is a good use case, that isn't already solvable equally or better, then it's time to:

There are always costs! And there are many choices of where to spend, so we require real motivation, not implied logics.