July 26, 2012
On 7/26/2012 12:44 PM, Araq wrote:
> He explicitely asked about other programming languages...


Araq, you are welcome here.


July 27, 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.
July 27, 2012
On Thu, 26 Jul 2012 16:06:47 -0700
"H. S. Teoh" <hsteoh@quickfur.ath.cx> wrote:

> On Thu, Jul 26, 2012 at 05:59:08PM -0400, Nick Sabalausky wrote:
> > On Thu, 26 Jul 2012 17:17:39 +0200
> > Andrej Mitrovic <andrej.mitrovich@gmail.com> wrote:
> [...]
> > > Now if someone would stop fiddling with the damn javascript which keeps erroring out.. I'm beginning to join the Nick camp w.r.t. JS. :p
> > 
> > JavaScript is a technology (from the makers of clearly the greatest web browser of all time - Netscape) whose primary usage, and indeed killer feature, is to enable people to develop new and exciting ways to make the web slower, more broken, and more obnoxious than could ever be achieved with mere HTML/CSS alone. This, of course, is a major win for humanity in general, and is something we can all be proud of.
> > 
> > http://semitwist.com/articles/article/view/my-awesome-web-development-game
> 
> I'm guilty of turning <i> into <em>, actually. You may shoot me now.
> 

Heh, yea, I've actually done it too (in hand-written HTML though, not
mechanically). You know, just following standard recommended practices.
Then it hit me: "WTF am I doing this for? My whole *intent* is for this
to be bold/italic, why am I beating around the bush? Just use <b>/<i>
and be done with it, Nick!" Now my posts are filled with <b> and <i>
tags, and maybe it's just my hunger for rebelling, but I've never
had a problem with it and I couldn't be happier :)

> (Actually, I resisted many attempts at introducing bold and italics buttons on my web-based editing page. I even introduced a way of indicating which table cells are headers, so that styling will work properly instead of half-assed manual bolding. But no, the users clamored for bold and italics until they threatened to mob me (ok, that last part may be an exaggeration), and so the horrible bold/italics buttons appeared. So far, I've resisted adding a "red" button (apparently, bold and italics aren't enough, sometimes you want something in RED too). I managed to evade that one by having a select box for the status field of the items, one option of which is styled red, and insisting that's the only place red is allowed. We'll see how long I hold out on that one.)
> 

Yea, there's certainly benefits to semantic tagging, but I think it's become too religious and under-pragmatic.

I would draw the line at "I want blinking/scrolling text" though ;)

July 27, 2012
On 7/26/2012 6:18 PM, Wes wrote:
> 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.

C++ doesn't have features that would require a GC - not using the GC in D does not mean the language is crippled to be less than C++.


> 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.

We've explicitly decided not to do user defined syntax.


> 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.

We try not to add features just because we can - we try to do ones only if they have compelling use cases.
July 27, 2012
On 27-07-2012 06:56, Walter Bright wrote:
> On 7/26/2012 6:18 PM, Wes wrote:
>> 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.
>
> C++ doesn't have features that would require a GC - not using the GC in
> D does not mean the language is crippled to be less than C++.

new and assert both result in GC allocation and are not easily replaced with functions that use manual memory management. You have to replace functions in druntime to get the desired effect. druntime isn't part of the language specification, so, strictly speaking, not using the GC in D /does/ make the language slightly more crippled than C++.

>
>
>> 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.
>
> We've explicitly decided not to do user defined syntax.
>
>
>> 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.
>
> We try not to add features just because we can - we try to do ones only
> if they have compelling use cases.

-- 
Alex Rønne Petersen
alex@lycus.org
http://lycus.org
July 27, 2012
On Thu, 26 Jul 2012 19:35:56 +0200
"David Piepgrass" <qwertie256@gmail.com> wrote:
> For example if I do
> 
> enum twoPi = computePi() + computePi();
> 
> I don't know if the compiler computes PI once or twice. Does someone know? But if I define this template:
> 

You could toss a ctfeWriteln (or whatever it's named) into
'computePi' and find out.

It shouldn't NEED to evaluate it twice since CTFE isn't allowed to have any global mutable state.

July 27, 2012
On 2012-07-27 01:55, Walter Bright wrote:

> 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?

If I understand him correctly I think:

$variable

Would be the same as:

to!(string)(variable)

And/or:

"foo $variable bar"

Would be the same as:

"foo " ~ to!(string)(variable) ~ " bar"

The later would be string interpolation.

-- 
/Jacob Carlborg
July 27, 2012
On 2012-07-27 03:18, Wes wrote:

> 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.

.stringof is not the equivalent to .ToString(). .stringof is more of a compile time language feature. It turns an expression into a string:

import std.stdio;

void main ()
{
    string foo = "bar";
    writeln(foo.stringof);
    writeln((3 + 4).stringof);
}

The above code will print:

foo
3 + 4

The equivalent to .ToString() in D would be .toString() or to!(string)(variable).

> 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.

There could be a couple of reasons for doing this. For example creating a DSL.

-- 
/Jacob Carlborg
July 27, 2012
On Thursday, 26 July 2012 at 23:57:32 UTC, Walter Bright wrote:
> On 7/26/2012 12:44 PM, Araq wrote:
>> He explicitely asked about other programming languages...
>
> Araq, you are welcome here.

Yes, of course. If anything, I'd wish there was _more_ interaction between PL communities, not less. My post was just an attempt at a little humor – I hoped this was clear from the, uhm, style.

David
July 27, 2012
On Thursday, 26 July 2012 at 12:17:23 UTC, Wes wrote:
>> In general, no. But you can get a list of all members in a module or class scope. Just use __traits(allMembers, ...);
> The allMembers example was lacking fields. It only showed methods, so I wasn't really sure. The problem with it was that it returned strings. I suppose I can still use them in a mixin.

If you don't want to use mixins, you can also use __traits(getMember, instance, name). mixin("instance." ~ name) is shorter, though.

David