February 28, 2006 Re: if(;){} opinion | ||||
---|---|---|---|---|
| ||||
Posted in reply to Lionello Lunesu | "Lionello Lunesu" <lio@remove.lunesu.com> wrote in message news:du10fg$q5p$1@digitaldaemon.com... > Do you mean the two seemingly different "auto"s are not ambigious? That's right. >> 'var' would be a digression into pascalishness (ugh <g>). > I'm just glad you didn't use this argument against array slicing ; ) Pascal doesn't do array slicing. |
February 28, 2006 Re: if(;){} opinion | ||||
---|---|---|---|---|
| ||||
Posted in reply to clayasaurus | "clayasaurus" <clayasaurus@gmail.com> wrote in message news:dtvmkf$2e1a$1@digitaldaemon.com... > I'll vote against it because I don't understand the value of > > if (m; search("abcdef", "BcdasdfD")) > > over > > if (Regexp m = search("abcdef", "BcdasdfD") ) . > > Maybe someone can enlighten me? 1) m is implicitly typed 2) looks like the foreach 3) more concise |
February 28, 2006 Re: if(;){} opinion | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | Walter Bright schrieb:
> 'var' would be a digression into pascalishness (ugh <g>).
I believe more people would associate "var" with modern languages like JavaScript and C# which use it in the same fashion as D does with "auto".Changing to "var" would be more intuitive to a large group of people.
People with a long History of C/C++ are likely to be new to the concept of dynamic typing anyway so they might as well learn a new keyword.
But I agree with you that Pascal's way of "var" meaning "call by reference" is equally unintuitve.
Just my 0.02 EuroCent
Nils
|
February 28, 2006 Re: if(;){} opinion | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Tue, 28 Feb 2006 17:44:28 +1100, Walter Bright <newshound@digitalmars.com> wrote: > > "Charles" <noone@nowhere.com> wrote in message > news:du002j$2pcm$1@digitaldaemon.com... >> I think its short for 'auto' deduction ? >> >> 'var' gets my vote > > 'auto' goes way back to C and means "allocate on the stack". This also > implicitly means "destruct at end of scope." In order for type inference to > work, there has to be a keyword in front of the declaration to let the > parser know it's a declaration rather than an assignment. Thus, 'auto' now > means "allocate on the stack" and if the type is missing it also means > "infer the type." Types can be inferred with other storage classes: > > static x = 3; // x is int > > This follows the 'auto' proposal for C++ as far as I know. > > 'var' would be a digression into pascalishness (ugh <g>). Language Bigot! <G> Seriously though ... who cares if its a C thingy! This is NOT C. But you already know that. Just because C does 'X' is it good enough to justify keeping 'X'? You've already changed lots of other things to achieve a better, consistent, language - so why stop at this wart. 'auto', as a word, is too ambiguous to because it is an adjective that can apply to many things. Ok, so C applys it to automatic stack allocation and so does D, but D also applies it to automatic type-casting too. Why do you want your language to be ridiculed for this wart when it is so easy to change it. If you are too frightened of it being a Pascal-looking language (and 'var' will not do that, BTW), then pick some other more meaningful word. -- Derek Parnell Melbourne, Australia |
February 28, 2006 Re: if(;){} opinion | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Tue, 28 Feb 2006 21:03:14 +1100, Walter Bright <newshound@digitalmars.com> wrote: > > "Lionello Lunesu" <lio@remove.lunesu.com> wrote in message > news:du10fg$q5p$1@digitaldaemon.com... >> Do you mean the two seemingly different "auto"s are not ambigious? > > That's right. > I've forgotten: what's the syntax to automatically allocate on the static, a variable whose type is automatically type-cast? Is it ... auto auto x = readtext(somefile); -- Derek Parnell Melbourne, Australia |
February 28, 2006 Re: if(;){} opinion | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Tue, 28 Feb 2006 21:04:49 +1100, Walter Bright <newshound@digitalmars.com> wrote: > > "clayasaurus" <clayasaurus@gmail.com> wrote in message > news:dtvmkf$2e1a$1@digitaldaemon.com... >> I'll vote against it because I don't understand the value of >> >> if (m; search("abcdef", "BcdasdfD")) >> >> over >> >> if (Regexp m = search("abcdef", "BcdasdfD") ) . >> >> Maybe someone can enlighten me? > > 1) m is implicitly typed > 2) looks like the foreach > 3) more concise 4) ugly (looks like C) 5) Walter's idea -- Derek Parnell Melbourne, Australia |
February 28, 2006 Re: if(;){} opinion | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | Walter Bright wrote: > 'var' would be a digression into pascalishness (ugh <g>). Just pretend it's from ECMAScript :P -- -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/M d-pu s+: a-->----- C+++$>++++ UL P+ L+ E--- W++ N++ o? K? w++ !O !M V? PS- PE- Y PGP t 5 X? R tv-- b DI- D+ G e>+++ h>++ !r !y ------END GEEK CODE BLOCK------ Tomasz Stachowiak /+ a.k.a. h3r3tic +/ |
February 28, 2006 Re: if(;){} opinion | ||||
---|---|---|---|---|
| ||||
Posted in reply to Derek Parnell | Derek Parnell wrote: > On Tue, 28 Feb 2006 21:04:49 +1100, Walter Bright <newshound@digitalmars.com> wrote: > >> >> "clayasaurus" <clayasaurus@gmail.com> wrote in message >> news:dtvmkf$2e1a$1@digitaldaemon.com... >>> I'll vote against it because I don't understand the value of >>> >>> if (m; search("abcdef", "BcdasdfD")) >>> >>> over >>> >>> if (Regexp m = search("abcdef", "BcdasdfD") ) . >>> >>> Maybe someone can enlighten me? >> >> 1) m is implicitly typed >> 2) looks like the foreach >> 3) more concise > > 4) ugly (looks like C) > 5) Walter's idea > Agreed that it's damn ugly, but don't see why it looks like C. I think I too prefer: if (auto m = search("abcdef", "BcdasdfD") ) but don't support it 100%. Maybe there is a even better way out there.. -- Bruno Medeiros - CS/E student "Certain aspects of D are a pathway to many abilities some consider to be... unnatural." |
February 28, 2006 Re: if(;){} opinion | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | Walter Bright wrote: > "Charles" <noone@nowhere.com> wrote in message news:du002j$2pcm$1@digitaldaemon.com... >> I think its short for 'auto' deduction ? >> >> 'var' gets my vote > > 'auto' goes way back to C and means "allocate on the stack". This also implicitly means "destruct at end of scope." In order for type inference to work, there has to be a keyword in front of the declaration to let the parser know it's a declaration rather than an assignment. Thus, 'auto' now means "allocate on the stack" and if the type is missing it also means "infer the type." Types can be inferred with other storage classes: > > static x = 3; // x is int > > This follows the 'auto' proposal for C++ as far as I know. > Now this is something I've been meaning to comment on but haven't yet. This is damn AWFUL. No autotype declaration should work without the the autotype keyword! And I don't care if if deviates from the C++ or not, it's just plain bad. *angry face* > 'var' would be a digression into pascalishness (ugh <g>). > It wouldn't be, because they do different things. And even if it were, what would be the problem?? What matters in a feature/design is how good it is, not if it is similar to other languages or not. -- Bruno Medeiros - CS/E student "Certain aspects of D are a pathway to many abilities some consider to be... unnatural." |
February 28, 2006 Re: if(;){} opinion | ||||
---|---|---|---|---|
| ||||
Posted in reply to Derek Parnell | Walter said: >>>> Thus, 'auto' now means "allocate on the stack" and if the type is missing it also means "infer the type." So I suppose 1 "auto" would suffice. L. "Derek Parnell" <derek@psych.ward> wrote in message news:op.s5ol8l1e6b8z09@ginger.vic.bigpond.net.au... > On Tue, 28 Feb 2006 21:03:14 +1100, Walter Bright <newshound@digitalmars.com> wrote: > >> >> "Lionello Lunesu" <lio@remove.lunesu.com> wrote in message news:du10fg$q5p$1@digitaldaemon.com... >>> Do you mean the two seemingly different "auto"s are not ambigious? >> >> That's right. >> > > I've forgotten: what's the syntax to automatically allocate on the static, a variable whose type is automatically type-cast? Is it ... > > auto auto x = readtext(somefile); > > -- > Derek Parnell > Melbourne, Australia |
Copyright © 1999-2021 by the D Language Foundation