The Blog

22 Mar 2005: Nemerle 0.2.9 released!

This is preview release before 0.3.0, which is real soon now. There are lots of changes in this version -- the parser and the typer (which constitute more then half of the compiler) have been replaced by entirely new implementations.

There is a number of backward incompatible changes in this release. Most of them were previously discussed on the mailing list, and received rather good feedback other only generate warnings in this release. We apologize for both. We hope they make Nemerle a better language. On the plus side -- we should be now far closer to certain language stabilization point.

0.3.0 should bring implicit conversions, List iterators as list[T] methods and maybe some more goodies.

Incompatible language changes:

Language additions:

Library changes:

Macro library changes:

Other stuff:

From: Kannan Goundan (66.74.197.112)

"Variant options are now nested inside enclosing variant, so their names need to be prefixed with variant name."

A disadvantage of requiring the prefix is that people might start using artificially abbreviated type names to reduce the amount of typing.

The Java compiler has a special case for "switch" on enums so that you don't need the prefix. Woudln't this work for "match" in Nemerle? Though you'd probably still need the fully qualified name during construction, at least it would eliminate redundancy for "match".

On the type parameter syntax...the C# language reference cites a similar example:

> f(x < foo, y > (a+b))

This could be parsed in two ways:

> f ( x<foo,y>( a+b ) ) // call generic function "x<'a,'b>(...)"
> f ( x<foo, b>(a+b) ) // "f" takes two boolean parameters

If I remember correctly, they don't resort to checking the types of the different terms. They use some weird heuristic check on the tokens to guess which one is intended. Gross. The brackets are a much better way to go.

From: Kamil Skalski (212.122.206.41)

> A disadvantage of requiring the prefix is that people might start using artificially abbreviated type names to reduce the amount of typing.

Actually our problem was the reverse. In our expirience it was a common pattern to
prefix name of each variant option with some strange abbreviations:

variant ParseExpr {
| PE_Ref { name : string }
| PE_Call { fn : ParseExpr; parms : list [ParseExpr] }
}

variant TypedExpr {
| TE_Ref { name : Symbol }
| TE_Call { fn : TypedExpr; parms : list [TypedExpr] }
}

so we can distinguish ParseExpr Ref from TypedExpr Ref. Now we have ParseExpr.Ref vs TypedExpr.Ref - indeed in compiler we use PExpr.Ref and TExpr.Ref, which *is* using "artificially abbreviated type names" as you mentioned. But it is still much better than using those abbreviations are part of variant option name.

Moreover, with current solution you can create alias for type name, like

using PE = ParseExpr;
...
PE.Ref -- resolves to -> ParseExpr.Ref

or even open this type name globally:

using ParseExpr;

Ref --- resolves to --> ParseExpr.Ref (if it is not ambiguous)

The same holds for enums. We just decided, that C#'s design for enums is reasonable and used it for both variants and enums.

> If I remember correctly, they don't resort to checking the types of the different terms. They use some weird heuristic check on the tokens to guess which one is intended. Gross. The brackets are a much better way to go.

Correct, it is a hack in the parser. They decide on token after closing >, if it
is (, etc. expression is parsed as generic type specifier.

In Nemerle it won't be a great problem, because you rarely have to write generic
specifier. Type inference engine can handle it in most cases, like

def x = Dictionary ();
x.Add ("bal", MyVal ());

in contrast to C#'s

Dictionary <string, MyVal> x = new Dictionary <string, MyVal> ();
x.Add ("bal", new MyVal ());

Unfortunately, sometimes it is necessary to specify types manually:

class A [T] {
}
...
def x = A .[int] ();

We use different syntax here (maybe somebody have better ideas?), because

def x = A [int] ();

would create ambiguities with indexers, like

A [x : void -> Foo] : void -> void { ... }
...
class A [T] { }
class Foo { }

A [Foo] (); // can resolve to get_A (Foo) ();
// or to A .[Foo] ();

Thus we decided to use a little bit changed syntax, because it won't be used often anyways.

From: Kannan Goundan (199.106.52.24)

"Actually our problem was the reverse. In our expirience it was a common pattern to prefix name of each variant option with some strange abbreviations:"

Yeah...I see that a lot in Haskell code. But what I was suggesting is making the prefix optional in "match" statements, but still requiring the prefix for constructors.

variant ParseExpr {
| Ref ...
| Call ...
}

variant TypedExpr {
| Ref ...
| Call ...
}

x = TypedExpr.Ref("x")

// Since we know 'x' is a TypedExpr, we don't have to
// specify the prefix.
match (x) {
| Ref ...
| Call ...
}

It wouldn't be ambiguous in this case, right? This is what the Java 1.5 compiler does for enums.

From: Michal Moskal (81.219.231.40)

Actually this wouldn't play well with type inference. For example
consider:

def foo (x) {
match (x) {
| Ref => ...
| Something => ...
}
}

it is actually possible to type this code, once you see foo (TExpr.Foo()).
But there are cases when you don't see it. It is possible to implement this,
though with some extensions to our typing engine (a day or two of work).
I generally like the idea, but have some doubts if it is going to make
the code cleaner and easier understandable, so I would like to have it
discussed more.

From: tamiflu (68.87.64.117)

Good post, very useful i like it very much

From: (219.93.174.106)

Best of the text i read about a problem.

From: ringtones free (210.111.100.179)

Hi! http://www.ringtones-dir.com/get/ ringtones site. ringtones site, Free nokia ringtones here, Download ringtones FREE. From website .

From: (213.114.21.87)

Wellcome to the real world.

From: (218.28.14.73)

Need to be readed.

From: (69.31.86.8)

Persone los pioneros non rabata. Great...