Skip to content
Discussion options

You must be logged in to vote

In AA, functions are specified as an arg list, then ->, then the body, all wrapped in {}.
A one-arg function: { arg -> body }
A zero-arg function: { -> body }.
The arrow can be skipped if there are no arguments: {body}.

Everything in AA is an expression, and there is no "void". A function will return its last expression, and you can use a 0 to make it explicitly clear to ignore the return.

As for auto-calling a zero-arg function, I'm currently of the opinion that this leads to "hidden" function calls and cost-model confusion far too often.
Is A.size cheap (i.e., 1-clk load)?
How about mySharedCache.size?
I know for sure that calling size on a concurrently modified structure (such as a bus…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
4 replies
@jnorthrup
Comment options

@cliffclick
Comment options

@jnorthrup
Comment options

@cliffclick
Comment options

Answer selected by cliffclick
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants