[e-lang] Naming convention for variable holding an eventual reference
daw at cs.berkeley.edu
Fri May 16 19:19:17 CDT 2008
Tyler Close writes:
> drum_.post('bang', [ 1 ])
> we make all eventual invocations via a global object, so:
> Q.post(drum, 'bang', [ 1 ])
> The 'drum' reference can be either a promise or an immediate
> reference; either way, the invocation is still an eventual invocation.
> I think the last line is the only one that presents a significant
> concern. In the current syntax, it's:
> hits_ = drum_.post('bang', [ 3 ]).get('hits')
[but in the proposed new syntax it's:]
> hits = Q.get(Q.post(drum, 'bang', [ 3 ]), 'hits')
> This inversion happens to the whole chain of calls in the statement.
I haven't been following this too closely, but would the following
but must be passed in a call to a global function Q to obtain an
object that can be directly invoked, like this:
Q(drum).post('bang', [ 1 ])
The problem line at the end of your post becomes
hits = Q(Q(drum).post('bang', [ 3 ])).get('hits')
Is this any better?
This variant doesn't provide a naming convention on the variables
themselves, only a special syntax at the place where those variables
are used -- just like your proposal. The only advantage of this
variant over your proposal is that this variant avoids the inversion.
More information about the e-lang