|
|
Mozy Online Backup: 2GB Free. Automatic. Secure.
Subject: Static garbage collection - msg#00101
List: lang.nemerle.devel
Hi,
I have some other questions.
1. Is the technique known as "static garbage collection" exploited in
Nemerle, if I use a purely functional style?
2. Is the concept of "functional object" present in Nemerle? (i.e.
calling a method returns a new object with the same state except for
some field.) This allows to use a functional style in your code.
Thanks for any info.
Maurizio
Was this page helpful?
Thread at a glance:
Previous Message by Date:
click to view message preview
Re: Question about type inference
Dnia poniedziaÅek, 16 maja 2005 19:32, Maurizio Colucci napisaÅ:
> >
> > In general less powerful, because we cannot handle the case where no more
> > information is available than "object have member named foo". But in
> > context of .NET and its typesystem it is more or less the expected
> > "optimal" solution.
>
> Again, I can't imagine how this "loss of power" could result in
> practical disadvantage.
Well, sometimes it might be inconvenient. For example when you have an object
hierarchy, which is poorly designed - similar classes are not deriving from
common class/interface. In this case the duck typing might come in help, but
IMHO (and it seems also in your) it is entirely *wrong* and would lead to
code horrible to read and even bugs.
--
Kamil Skalski
http://nazgul.omega.pl
Next Message by Date:
click to view message preview
Static Tutorials_and_examples
Hi,
Both the PDF and HTML copies have 2 sections of "Macros tutorial"
(section 5 and section9).
Can these 2 sections be merged together ?
Thanks,
PhiHo
P.S: I assumed that section 9 is a place holder
for more more macros tutorials ;-)
Previous Message by Thread:
click to view message preview
Question about type inference
Hello,
It's been a few months since I last looked at Nemerle. Now I have to
choose between ocaml and nemerle for my gtk app (an editor for
videogames). I have two questions whose answer is not clear from the
web site. I am concerned with type inference.
1. Does Nemerle support "open types" a-la ocaml (similar to
duck-typing in python)? For example, will this compile?
public they_are_all_called_j( selected_objects )
{
List.ForAll( selected_objects, fun (o ) { o.name == "j"});
}
Does this compile? If so, what type does Nemerle infer for
"selected_objects"? In ocaml, the inferred type is a "list of
something that has a NAME attribute".
2. Must I still declare the type of private class members?
Thanks for any info. Cheers,
Maurizio
Next Message by Thread:
click to view message preview
Re: Static garbage collection
Dnia wtorek, 17 maja 2005 15:42, Maurizio Colucci napisaÅ:
> Hi,
>
> I have some other questions.
>
> 1. Is the technique known as "static garbage collection" exploited in
> Nemerle, if I use a purely functional style?
See the other mail.
>
> 2. Is the concept of "functional object" present in Nemerle? (i.e.
> calling a method returns a new object with the same state except for
> some field.) This allows to use a functional style in your code.
Well, there is not language support for this, though we had thought about it
before. Indeed this pattern appears in some places of compiler code and it
would be nice to give the better support for this.
[Record]
class A {
x : int;
y : string;
z : A;
WithX (x : int) : A {
A (x, this.y, this.z);
}
WithY (y : string) : A {
A (this.x, y, this.z);
}
...
}
At this point it should be easy to write a macro generating those methods
automatically (maybe it should be part of Record macro).
But now comes some problems, how to use those methods?
In a standard way:
def x = A (1, "3", null);
def x = x.WithX(2);
Or something OCaml-like
def x = A (1, "3", null);
{ x with x = 2 }
Hm... the 'with' macro should be also possible to write easily (except for the
work I will be doing to allow macros introduce keywords as infix operators).
x with y = val
would expand to
x.WithY (val)
is it worth adding to the language (hm, actually it is longer than standard
way)?
--
Kamil Skalski
http://nazgul.omega.pl
|
|