On 01/27/2011 02:11 AM, Jonathan M Davis wrote:
On Wednesday, January 26, 2011 16:41:10 spir wrote:
On 01/26/2011 11:33 PM, Trass3r wrote:
For me, D's killer features were string handling (slicing and
appending/concatenation) and *no header files*. (No more header files!!
Yay!!!). But auto is fantastic too though, I get sooo much use out of
that.

Getting rid of the pointer crap (proper arrays, bounds checking, classes
as reference types,...) is definitely among the top 10 on my list.

Same here. But I would prefere slicing not to check upper bound, rather
just extend to the end. Or have a slicing variant do that.

You mean that if you give an index which is too large, it just uses $ instead?
That sounds seriously bug-prone to me. I'd much rather that it blew up and thus
told me that my program had a bug in it rather than silently trying to work.

Sorry, but you are wrong on this. I understand this sounds unsafe, but no. Most languages, I guess, just do that without any worry. In particular, I have frequented python and Lua mailing lists for years without even reading once about this beeing a misfeature (and indeed have never run into a bug because of this myself). It is simply the right semantics in 99.999% cases.

spir@d:~$ python
Python 2.6.6 (r266:84292, Sep 15 2010, 15:52:39)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
s = 'abc'
s[0:123456789]
'abc'

spir@d:~$ lua
Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
require"io"
s = "abc"
print(string.sub(s, 1, 123456789))
abc

I'm constantly annoyed by D's behaviour. For instance, often have to write out the end of a string from a given point, but only at most n chars (to avoid cluttering the output, indeed):
        writeln(s[i..i+n]);
which fails if there are less than n remaining chars ;-)

Denis
--
_________________
vita es estrany
spir.wikidot.com

Reply via email to