[nem-en] out / ref

Kannan Goundan cakoose at yahoo.com
Thu Sep 28 06:01:17 CEST 2006



--- Igor Tkachev <it at rsdn.ru> wrote:

> Hello Michal,
> 
> > Any suggestions what to use instead of _ in for partial
> > application?
> 
> I would not change anything. It does not look confusing at all.
> I think the '_' was a great find. It's short, clear, means not
> important or substitution. Even if it does have a little bit
> different meaning depending on context, it's OK.

I think it's more than a "little bit" different.  In one case it is a
shorthand for a simple closure, in another case it means that you
don't care about an output value.

> Lets take for example the ':' character in C#:
> 
> class A : B
> where T : B
> case 1 : break;
> a == null? 0 : 1;
> 
> Do you have any problem with ':' here?
>
> What about
> '*' and '&' in C++ and C++/CLI?
> '^' and '%' in C++/CLI?
> '=' in VB and SQL?
> '?' in C#?
> unary and binary '+' and '-'?
> '<', '>' in C++ and C#?
> '[', ']' in Nemerle?

In most of these cases, the surrounding context helps to disambiguate
(e.g. type expression versus value expression).  Both "Foo(_)" and
"Foo(out _)" are both expressions and will appear in similar
surroundings.

Then again, I've now become used to C's use of '*' for both
multiplication and pointer dereference and don't find myself confused
by it.

BTW, if MS had used tuples for multiple return values, this might not
even be a problem:

   (id, _) = Foo()

Hmm... What if Nemerle treated functions with "out" arguments as
functions that return tuples?  Are there cases where this would not
work well?


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the devel-en mailing list