September 01, 2005
Bruno Medeiros wrote in news:df2r7u$2c6$3@digitaldaemon.com

[...]
> I'm on the opinion that the var type is important and worthy enough to be mentioned at least once.

To serve your opinion with an argument:

<code>
  f:= &module1.g;
  v:= module2.v;
  w:= f( v); // error
</code>

where the error reported is:

| function f () does not match argument types (T)

Now ask those of other opnions, who does not believe, that such implicit declarations may lead to problems in large scale projects, how they would debug this.

And if they want to tell, that you can forbid the use of the `:=' if you think it leads to problems, just say them that your boss bought such a big project with those `:=' in it.

-manfred
September 01, 2005
In article <df65lj$h02$1@digitaldaemon.com>, Manfred Nowak says...
>
>Bruno Medeiros wrote in news:df2r7u$2c6$3@digitaldaemon.com
>
>[...]
>> I'm on the opinion that the var type is important and worthy enough to be mentioned at least once.
>
>To serve your opinion with an argument:
>
><code>
>  f:= &module1.g;
>  v:= module2.v;
>  w:= f( v); // error
></code>

How is this any different from
SomeType w = module1.g(module2.v);?

>where the error reported is:
>
>| function f () does not match argument types (T)

Why wouldn't the error message be:
| function TypeA f(TypeB) does not match argument types (TypeC)
where it is obvious what the types are.

>Now ask those of other opnions, who does not believe, that such implicit declarations may lead to problems in large scale projects, how they would debug this.

In the same way as I would debug:

TypeD f = &module1.g; // error
TypeC v = module2.v;
TypeA w = f( v);

or

SomeType w = module1.g(module2.v);

/Oskar



September 01, 2005
> The narrow(er?) scope is indeed a benefit, but that could be done without ":=".

Yup. I didn't mean to imply otherwise. An example like
  if (focus := GetFocus()) {
    ... do something with focus HWND ...
  }
would be more interesting than the one I posted. The sieve example was a
short "real-world" example of possible uses of := that wasn't intended to
imply it's the only way to code up sieve or that := is only useful for that
kind of code.


September 01, 2005
Oskar wrote

[something]

Obey the rules of the netiquette, i.e. supply full name and a valid email address, then you may get further hints.

-manfred
September 01, 2005
In article <df74n2$r85$1@digitaldaemon.com>, Manfred Nowak says...
>
>Oskar wrote
>
>[something]
>
>Obey the rules of the netiquette, i.e. supply full name and a valid email address, then you may get further hints.

That, I can certainly do, as my only excuse is laziness when using the web interface.

/Oskar


September 01, 2005
In article <df5a9e$2ltk$1@digitaldaemon.com>, Bruno Medeiros says...
>
>Oskar wrote:
>> In article <det4pk$16si$1@digitaldaemon.com>, Ben Hinkle says...
>> 
>>>
>>>There's a proposed C++ extension that uses 'auto' (or maybe 'decl' I can't
>>>remember). I prefer the operator because
>>>1) it's less typing (one of the goals of the idea is to cut down verbosity)
>>>2) it is used to declare variables in expressions, too.
>> 
>> 
>> There could be some advantages to 'auto' too. It could be used to make simple templates:
>> 
>> auto f(auto x) { return x+1;}
>> 
>> This would be most useful when defining function literals.
> >[...]
>
>Please stop calling that "auto". There is already an auto keyword in D, which does a whole different thing.

I know that very well. This is not a suggestion to change its behaviour in D, just a discussion about the possibilities of automatic type inference and how auto is proposed to work in C++. Feel free to replace auto by something else before reading my post. :)

/Oskar


September 01, 2005
In article <df78mk$11d5$1@digitaldaemon.com>, Oskar Linde says...
>
>In article <df74n2$r85$1@digitaldaemon.com>, Manfred Nowak says...
>>
>>Oskar wrote
>>
>>[something]
>>
>>Obey the rules of the netiquette, i.e. supply full name and a valid email address, then you may get further hints.
>
>That, I can certainly do, as my only excuse is laziness when using the web interface.
>
>/Oskar

And also not understanding how it works... Obviously...

/Oskar


September 01, 2005
"Pablo Aguilar" <pablo.dot.aguilar@gmail.dot.com> wrote in message news:df57fq$2ibf$1@digitaldaemon.com...
>
> "Ben Hinkle" <bhinkle@mathworks.com> wrote in message news:df4uko$28pd$1@digitaldaemon.com...
>> Interesting. I hadn't thought of auto in function parameter lists and return values. Do you know if the C++ auto can do that? I don't even have a reference for what C++ auto proposal actually is so any links would be appreciated.
>
> This might help: http://www.informit.com/guides/content.asp?g=cplusplus&seqNum=219
>
> The proposal is available here: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1607.pdf

Cool, thanks. That's an interesting read. The approach there, for those who don't want to bother reading it, is that 'auto' is a keyword that can appear in declarations that gets resolved like a template argument deduction. So things like "const auto& x = y" or "std::vector<auto> a = b" are allowed. Given that D doesn't have const or references (eg int&) and that template instantiation is explicit I don't think the C++ proposal really is worth it - if indeed it even really applies to D. Anyway, it's definitely interesting stuff.


September 01, 2005
"Oskar Linde" <Oskar_member@pathlink.com> wrote in message news:df78mk$11d5$1@digitaldaemon.com...
> In article <df74n2$r85$1@digitaldaemon.com>, Manfred Nowak says...
>>
>>Oskar wrote
>>
>>[something]
>>
>>Obey the rules of the netiquette, i.e. supply full name and a valid email address, then you may get further hints.
>
> That, I can certainly do, as my only excuse is laziness when using the web interface.
>
> /Oskar
>
>

I think Manfred was being evasive :-)
I certainly don't mind what name you (or anyone else) use. It helps to be
consistent since then tools that parse newsgroups can group all your posts
together (eg, sort-by-name and my own code that tracks posting histories
based on name)
Also I agree with your posted response to Manfred's about how to debug :=
code. It's a very simple operator that is 99% the same as sprinkling
"typeof" and braces around.


September 01, 2005
Ben Hinkle wrote in news:df7fqc$1add$1@digitaldaemon.com

[...]
> I think Manfred was being evasive :-)

No. I was angry as one can conclude from the missing "please" in front of the "obeye". Sorry for that.


[...]
> Also I agree with your posted response to Manfred's about how to debug := code. It's a very simple operator that is 99% the same as sprinkling "typeof" and braces around.

When I started with D, in
http://www.digitalmars.com/d/archives/21537.html
you Ben, gave the argument of the difficulties accompanied by having
to dive deeply into a module heterarchy.

But as I meanwhile concluded its _not_ your proposal that establishes the same sort of difficulties again. The `typeof' construct itself is responsible for that.

So, feeling that something is wrong and wrongly attacking your proposal I finally tracked it down to `typeof'. To clear this I start a new thread.

-manfred