merging getters and properties syntax #30
-
|
I looked in the readme for a voidfunc call the first and one of the only i see is one language I use has properties, and also void functions (0 params) with parens and commas several languages i use have 0 or more params with infix parameter passing for one or all params, no commas, though perhaps quotes and escapes matter for holding position. I also have and use a scenario where class A{val size:Int} really don't look much different under the hood without some annotations to specify that A.size is a java attribute but these belong to the same language and have different syntax. obviously A.size() must be an error and B.size must be a lambda/function reference right? is reasonable to promote void funcs to infix syntax per kotlin's infix, such that a voidfunc declared in an expression then simply call rather than yield a reference? I like kotlin;s infix but there's too many shackles in other parts of the expression limitations to get traction with that. I really don't have an opinion on how much value applies to special 1-parameter calling syntax, but I run into the 0-parameter divivde between size and size() more often than i'd like. acknowledging void, or empty parens, seems like a rip in the fabric of consistent programming space. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
|
In AA, functions are specified as an arg list, then Everything in AA is an expression, and there is no "void". A function will return its last expression, and you can use a 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.
Using it with a single trailing arg is a call: |
Beta Was this translation helpful? Give feedback.
-
|
a "no zero-args fcns in my code please" keyword
it seems like a serialization scope operator, seemingly in prior discussion
elsewhere, could be a helpful and low cost alt syntax which aids code-gen,
boilerplate, wire format overheads, and cheats on comforts.
kolmogorov-syntax where kolmogorov is not unwelcome.
… Message ID: ***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
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
0to 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.sizecheap (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…