Re: What will be the next MAJOR programming language for commercial use?
- From: Marcin 'Qrczak' Kowalczyk <qrczak@xxxxxxxxxx>
- Date: Mon, 01 Aug 2005 15:41:32 +0200
"Walter" <walter@xxxxxxxxxxxxxxxxxxxxxxx> writes:
>> If so, what happens when an invalid pointer is dereferenced?
>
> You get a hardware generated exception.
This probably means that D is unsafe. If you are not lucky, the
pointer will access a random other object.
> I would argue that "safety" is a continuum between more safe and
> less safe, and there is no obvious dividing line between the two.
There is: either it's guaranteed that no program has undefined
behavior (when it can execute random bits of memory as code or
shoot at arbitrary data memory) or not.
There are languages which are technically unsafe but they contain a
useful safe subset which encompasses almost the whole language and
it's easy to find all uses of unsafe features.
It happens that most languages with GC are safe or almost safe. Most
languages without GC are either unsafe or have limited data structures
(all values are independent, there is no conceptual sharing of
subobjects).
There is a related notion which is not that strict: features which
under some circumstances return a result which is almost always
undesirable instead of signalling an error, for the sake of efficiency,
are similar to unsafe features but don't cause undefined behavior.
Examples:
- ignoring overflow on integer arithmetic
- messing up with a data structure on concurrent access (but without
crashing nor shooting at random other data)
The next thing also sometimes called "unsafety" is when the language
has a habit of accepting almost arbitrary input instead of signalling
that it's probably wrong when it looks wrong. Perl is the primary
example of that. It will accept "foo" as a number (treated as 0)
and an array reference as a strong (treated as something like
"ARRAY(0x804cc28)"). Usually it doesn't check for too many or too few
arguments (unless the function is statically known and declared with
a prototype). The behavior is documented but mistakes aren't treated
as errors.
But the first notion is the primary meaning of "unsafe language".
> I will also argue that D has many characteristics that make the need
> for pointers much less than in, say, C, so one rarely has to deal
> with pointers.
Can you make a tree (e.g. abstract syntax tree for the sake of
example) without pointers?
> That's exactly what a dynamic closure is. A static closure would
> "capture" the local variables so they survive the function exit.
I haven't encountered your terminology and I'm not sure whether I
understand it. Do you mean that D supports only downward closures
(which are valid only as long as the containing function is running)
and not upward closures (with indefinite lifetime, independent from
the execution of functions)?
--
__("< Marcin Kowalczyk
\__/ qrczak@xxxxxxxxxx
^^ http://qrnik.knm.org.pl/~qrczak/
.
- Follow-Ups:
- References:
- What will be the next MAJOR programming language for commercial use?
- From: lvirden
- Re: What will be the next MAJOR programming language for commercial use?
- From: Walter
- Re: What will be the next MAJOR programming language for commercial use?
- From: Jon Harrop
- Re: What will be the next MAJOR programming language for commercial use?
- From: Walter
- Re: What will be the next MAJOR programming language for commercial use?
- From: Jon Harrop
- Re: What will be the next MAJOR programming language for commercial use?
- From: Walter
- Re: What will be the next MAJOR programming language for commercial use?
- From: Jon Harrop
- Re: What will be the next MAJOR programming language for commercial use?
- From: Walter
- What will be the next MAJOR programming language for commercial use?
- Prev by Date: Re: What will be the next MAJOR programming language for commercial use?
- Next by Date: Re: What will be the next MAJOR programming language for commercial use?
- Previous by thread: Re: What will be the next MAJOR programming language for commercial use?
- Next by thread: Re: What will be the next MAJOR programming language for commercial use?
- Index(es):
Relevant Pages
|
Loading