const

Scott S. McCoy tag at cpan.org
Sun Mar 30 12:20:59 PDT 2008


On Sat, 2008-03-29 at 12:13 -0700, Walter Bright wrote:

> It's like (well, not as bad as) exchanging the 
> meaning of the * and + operators.

We do this already...well not with arithmetic thank god, but with other
operators.

Take the infamous concatenation operator...

PHP and Perl it's "."
Pascal, Ruby, Pike, Python, Java, JavaScript, (and kind of in C++) it's
"+"
SQL and REXX it's "||"
VB, Ada, AppleScript it's "&"

but in D it's "~"....

But in other languages, such as perl and AWK, ~ means something.  It
means "bind", as bind this regular expression:

# awk
if (foo ~ bar) {
}

# perl
if ($foo ~= $bar) {
}

Similarly, this expression in AWK means something completely different
in D:

foobar = foo ~ bar;

That being said, it doesn't really matter...it's a different language.

Just like how "puede" means "it can" in spanish, but it means "can I" in
tagalog.

Anyway to that end, I don't think redefining const or creating a
different work to mean const is any different than this.  And it's a
perfectly acceptable thing to do.  After all, we're really trying to
make "const" mean "from your view, this thing is constant" anyway,
that's what it implies.

Cheers,
    Scott S. McCoy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20080330/d59a2901/attachment.html>


More information about the Digitalmars-d mailing list