http://wiki.erights.org/mediawiki/index.php?title=Special:Contributions&feed=atom&target=74.121.148.3Erights - User contributions [en]2024-03-28T15:25:37ZFrom ErightsMediaWiki 1.15.5-7http://wiki.erights.org/wiki/Surprise_listSurprise list2011-04-20T07:45:28Z<p>74.121.148.3: /* Rationale */</p>
<hr />
<div>Potentially surprising parts of the [[E language]].<br />
<br />
Current as of [http://www.erights.org/download/0-8-29/ E 0.8.33o].<br />
<br />
Very true! Makes a chagne to see someone spell it out like that. :)<br />
<br />
==<code>def x</code> doesn't return <var>x</var>==<br />
<br />
The forward declaration expression, <code>def <var>var</var></code>, does not return <var>var</var> but rather the [[Resolver]] for it.<br />
<br />
===Examples===<br />
<br />
# E sample<br />
<br />
? def x<br />
# value: &lt;Resolver&gt;<br />
<br />
? x<br />
# value: &lt;Promise&gt;<br />
<br />
===Rationale===<br />
<br />
If you want to pass a resolver as an argument, using it as an “out parameter”, this syntax is helpful:<br />
<br />
x.hereIsAResolver(def y)<br />
<var>... use y</var><br />
<br />
===Alternative===<br />
<br />
If you want the actual promise, simply write <code>(def x; x)</code>.<br />
<br />
==Unresolved references do not necessarily behave as their future resolved identity==<br />
<br />
&mdash; messages sent before the reference is resolved may be reacted to however the current holder of the reference &ldquo;arrow-head&rdquo; chooses, which does not necessarily correspond to the reference to which the unresolved reference resolves.<br />
<br />
This has been discussed in [http://www.eros-os.org/pipermail/e-lang/2005-July/010821.html an e-lang thread].<br />
<br />
===Rationale===<br />
<br />
This cannot be fixed without removing [http://www.erights.org/elib/distrib/pipeline.html pipelining], eliminating one of the major benefits of the E reference model.<br />
<br />
===Examples===<br />
<br />
For now, see [http://www.eros-os.org/pipermail/e-lang/2005-July/010827.html this lengthy example by MarkM].<br />
<br />
===Alternative===<br />
<br />
To avoid being vulnerable to this type of misbehavior, do not use a sameness test (<code>==</code>) or Map key lookup in order to decide on the reliability of the response to a ''previously'' sent message. This might involve using a when-catch/whenResolved construct to wait until the reference is resolved.<br />
<br />
==Accumulator operator is lowest-precedence==<br />
<br />
As you can see in the following expansion, the operator following the “_” is always lowest-precedence (as it is the one effectively rewritten into an assignment form):<br />
<br />
? e`pragma.enable("accumulator"); accum 0 while (a) { _ * b + c }`<br />
# value: e`null<br />
...<br />
# accum__1 := accum__1.multiply(b.add(c))<br />
...<br />
<br />
NVXbEU Touchdown! That's a really cool way of ptuitng it!<br />
<br />
===Alternative===<br />
<br />
Avoid accumulator syntax when the accumulation cannot be expressed as a single call.<br />
<br />
<br />
<br />
== Shadowing function arguments ==<br />
<br />
Rebinding a name within a block is an error, e.g.<br />
<br />
def foo() {<br />
def x := 2<br />
def x := 3<br />
}<br />
<br />
("Failed: x already in scope")<br />
<br />
However, rebinding an argument does not issue any warning:<br />
<br />
def foo(x) {<br />
...<br />
def x := 2<br />
...<br />
println(x)<br />
}<br />
<br />
=== Rationale ===<br />
<br />
The already-in-scope error is intended to catch accidentally using the same name twice, not prohibit rebinding. Generally, you can expect it to be supressed anywhere there is visible <code>{...}</code> syntax.<br />
<br />
== Single-letter uriGetters are a special case ==<br />
<br />
It is not possible to refer to a single-letter uriGetter in a URI literal.<br />
<br />
? def <t> := ["foo" => "bar"]<br />
# value: ["foo" => "bar"]<br />
<br />
? interp.setExpand(true)<br />
? <t:foo><br />
# expansion: file__uriGetter.get("t:foo")<br />
<br />
# value: <file:/Users/kpreid/t:foo><br />
<br />
===Rationale===<br />
<br />
This is a feature intended for convenient support for Windows drive letter filenames. {{XXX|Look at whether MarkM agreed to remove it.}}<br />
<br />
===Alternative===<br />
<br />
Use names longer than one letter.<br />
<br />
[[Category:E language]]</div>74.121.148.3