Jump to page: 1 210  
Page
Thread overview
Template instantiation syntax
Oct 10, 2008
Walter Bright
Oct 10, 2008
Sergey Gromov
Oct 10, 2008
bearophile
Oct 10, 2008
Walter Bright
Oct 11, 2008
bearophile
Oct 11, 2008
Tiago Carvalho
Oct 11, 2008
Benji Smith
Oct 11, 2008
Bent Rasmussen
Oct 11, 2008
Walter Bright
Oct 10, 2008
Danny Wilson
Oct 10, 2008
Benji Smith
Oct 10, 2008
Walter Bright
Oct 10, 2008
Jason House
Oct 10, 2008
Walter Bright
Oct 11, 2008
Bill Baxter
Oct 10, 2008
Walter Bright
Oct 11, 2008
Jason House
Oct 11, 2008
Sergey Gromov
Oct 11, 2008
Walter Bright
Oct 11, 2008
Sergey Gromov
Oct 11, 2008
Michel Fortin
Oct 11, 2008
Christopher Wright
Oct 10, 2008
BLS
Oct 11, 2008
Bill Baxter
Oct 11, 2008
Max Samukha
Oct 11, 2008
Walter Bright
Oct 11, 2008
Bill Baxter
Oct 11, 2008
Walter Bright
Oct 11, 2008
Max Samukha
Oct 11, 2008
KennyTM~
Oct 11, 2008
KennyTM~
Oct 11, 2008
Bill Baxter
Oct 11, 2008
Walter Bright
Oct 11, 2008
Max Samukha
Oct 11, 2008
Bent Rasmussen
Oct 11, 2008
KennyTM~
Oct 12, 2008
Walter Bright
Oct 12, 2008
KennyTM~
Oct 12, 2008
Denis Koroskin
Oct 12, 2008
KennyTM~
Oct 12, 2008
KennyTM~
Oct 12, 2008
Derek Parnell
Oct 13, 2008
KennyTM~
Oct 13, 2008
Robert Fraser
Oct 16, 2008
Bruno Medeiros
Oct 18, 2008
Bent Rasmussen
Oct 18, 2008
Bill Baxter
Oct 12, 2008
Bent Rasmussen
Oct 12, 2008
bearophile
Oct 12, 2008
KennyTM~
Oct 12, 2008
Sergey Gromov
Oct 13, 2008
KennyTM~
Oct 16, 2008
Bruno Medeiros
Oct 11, 2008
Dave
Oct 11, 2008
KennyTM~
Oct 11, 2008
Dave
Oct 11, 2008
KennyTM~
Oct 11, 2008
Nick Sabalausky
Oct 11, 2008
Dave
Oct 11, 2008
Nick Sabalausky
Oct 11, 2008
Robert Fraser
Oct 11, 2008
bearophile
Oct 11, 2008
bearophile
Oct 12, 2008
bearophile
Oct 12, 2008
Bill Baxter
Oct 12, 2008
Bill Baxter
Oct 12, 2008
Derek Parnell
Oct 12, 2008
Bill Baxter
Oct 12, 2008
Christopher Wright
Oct 16, 2008
Bruno Medeiros
Oct 12, 2008
Christopher Wright
Oct 11, 2008
Benji Smith
Oct 11, 2008
Dave
Oct 11, 2008
bearophile
Oct 11, 2008
Walter Bright
Oct 11, 2008
Nick Sabalausky
Oct 12, 2008
Ary Borenszweig
Oct 11, 2008
Dave
Oct 11, 2008
Bent Rasmussen
Oct 12, 2008
bearophile
Oct 12, 2008
Nick Sabalausky
Oct 14, 2008
Kyle Furlong
Oct 14, 2008
Frank Benoit
Oct 14, 2008
Bill Baxter
Oct 14, 2008
Christopher Wright
October 10, 2008
We seem to have reached a dead end on finding a significantly better alternative than foo!(bar).

