May 30, 2013
Walter Bright:

> Not a bad idea. But why not go a step further, and make:
>
>    x := value;
>
> the equivalent of:
>
>    const x := value;
>
> ?

Of course. But I think that syntax saves only a small amount of chars, and it adds a second obvious way to do one thing.

There is another syntax that's missing in D that I think is much more useful, and it allows to do something that currently has no good way to be done.

Bye,
bearophile
May 30, 2013
> Not a bad idea. But why not go a step further, and make:
>
>    x := value;
>
> the equivalent of:
>
>    const x := value;
>
> ?


This one is really hard for me to offer input on:

I could get a lot done with the const version.

I could agree with you for multiple reasons I think,
- const x := 1; still works, yet it's redundant with the = operator.
- writing const style code is good in math
- the := fits into FP-style code too
- := has some historical precedence (in the parsers) (but not in the languages) for meaning const

And I'd be happy with compromise.

But personally, I did truly want to use it for the non const stuff, too, even if I don't want to admit that. I'd use it for a lot of stuff.

Which leads me to dare suggest there could be 2 operators ....
:= and $=, the latter for const (Guys you may be mad now, people would like the $= later on...)

But please, don't let that worry you!

I only ask for the simplest change, if there could be any compromise.
May 30, 2013
:= and $= and just run with it.
May 30, 2013
> But personally, I did truly want to use it for the non const stuff, too, even if I don't want to admit that. I'd use it for a lot of stuff.

Yes, I desire the same thing. The day I get this, I will abandon python/octave for  D for doing mathsy data analysis.

May 30, 2013
On Thu, 30 May 2013 18:14:18 -0400, MrzlganeE <bulletproofchest@gmail.com> wrote:

>> Not a bad idea. But why not go a step further, and make:
>>
>>    x := value;
>>
>> the equivalent of:
>>
>>    const x := value;
>>
>> ?
>
>
> This one is really hard for me to offer input on:
>
> I could get a lot done with the const version.
>
> I could agree with you for multiple reasons I think,
> - const x := 1; still works, yet it's redundant with the = operator.

I think Walter meant:

const x = value;

-Steve
May 30, 2013
Regarding the $, I am worried for suggesting it cause I don't want to mess up any proposal

It would be easier to suggest, if the $ didn't look so odd.
The "$" is a funny looking symbol.

I was imagining how the shape of the C, and the S, and almost a T is within the $, and it's crossed out to show you should not alter it. Yet those thoughts are very abstract.

So, I would be happy with any of the 3.
- := is nonconst
- := is const
- := and $=
May 30, 2013
On 05/30/2013 03:15 PM, MrzlganeE wrote:

> := and $= and just run with it.

Let's not forget immutable and shared either. How about their initials for mutable, const, immutable, and shared? I am more than half joking. :)

a m= 42;
b c= 43;
c i= 44;
d s= 45;

Ali

May 30, 2013
Am Thu, 30 May 2013 08:01:09 +0200
schrieb Paulo Pinto <pjmlp@progtools.org>:

> Am 30.05.2013 07:41, schrieb Ali Çehreli:
> > On 05/29/2013 05:19 PM, MrzlganeE wrote:
> >
> >  > The := operator would allow to declare a variable, deduce
> >  > its type, and define its value.
> >  >
> >  > void main() {
> >  >      x := 1;
> >  >      y := 2.0;
> >  >      z := x * y;
> >  >      y = 3.0;
> >  > }
> >
> > I like it.
> >
> > Ali
> >
> 
> It is like is done in Go.

I don't mind either. I think at first 'auto' was meant to shorten long template instance names. This seems like the next step and it looks elegant. Pascal and Go users would love it :D

-- 
Marco

May 30, 2013
On Thursday, May 30, 2013 23:36:09 js.mdnq wrote:
> A class is just syntactic sugar for a collection of variables... whats the use? It makes it easier for the programmer... same with auto, same with :=... If you don't realize that then you should think about it some more... (sure a class is more useful BUT that is besides the point)

There are orders of magnitudes of difference between providing a new abstraction like a class and simply rewriting

auto i = foo;

as

i := foo;

_All_ it does is save you 4 characters and shift where in the statement the piece is that tells the compiler to infer the type.

- Jonathan M Davis
May 31, 2013
Jonathan:

The feature is not possible to rate in terms of character count.

http://www.etymonline.com/index.php?term=automobile

It removes this French word from math expressions.