-
Notifications
You must be signed in to change notification settings - Fork 15
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
Anonymous Functions #15
Comments
Relatedly, this is legal: G'DAY MATE!
THE HARD YAKKA FOR func1 IS () <
GIMME "func1 called";
>
THE HARD YAKKA FOR func2 IS () <
GIMME "func2 called";
>
func1 = func2;
func1(); // prints "func2 called"
CHEERS C***! I'd think only variables declared with |
When I think of Australianisms for when you don't know, or don't want to use, a name, what stands out to me is "old mate" How about
|
I'm not qualified to comment on the Australianism, but the syntax looks fine (and is reminiscent of older JS |
In addition to this, it would be nice to be able to declare an immutable variable.
|
@jwfxpr I asked someone who is more qualified to speak to the Australianisms than I am, and he basically said that: |
Yep @bbrk24 ,
Both of those forms seem good to me 😊 |
I think I prefer I can get to work right away on implementing constants and making function declarations immutable. |
Before the anonymous functions are fully introduced, I want to point out an inconsistency with the proposed syntax: named functions have |
@bbrk24 Good point, the finalized syntax will be this then. OLD MATE IS () < GIMME "Oi mate"; GIMME "Clear off"; > Also this gave me idea that we should write style rules for the language, things like spacing, conventions, things of that nature |
Just so that the examples and discussion here are clear, we've implied (but not discussed) that parameters for old mates go inside the I.e., old mate with no parameters:
An old mate with one parameter:
Old mate with two parameters:
etc. Sidebar q, @zackradisic: I could test this myself, but for the sake of discussion, are |
At this moment I RECKON x = OLD MATE IS (yerawanka) <
BAIL YA RECKON yerawanka ? < "Bugger off"; > WHATABOUT ? < "Clear off"; >;
>(NAH YEAH!); In retrospect I should have made them expressions, should make that change at some point. |
I was messing around with callbacks, and I noticed something interesting:
I don't have any ideas for what they would be called, but I'm not even sure words would be necessary -- they tend to be pretty punctuationful. Consider how the NOP lambda is
[]() { }
in C++ and() => {}
in JS.Syntactically, I perfer how Swift and Ruby handle it, where the entire closure body is wrapped in braces (in contrast with the closure syntax in JS, which consists of multiple separate parts).
The text was updated successfully, but these errors were encountered: