default(T) ?

0 views
Skip to first unread message

Andrew Davey

unread,
Jun 11, 2009, 3:47:21 PM6/11/09
to Nemerle Forum
Does nemerle have an equivalent of C#'s default(T) ?

NN

unread,
Jun 12, 2009, 9:07:46 AM6/12/09
to Nemerle Forum
Look here:
http://rsdn.ru/forum/nemerle/2281812.all.aspx

In short.
Just use mutable keyword:

mutable a : int;


Or if you want explicit expression use
Nemerle.Extensions;DefaultValue:

using Nemerle.Extensions;

module Program
{
F[T](a : T) : void
{
def i = DefaultValue(T);

Andrew Davey

unread,
Jun 12, 2009, 9:15:26 AM6/12/09
to Nemerle Forum
Excellent thanks! :)

VladD2

unread,
Jun 15, 2009, 7:33:26 AM6/15/09
to nemer...@googlegroups.com
2009/6/11 Andrew Davey <a.j....@gmail.com>:

>
> Does nemerle have an equivalent of C#'s default(T) ?

Use macro Nemerle.Extensions.DefaultValue(T).

PS

I think we mast add keyword "default" in Nemerle.Core namespace/

Ķaмĭļ ๏ Şκaļşκĭ

unread,
Jun 15, 2009, 7:50:49 AM6/15/09
to nemer...@googlegroups.com
I remember that I intentionally didn't add 'default(T)' to
Nemerle.Core, since so far we don't use this keyword and this would be
the only place we need it. IMHO default(T) is relatively rarely used
and it is perfect candidate to just express it as library macro call,
not a builtin.
--
Kamil Skalski
http://kamil-skalski.pl

VladD2

unread,
Jun 15, 2009, 8:05:58 AM6/15/09
to nemer...@googlegroups.com
2009/6/15 Ķaмĭļ ๏ Şκaļşκĭ <kamil....@gmail.com>:

>
> I remember that I intentionally didn't add 'default(T)' to
> Nemerle.Core, since so far we don't use this keyword and this would be
> the only place we need it. IMHO default(T) is relatively rarely used
> and it is perfect candidate to just express it as library macro call,
> not a builtin.

I answer this question already in 100-th time.

A C# programmers use this intrinsic function very often.

I think, that we should support the default(T) to not confuse beginners.

Reply all
Reply to author
Forward
0 new messages