Jump to page: 1 2 3
Thread overview
Does anyone like the template syntax "!()" ?
Oct 11, 2005
Tomás A. Rossi
Oct 11, 2005
Walter Bright
Oct 13, 2005
Stewart Gordon
Oct 14, 2005
Walter Bright
Re: Does anyone like the template syntax
Oct 12, 2005
Tomás Rossi
Oct 12, 2005
Regan Heath
Oct 12, 2005
Tomás Rossi
Oct 12, 2005
JT
Re: Does anyone like the template syntax
Oct 12, 2005
Sean Kelly
Oct 12, 2005
John C
Oct 12, 2005
Sean Kelly
Oct 12, 2005
Ivan Senji
Oct 14, 2005
Walter Bright
Oct 14, 2005
Ivan Senji
some thoughts on Implicit instantiation
Oct 14, 2005
BCS
Oct 14, 2005
Walter Bright
Oct 15, 2005
John C
Oct 15, 2005
Georg Wrede
Oct 15, 2005
Sean Kelly
Oct 15, 2005
Walter Bright
Oct 16, 2005
Tomás Rossi
Oct 12, 2005
Ben Hinkle
Oct 12, 2005
Don Clugston
October 11, 2005
Does anyone like the template syntax Foo!(T) ?
I think it's better than C++ angular bracket syntax, but it's still a little
ugly.

Isn't there an alternative?

Best regards Tom


October 11, 2005
"Tomás A. Rossi" <Tomás_member@pathlink.com> wrote in message news:dihdcb$bb$1@digitaldaemon.com...
> Does anyone like the template syntax Foo!(T) ?

I do <g>.

> I think it's better than C++ angular bracket syntax, but it's still a
little
> ugly. Isn't there an alternative?

It's not perfect, but I don't think there's a better solution.


October 12, 2005
"Tomás A. Rossi" <Tomás_member@pathlink.com> wrote in message news:dihdcb$bb$1@digitaldaemon.com...
> Does anyone like the template syntax Foo!(T) ?
> I think it's better than C++ angular bracket syntax, but it's still a
> little
> ugly.

I'm with Walter on this one.  That, and by now, !() just screams "template" to me.  <> does not.


October 12, 2005
In article <dihdcb$bb$1@digitaldaemon.com>, Tomás A. Rossi says...
>
>Does anyone like the template syntax Foo!(T) ?
>I think it's better than C++ angular bracket syntax, but it's still a little
>ugly.

Overall, I think it's fairly intuitive in that it mimics function call syntax. And it's better than <>, as nested tempate terminators (ie. >>) cause problems. Templates are one of the things I like best about D.  They're both more powerful and more elegant than their C++ counterpart, lack of implicit instantiation notwithstanding.


Sean


October 12, 2005
In article <dihjs7$580$1@digitaldaemon.com>, Jarrett Billingsley says...
>
>"Tomás A. Rossi" <Tomás_member@pathlink.com> wrote in message news:dihdcb$bb$1@digitaldaemon.com...
>> Does anyone like the template syntax Foo!(T) ?
>> I think it's better than C++ angular bracket syntax, but it's still a
>> little
>> ugly.
>
>I'm with Walter on this one.  That, and by now, !() just screams "template" to me.  <> does not.
>
>

I'm not saying the opposite. I just wonder if there could be a workaround to that syntax as well. I repeat: i like it more than <>, but is !() the best?

Thanks
Tom


October 12, 2005
On Wed, 12 Oct 2005 01:20:58 +0000 (UTC), Tomás Rossi <Tomás_member@pathlink.com> wrote:
> In article <dihjs7$580$1@digitaldaemon.com>, Jarrett Billingsley says...
>>
>> "Tomás A. Rossi" <Tomás_member@pathlink.com> wrote in message
>> news:dihdcb$bb$1@digitaldaemon.com...
>>> Does anyone like the template syntax Foo!(T) ?
>>> I think it's better than C++ angular bracket syntax, but it's still a
>>> little
>>> ugly.
>>
>> I'm with Walter on this one.  That, and by now, !() just screams "template"
>> to me.  <> does not.
>>
>>
>
> I'm not saying the opposite. I just wonder if there could be a workaround to
> that syntax as well. I repeat: i like it more than <>, but is !() the best?