All is not lost, though. Andrei is working on an emacs module that will parse D code and replace foo!(bar) with foo«bar» for display only when the editor is in D mode, the underlying text will still be foo!(bar). (This doesn't affect D at all, only its display in Emacs.)

Also, we're going to try using ! for single argument syntax, as in:

foo!bar  is same as   foo!(bar)
foo!10   is same as   foo!(10)

etc. 0 arguments or more than 1 argument or arguments that are more than one token long will still require !( ). We'll see how that works. I think it looks rather nice.
October 10, 2008
Fri, 10 Oct 2008 14:15:12 -0700,
Walter Bright wrote:
> Also, we're going to try using ! for single argument syntax, as in:
> 
> foo!bar  is same as   foo!(bar)
> foo!10   is same as   foo!(10)
> 
> etc. 0 arguments or more than 1 argument or arguments that are more than one token long will still require !( ). We'll see how that works. I think it looks rather nice.

I'd definitely give it a try.
October 10, 2008
Walter Bright:
> Also, we're going to try using ! for single argument syntax, as in:
> foo!bar  is same as   foo!(bar)
> foo!10   is same as   foo!(10)

And what's the advantage of such special casing of the syntax? Just to remove 2 chars () that improves clarity? I am for using shorter syntaxes in D, but not in that way. If you want to reduce the length of D programs make the semicolons optional, introduce eager and lazy array comprehensions, try to introduce a lambda syntax like the C# one, etc.

Bye,
bearophile
October 10, 2008
bearophile wrote:
> And what's the advantage of such special casing of the syntax? Just
> to remove 2 chars () that improves clarity?

Yes. I think small things like this can make a big difference. Most template instantiations are one simple argument.

> I am for using shorter
> syntaxes in D, but not in that way.

Why not?

> If you want to reduce the length
> of D programs make the semicolons optional,

That would seriously damage the compiler's ability to identify, diagnose, and recover from syntax errors correctly.

> introduce eager and lazy
> array comprehensions, try to introduce a lambda syntax like the C#
> one, etc.

October 10, 2008
Walter Bright wrote:
> We seem to have reached a dead end on finding a significantly better alternative than foo!(bar).
> 
> All is not lost, though. Andrei is working on an emacs module that will parse D code and replace foo!(bar) with foo«bar» for display only when the editor is in D mode, the underlying text will still be foo!(bar). (This doesn't affect D at all, only its display in Emacs.)
> 
> Also, we're going to try using ! for single argument syntax, as in:
> 
> foo!bar  is same as   foo!(bar)
> foo!10   is same as   foo!(10)
> 
> etc. 0 arguments or more than 1 argument or arguments that are more than one token long will still require !( ). We'll see how that works. I think it looks rather nice.

Quick question: is "!" an operator in this context? (Or is it something-other-than-an-operator? If so, what is it?)

Is this code legal:

   (foo!bar)[] myArray;

Thanks!

--benji
October 10, 2008
Walter Bright Wrote:

> We seem to have reached a dead end on finding a significantly better alternative than foo!(bar).
> 
> All is not lost, though. Andrei is working on an emacs module that will parse D code and replace foo!(bar) with foo«bar» for display only when the editor is in D mode, the underlying text will still be foo!(bar). (This doesn't affect D at all, only its display in Emacs.)
> 
> Also, we're going to try using ! for single argument syntax, as in:
> 
> foo!bar  is same as   foo!(bar)
> foo!10   is same as   foo!(10)
> 
> etc. 0 arguments or more than 1 argument or arguments that are more than one token long will still require !( ). We'll see how that works. I think it looks rather nice.

Couple of comments/questions

The tool!lathe syntax doesn't look visually distinct enough for me. The @ syntax seems nicer on the eyes. I'm not trying to push changes. @() looks ugly to me, and having matching template syntax is desirable.

Is it ok to chain!nested!templates?  Gramatically, it's unambiguous.

Will Andrei color template parameters with ! so they're easier to spot? How would they look when nested? Alternating colors should work
October 10, 2008
Op Fri, 10 Oct 2008 23:29:00 +0200 schreef bearophile <bearophileHUGS@lycos.com>:

> If you want to reduce the length of D programs make the semicolons optional, introduce eager and lazy array comprehensions, try to introduce a lambda syntax like the C# one, etc.

If you could reduce the length of your whining it would save me alot of reading time aswell :-)
October 10, 2008
Jason House wrote:
> Walter Bright Wrote:
> 
>> We seem to have reached a dead end on finding a significantly
>> better alternative than foo!(bar).
>> 
>> All is not lost, though. Andrei is working on an emacs module that
>> will parse D code and replace foo!(bar) with foo«bar» for display
>> only when the editor is in D mode, the underlying text will still
>> be foo!(bar). (This doesn't affect D at all, only its display in
>> Emacs.)
>> 
>> Also, we're going to try using ! for single argument syntax, as in:
>> 
>> 
>> foo!bar  is same as   foo!(bar) foo!10   is same as   foo!(10)
>> 
>> etc. 0 arguments or more than 1 argument or arguments that are more
>> than one token long will still require !( ). We'll see how that
>> works. I think it looks rather nice.
> 
> Couple of comments/questions
> 
> The tool!lathe syntax doesn't look visually distinct enough for me.
> The @ syntax seems nicer on the eyes. I'm not trying to push changes.
> @() looks ugly to me, and having matching template syntax is
> desirable.

I agree. But after all the aggravation, I learned to be happy with what
I can get.

> Is it ok to chain!nested!templates?  Gramatically, it's unambiguous.

Walter gave me a black eye over it last night. I'll let him to provide
the juicy details. The short version is that for now a!b!c is disallowed
with extreme prejudice.

> Will Andrei color template parameters with ! so they're easier to
> spot? How would they look when nested? Alternating colors should work

Walter exaggerated when he said that "I'm working on" an emacs solution.
I only said "I'm pretty sure it can be done". :o)


Andrei
October 10, 2008
Walter Bright schrieb:
> We seem to have reached a dead end on finding a significantly better alternative than foo!(bar).
> 
> All is not lost, though. Andrei is working on an emacs module that will parse D code and replace foo!(bar) with foo«bar» for display only when the editor is in D mode, the underlying text will still be foo!(bar). (This doesn't affect D at all, only its display in Emacs.)
> 

So!Smalltalk inspired  :)  What about st like code blocks instead of closures ?
Would make code more readable then allowing ! instead of !()

> Also, we're going to try using ! for single argument syntax, as in:
> 
> foo!bar  is same as   foo!(bar)
> foo!10   is same as   foo!(10)
> 

Both valid than ?

> etc. 0 arguments or more than 1 argument or arguments that are more than one token long will still require !( ). We'll see how that works. I think it looks rather nice.
October 10, 2008
Benji Smith wrote:
> Quick question: is "!" an operator in this context?

Yes.

> (Or is it something-other-than-an-operator? If so, what is it?)
> 
> Is this code legal:
> 
>    (foo!bar)[] myArray;

Yes, just like:
     foo.bar[] myArray;
is legal.
« First   ‹ Prev
1 2 3 4 5 6 7 8 9 10