Can you do this in D?
Wes
ffhighwind at hotmail.com
Thu Jul 26 18:18:15 PDT 2012
On Thursday, 26 July 2012 at 23:55:29 UTC, Walter Bright wrote:
> On 7/26/2012 4:20 AM, Wes wrote:
>> 5. Why not support other operators like $, #, and @?
>> This is more of a rhetorical... as I know the language doesn't
>> need them, nor would I know if they would be binary/unary
>> prefix/etc or the precedence... although they would be nice to
>> have.
>
> The question shouldn't be framed as "why not X?" but as "does
> the utility of having X justify placing in in the language?"
>
> What is the utility of operators $, # and @?
>
>
> > Specifically I'd like $prefix to be stringification.
>
> Can you please be more specific about what this might do?
It's not for more functionality but more for programmer usability
and terse coding. I just noticed the .stringof being used in some
examples. It's the same idea as Java/C# .ToString() with far less
typing.
I was starting development of my own language, and looked more at
what I could do with D and saw that it included pretty much
everything I wanted, except the stuff I've mentioned. I wanted my
language to stretch the boundaries of language/compiler or
metaprogramming.
The following are potential features/lackings of the language (no
offense to the language developers as I am very impressed
overall):
1. It has *practically forces use of the GC, since turning it off
means I can't use many features of the language. This isn't as
big of a deal to me as it is to many C++ devs (my assumption). A
GC gives the impression of slow managed, even if the language
isn't scripted/bytecode.
2. It doesn't have ways of introducing new syntax (e.g. $, @, #
operators or different variable attributes like myconst).
I don't see this as a major flaw as I don't know of any other
language other than scheme/lisp/ratchet that allow this.
3. It can't run *all* forms of code at compile time.
4. It doesn't have a simple prettyprint operator. I think
.stringof is a big step forward from .ToString() for simplicity,
but obviously $variable would be more terse.
5. It doesn't have a way to iterate over every id in scope.
I can't think of a good reason to do this anyway.
More information about the Digitalmars-d
mailing list