Yes.

Regan

p.s. If you have a suggestion as to a different syntax please post it.
October 12, 2005
In article <opsyiecdxa23k2f5@nrage.netwin.co.nz>, Regan Heath says...
>
>On Wed, 12 Oct 2005 01:20:58 +0000 (UTC), Tomás Rossi <Tomás_member@pathlink.com> wrote:
>> In article <dihjs7$580$1@digitaldaemon.com>, Jarrett Billingsley says...
>>>
>>> "Tomás A. Rossi" <Tomás_member@pathlink.com> wrote in message news:dihdcb$bb$1@digitaldaemon.com...
>>>> Does anyone like the template syntax Foo!(T) ?
>>>> I think it's better than C++ angular bracket syntax, but it's still a
>>>> little
>>>> ugly.
>>>
>>> I'm with Walter on this one.  That, and by now, !() just screams
>>> "template"
>>> to me.  <> does not.
>>>
>>>
>>
>> I'm not saying the opposite. I just wonder if there could be a
>> workaround to
>> that syntax as well. I repeat: i like it more than <>, but is !() the
>> best?
>
>Yes.
>
>Regan
>
>p.s. If you have a suggestion as to a different syntax please post it.

Well, you're right on that one.
But maybe someone else have a suggestion. I was trying to introduce a subject
that is of my interest because that template syntax workaround !() is the only
little spot in a really beautiful syntax (enhanced with respect to c++).

Greetings
Tom
October 12, 2005
I agree with this - it seems out of place in D. But hey Im getting used to it. its really not that big of a deal.


Tomás Rossi wrote:
> that is of my interest because that template syntax workaround !() is the only
> little spot in a really beautiful syntax (enhanced with respect to c++).
> 
> Greetings
> Tom
October 12, 2005
"Tomás A. Rossi" <Tomás_member@pathlink.com> wrote in message news:dihdcb$bb$1@digitaldaemon.com...
> Does anyone like the template syntax Foo!(T) ?

It is unfortunate keyboards don't have another brace set.

> I think it's better than C++ angular bracket syntax, but it's still a
> little
> ugly.
>
> Isn't there an alternative?

probably not. The only one that occurs to me is replacing the '!' with a
less obtrusive character like '.'. For example Foo.(T) or
pkg.mod.class.(Foo,Bar). One advantage (perhaps) of .() over !() is that
!( can appear as two tokens and so the lexer can't combine !( into one token
while .( is never legal today so the lexer can always make .( a token.
This is just thinking off the top of my head so if anyone can think of legal
D code where .( is two tokens please correct me.


October 12, 2005
Tomás A. Rossi wrote:
> Does anyone like the template syntax Foo!(T) ?
> I think it's better than C++ angular bracket syntax, but it's still a little
> ugly.
> 
> Isn't there an alternative?
> 
> Best regards Tom
> 
> 
Another possibility that's more like C++ is <| and |>.
(more typing, but doesn't suffer from the >> problem).
There's few related options (syntax holes)...
Foo<T>
Foo!(T)
Foo<|T|>
Foo(|T|)
Foo{|T|}
Foo[|T|]

Perhaps the colon could be used. I'm less confident about whether this would conflict with something. Can't be used with <> because of the ?: operator.

Foo(:T:)
Foo[:T:]    -- well, it's an interesting syntax for arrays.
Foo{:T:}

The first one would mean that smilies would become a token :).


I think the old argument that "< > doesn't look much like brackets" doesn't carry much weight with the rise of HTML/XML.
But the >> problem is a serious one.

It's not a great list to choose from. IMHO, these four are the best of a bad bunch:

vector<real> a;
vector!(real) b;
vector(:real:) c;
vector<|real|> d;
« First   ‹ Prev
1 2 3