Andrei Alexandrescu seewebsiteforem...@erdani.org wrote in message
news:i353ak$1n...@digitalmars.com...
I've been kindly invited by the ACCU Silicon Valley Chapter to give a talk
on D at their next meeting. The talk starts at 7:00pm on Wednesday, August
11 and takes place in Mountain View.
== Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s article
I've been kindly invited by the ACCU Silicon Valley Chapter to give a
talk on D at their next meeting. The talk starts at 7:00pm on Wednesday,
August 11 and takes place in Mountain View. Attendance is free and
opened
Hello Ali,
== Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s
article
I've been kindly invited by the ACCU Silicon Valley Chapter to give a
talk on D at their next meeting. The talk starts at 7:00pm on
Wednesday,
August 11 and takes place in Mountain View. Attendance is free
Hello BCS,
I'd be up for a get together after work on the 13th (provided I can
get to it).
Scratch that, I've got a conflict.
--
... IXOYE
Hello Mike,
Andrei Alexandrescu seewebsiteforem...@erdani.org wrote in message
news:i353ak$1n...@digitalmars.com...
I'll give away a
few free copies of TDPL as prizes to the persons who ask the most
embarrassing questions.
Is that to the embarrassment of the questioner or the questionee ;-)
Mike James wrote:
Andrei Alexandrescu seewebsiteforem...@erdani.org wrote in message
news:i353ak$1n...@digitalmars.com...
I've been kindly invited by the ACCU Silicon Valley Chapter to give a
talk on D at their next meeting. The talk starts at 7:00pm on
Wednesday, August 11 and takes place in
On Mon, Aug 2, 2010 at 00:37, Andrej Mitrovic andrej.mitrov...@gmail.comwrote:
That's because the first part of the constraint is tested, to allow for
short-circuiting the second part. So the bad array comparison triggers the
problem in object._EqArray.
You should always test for the most
Walter Bright wrote:
bearophile wrote:
Removing that HTML ddoc parsing HTML generation from DMD allows such code
to evolve faster and to be debugged more efficiently. Today some people are
using
There are very good reasons why ddoc is part of dmd.
1. Being a defined part of D means
On Sun, Aug 1, 2010 at 8:06 PM, Michel Fortin michel.for...@michelf.com wrote:
On 2010-08-01 20:07:10 -0400, Andrei Alexandrescu
seewebsiteforem...@erdani.org said:
Ideally we'd have a one-click OSX installer for dmd - a .dmg file. Is
someone able and willing to own this project? I think
Lutger wrote:
I agree, though the standard output is not so pleasant. When the new website
design is adopted, would you please consider shipping a .ddoc plus the css
needed in a similar style for user documentation? No doubt people are willing to
help with this, I certainly would.
Sure.
dsimcha dsim...@yahoo.com wrote in message
news:i2umov$2es...@digitalmars.com...
== Quote from Fawzi Mohamed (fa...@gmx.ch)'s article
On 29-lug-10, at 15:31, dsimcha wrote:
== Quote from Fawzi Mohamed (fa...@gmx.ch)'s article
otherwise, as I already said http://www.netlib.org/fftpack/fft.c is
On 2010-08-02 02:07, Andrei Alexandrescu wrote:
Hello,
I got an email from someone who got an interest in D following my talk
at Google. He tried to install dmd on OSX, but got turned off (and
rightly so) for the unnecessary difficulties of that process and the
lack of documentation. Nicely of
On Sun, 01 Aug 2010 17:34:46 -0400, Andrei Alexandrescu
seewebsiteforem...@erdani.org wrote:
I agree that all of the functions you suggested deserve a place in
std.algorithm (or std.range). Please add one bugzilla entry or better
yet let me know if you'd like to join Phobos's devs (subject
In the current compiler, the non-constant destructor cannot be called on
a constant struct object:
struct S
{
~this() {}
}
void foo() {
const S s;
}
Error: destructor test.S.~this () is not callable using argument types ()
This can be worked around by applying 'const' to the
On 2010-08-02 02:22, Ryan W Sims wrote:
On 8/1/10 5:07 PM, Andrei Alexandrescu wrote:
Hello,
I got an email from someone who got an interest in D following my talk
at Google. He tried to install dmd on OSX, but got turned off (and
rightly so) for the unnecessary difficulties of that process
On 2010-08-02 00:02:35 -0400, Andrei Alexandrescu
seewebsiteforem...@erdani.org said:
That sounds encouraging. Would you be willing to modify and contribute
your installer for dmd?
Notice the installer is already open source, part of the D for Xcode
project. You might want a change of
Steven Schveighoffer Wrote:
The bigger issue is the documentation. D has been very stagnant in
improving the doc generator. We are missing a global function/symbol
index, cross-linked docs, and many other goodies that have been in systems
like doxygen since its inception.
Tango had
Kagamin:
In the situation like the one of the Ariane I think the good solution is
the introduce a fuzzy control system that has a degradation of its
effectiveness as conditions come out of its specs, but avoids a total
failure. This is what biological designs too do. It's a kind of
Andrei Alexandrescu wrote:
On 07/30/2010 08:02 AM, Justin Johansson wrote:
To what degree do the author and advocates of the D(2) Programming
Language believe that it is axiomatically pure and to what degree
to the naysayers believe that it is conversely impure. Further,
does axiomatic purity
On 08/02/2010 06:11 AM, Steven Schveighoffer wrote:
On Sun, 01 Aug 2010 17:34:46 -0400, Andrei Alexandrescu
seewebsiteforem...@erdani.org wrote:
I agree that all of the functions you suggested deserve a place in
std.algorithm (or std.range). Please add one bugzilla entry or better
yet let me
On 08/02/2010 06:01 AM, Jacob Carlborg wrote:
On 2010-08-02 02:07, Andrei Alexandrescu wrote:
Hello,
I got an email from someone who got an interest in D following my talk
at Google. He tried to install dmd on OSX, but got turned off (and
rightly so) for the unnecessary difficulties of that
On 08/02/2010 06:55 AM, Michel Fortin wrote:
On 2010-08-02 00:02:35 -0400, Andrei Alexandrescu
seewebsiteforem...@erdani.org said:
That sounds encouraging. Would you be willing to modify and contribute
your installer for dmd?
Notice the installer is already open source, part of the D for
On 08/02/2010 08:00 AM, Justin Johansson wrote:
Andrei Alexandrescu wrote:
On 07/30/2010 08:02 AM, Justin Johansson wrote:
To what degree do the author and advocates of the D(2) Programming
Language believe that it is axiomatically pure and to what degree
to the naysayers believe that it is
On Mon, 02 Aug 2010 09:11:32 -0400, Andrei Alexandrescu
seewebsiteforem...@erdani.org wrote:
On 08/02/2010 06:11 AM, Steven Schveighoffer wrote:
On Sun, 01 Aug 2010 17:34:46 -0400, Andrei Alexandrescu
seewebsiteforem...@erdani.org wrote:
I agree that all of the functions you suggested
On Mon, 02 Aug 2010 08:32:47 -0400, Pointing hand lurk...@lurking.org
wrote:
Steven Schveighoffer Wrote:
The bigger issue is the documentation. D has been very stagnant in
improving the doc generator. We are missing a global function/symbol
index, cross-linked docs, and many other goodies
== Quote from Walter Bright (newshou...@digitalmars.com)'s article
dsimcha wrote:
I absolutely despise using qualified names because they are both syntactic
noise
and extra typing. D lets me just import tons of stuff and skip the
qualified
names in most cases. Most of the time it
On 2010-08-02 09:18:37 -0400, Andrei Alexandrescu
seewebsiteforem...@erdani.org said:
On 08/02/2010 06:01 AM, Jacob Carlborg wrote:
Have you guys completely forgot
http://dsource.org/projects/dmd-installer/browser/trunk/osx ? It's been
there for over a year.
Hi Jacob,
Apologies for the
On 2010-08-02 09:22:41 -0400, Andrei Alexandrescu
seewebsiteforem...@erdani.org said:
The only modifications I have in mind concern separation of dmd
installation from anything XCode specific.
Well, they're already separated: the package contains two subpackage
related to Xcode, and two
I know that three ways to do something looks a bit too much, but I'd like a
third way to build a std.typecons tuple: I like to give field names, but to
omit their types:
import std.typecons: Tuple;
import std.string: split;
import std.metastrings: Format, toStringNow;
// from dlibs1
template
ref auto Tuple_(string names, T...)(T args)
if (split(names).length == T.length) {
Sorry, I meant:
ref auto Tuple_(string names, T...)(T args)
if (T.length split(names).length == T.length) {
== Quote from Jonathan M Davis (jmdavisp...@gmail.com)'s article
Okay. From what I can tell, it seems to be a recurring pattern with threads
that
it's useful to spawn a thread, have it do some work, and then have it return
the
result and terminate. The appropriate way to do that seems to
On 02/08/2010 05:14, Justin Spahr-Summers wrote:
On Sat, 31 Jul 2010 17:06:26 +0100, div0d...@sourceforge.net wrote:
On 31/07/2010 03:50, Justin Spahr-Summers wrote:
Yes, thank you. I misworded my original question. I was hoping to host
on Google Code, because it's been the most reliable
On Mon, Aug 2, 2010 at 01:12, Jonathan M Davis jmdavisp...@gmail.comwrote:
On Sunday 01 August 2010 07:32:50 Philippe Sigaud wrote:
But, what about putting all() and some() in std.algorithm?
An enhancement request already exists for these:
http://d.puremagic.com/issues/show_bug.cgi?id=4405
On Sun, Aug 1, 2010 at 23:34, Andrei Alexandrescu
seewebsiteforem...@erdani.org wrote:
I agree that all of the functions you suggested deserve a place in
std.algorithm (or std.range). Please add one bugzilla entry or better yet
let me know if you'd like to join Phobos's devs (subject to team
dsimcha wrote:
It just seems like common sense to me that a module system (and a language in
general) should do what you mean as long as there's no ambiguity about what you
mean (without forcing you to specify things redundantly, such as by using
qualified names), but not guess what you mean
After a discussion in D.learn I have added a first draft request for non-null
class references/pointers in Bugzilla (I think it's not a dupe):
http://d.puremagic.com/issues/show_bug.cgi?id=4571
It's not meant to be implemented soon: in D2 there is already enough work to do
to implement/debug
Walter Bright, el 2 de agosto a las 16:12 me escribiste:
dsimcha wrote:
It just seems like common sense to me that a module system (and a language in
general) should do what you mean as long as there's no ambiguity about what
you
mean (without forcing you to specify things redundantly, such
Leandro Lucarella wrote:
For me the problem with D is dependency control. You don't know what
symbol come from which module. Yes, I know you can do explicit
dependencies in D with static and selective imports, the same you can do
the inverse in other languages with the import module.*-like
On page 148 it says there's a way to use a local alias in a module like so:
// inside calvin.d
alias hobbes.transmogrify transmogrify;
There is a required import hobbes before the alias declaration. That should
probably be added to the errata.
But the example will not compile:
client.d(8):
The following example should compile according to TDPL. The compiler is
supossed to automatically infer the type of the parameter in the function
literal:
void main() { }
T[] find(alias pred, T)(T[] input)
if (is(typeof(pred(input[0])) == bool))
{
for (; input.length 0; input =
== Quote from Leandro Lucarella (l...@llucax.com.ar)'s article
With this default, I think complaining when no symbol from an imported
module is used would be better to avoid extra unneeded dependencies. But
I suggested that before and you don't like it.
Too bad.
But then you wouldn't be able
One other thing which is semi-relevant, from TDPL:
auto f = (int i) {};
assert(is(f == function));
f seems to be a delegate by default, not a function.
Andrej Mitrovic Wrote:
The following example should compile according to TDPL. The compiler is
supossed to automatically infer the type of
== Quote from Walter Bright (newshou...@digitalmars.com)'s article
Leandro Lucarella wrote:
For me the problem with D is dependency control. You don't know what
symbol come from which module. Yes, I know you can do explicit
dependencies in D with static and selective imports, the same you
Leandro Lucarella l...@llucax.com.ar wrote in message
news:20100803004718.gw3...@llucax.com.ar...
Walter Bright, el 2 de agosto a las 16:12 me escribiste:
dsimcha wrote:
It just seems like common sense to me that a module system (and a
language in
general) should do what you mean as long
dsimcha wrote:
Third, often only part of a program needs to be well-engineered (the core
algorithms that will likely be around awhile) and the rest is just some quick
and
dirty glue to feed data to the core algorithms, and will likely change in
relatively short order. The well-factored core
bearophile Wrote:
After a discussion in D.learn I have added a first draft request for non-null
class references/pointers in Bugzilla (I think it's not a dupe):
http://d.puremagic.com/issues/show_bug.cgi?id=4571
Should it guarantee non-nullability or the point is just to insert asserts on
dsimcha, el 3 de agosto a las 02:16 me escribiste:
== Quote from Leandro Lucarella (l...@llucax.com.ar)'s article
With this default, I think complaining when no symbol from an imported
module is used would be better to avoid extra unneeded dependencies. But
I suggested that before and you
Hi all,
I've been using D under Ubuntu for some time and the kinds of backtraces
I get when assertion fails look like this:
core.exception.asserter...@doodle.dia.standard_tools(71): Assertion failure
./bin/doodler() [0x8102086]
./bin/doodler() [0x804e38f]
./bin/doodler()
bearophile Wrote:
If well designed such systems have a graceful degradation of functionality
even when you step out of their specs. Systems like this are used today in
critical systems like breakers control systems of subway trains where a sharp
shutdown like the one on the Ariane can
On Mon, Aug 2, 2010 at 00:28, Ziad hata...@gmail.com wrote:
If I want a static array:
int[5] a = [1, 2, 3, 4, 5];
I'd have to specify the size in advance (5 in this case), which
means that adding extra elements later on would require that the
size be update.
Is there a way to let the
I'm just trying to figure out what the error would be, exactly. That a
programmer, knowing the language specification, obeyed it and wrote an
expression using the shortest syntax?
Rhetoric aside, the result is not unambiguous, it just requires that the
reader understand precedence. That's an
Philippe Sigaud wrote:
Hi,
as per Nick's advice, I was reading on Goldie's GenDocs template documentation
system:
http://www.semitwist.com/goldiedocs/v0.3/Docs/Tools/GenDocs/TemplateFormat/
That's a nice work, and I saw there something I'd like to do with Ddocs:
sections. As in,
On 02.08.2010 5:23, bearophile wrote:
Can you tell me why std.file.read() returns a void[] instead of something like
a ubyte[]?
Well, it magically converts to whatever array type you have. So this
works:
ubyte[] data = read(trash.txt);
It's interesting fact deserving further
On Monday 02 August 2010 00:05:40 Jeffrey Yasskin wrote:
Even better, you can annotate fail_sometimes with @safe, and it'll
still access out-of-bounds memory.
Take the following with a grain of salt since I'm really new to the
language.
gdb says:
Reason: KERN_PROTECTION_FAILURE at
On Sunday 01 August 2010 21:59:42 Ryan W Sims wrote:
The following code fails with a Bus error (OSX speak for Segfault,
if I understand correctly).
// types.d
import std.stdio;
class A {
int x = 42;
}
void fail_sometimes(int n) {
A a;
if (n == 0) {
a = new
Jonathan M Davis:
_All_ variables in D are initialized with a default value. There should be
_no_
undefined behavior with regards to initializations. D is very concientious
about
avoiding undefined behavior.
See also:
http://d.puremagic.com/issues/show_bug.cgi?id=3820
Bye,
bearophile
Dmitry Olshansky:
Well, it magically converts to whatever array type you have. So this works:
ubyte[] data = read(trash.txt);
In more than tree years of nearly daily usage of D I have not even tried to
write that code :-)
Thank you,
bearophile
Jason Spencer:
the result is not unambiguous, it just requires that the
reader understand precedence. That's an arguably good thing in any
case.
You can say exactly the same thing regarding bug 4077. But we have chosen
otherwise. Programming is done by people that do mistakes, so in some
On Sat, 31 Jul 2010 05:37:41 -0400, Jason Spencer spenc...@sbcglobal.net
wrote:
== Quote from Steven Schveighoffer (schvei...@yahoo.com)'s article
I was wrong, I looked through the runtime and did not find such a
function.
std.string has a repeat() function. Try:
import std.string;
void
On Sat, 31 Jul 2010 23:10:05 -0400, Andrej Mitrovic
andrej.mitrov...@gmail.com wrote:
Oh and I'm getting the same issue in Python when using CR only. I don't
know why I have the CR option in the text editor if it doesn't work
properly. I guess CR is used on the Macs maybe..?
Andrej
On Sat, 31 Jul 2010 21:15:21 -0400, bearophile bearophileh...@lycos.com
wrote:
I think there is a bug here, but can you please try it a bit?
The name of this program is test.d, so it loads its souce code:
import std.file: readText;
import std.stdio: write;
void main() {
string s =
Philippe Sigaud:
Would a template-based solution be OK?
import std.stdio, std.traits;
CommonType!T[T.length] staticArray(T...)(T vals)
if ((T.length 0) is(CommonType!T))
{
return [vals];
}
That's one solution, but code like that is most useful when your arrays liters
are
On Sun, 01 Aug 2010 19:22:42 -0400, bearophile bearophileh...@lycos.com
wrote:
Time ago an automatic tool has said that in a line of C code similar to:
int r = x / y * z;
a division operator followed by a mult is confusing, and to add
parentheses to improve the code:
int r = (x / y) * z;
Steven Schveighoffer:
No warning, no error. It's natural to assume that operations are
performed from left to right. I don't find it confusing at all.
Thank you for your opinion Steven. I am now leaning toward your idea, because I
think raising an error in this case it too much, and the
On Mon, 02 Aug 2010 00:59:42 -0400, Ryan W Sims rws...@gmail.com wrote:
The following code fails with a Bus error (OSX speak for Segfault,
if I understand correctly).
// types.d
import std.stdio;
class A {
int x = 42;
}
void fail_sometimes(int n) {
A a;
if (n == 0) {
[1] http://www.digitalmars.com/ctg/coff2omf.html
[2] http://www.digitalmars.com/download/freecompiler.html
The tool sounds cool but it seems that I have to buy it, so that's no
option for me.
Yeah, it's a pity that such an important tool for D development on Windoze
isn't free.
You may
It makes sense now. Thanks. :)
Steven Schveighoffer Wrote:
On Sat, 31 Jul 2010 23:10:05 -0400, Andrej Mitrovic
andrej.mitrov...@gmail.com wrote:
Oh and I'm getting the same issue in Python when using CR only. I don't
know why I have the CR option in the text editor if it doesn't work
On 8/2/10 1:56 AM, Jonathan M Davis wrote:
On Sunday 01 August 2010 21:59:42 Ryan W Sims wrote:
The following code fails with a Bus error (OSX speak for Segfault,
if I understand correctly).
// types.d
import std.stdio;
class A {
int x = 42;
}
void fail_sometimes(int n) {
A a;
On Mon, Aug 2, 2010 at 1:49 AM, Jonathan M Davis jmdavisp...@gmail.com wrote:
On Monday 02 August 2010 00:05:40 Jeffrey Yasskin wrote:
Even better, you can annotate fail_sometimes with @safe, and it'll
still access out-of-bounds memory.
Take the following with a grain of salt since I'm really
Jeffrey Yasskin:
That's good to know. Unfortunately, reading through a null pointer
does cause undefined behavior: it's not a guaranteed segfault.
Consider an object with a large array at the beginning, which pushes
later members past the empty pages at the beginning of the address
space. I
Hello bearophile,
Philippe Sigaud:
Would a template-based solution be OK?
import std.stdio, std.traits;
CommonType!T[T.length] staticArray(T...)(T vals)
if ((T.length 0) is(CommonType!T))
{
return [vals];
}
That's one solution, but code like that is most useful when your
arrays liters
Thanks for your feedback Philippe and bearophile :)
Cheers,
-- Ziad
BCS:
Is that with or without inline? If that doesn't inline away to a memcopy
then it looks like an optimization opportunity to me.
That's with inline, but if you don't use inline the result is the same, because
that is the asm of a function, not of its caller (the main), so DMD keeps the
Am 02.08.2010 16:50, schrieb Ryan W Sims:
On 8/2/10 1:56 AM, Jonathan M Davis wrote:
On Sunday 01 August 2010 21:59:42 Ryan W Sims wrote:
The following code fails with a Bus error (OSX speak for Segfault,
if I understand correctly).
// types.d
import std.stdio;
class A {
int x = 42;
}
void
On 08/02/2010 10:23 AM, Dmitry Olshansky wrote:
On 02.08.2010 5:23, bearophile wrote:
Can you tell me why std.file.read() returns a void[] instead of
something like a ubyte[]?
Well, it magically converts to whatever array type you have. So this works:
ubyte[] data = read(trash.txt);
This
Pelle:
Well, it magically converts to whatever array type you have. So this works:
ubyte[] data = read(trash.txt);
This code does not work for me on dmd 2.047.
AH, nor for me.
Bye,
bearophile
On 02.08.2010 21:36, bearophile wrote:
Pelle:
Well, it magically converts to whatever array type you have. So this works:
ubyte[] data = read(trash.txt);
This code does not work for me on dmd 2.047.
AH, nor for me.
Bye,
bearophile
Hm... it doesn't ...
Ouch, I was very
On 8/2/10 10:33 AM, bearophile wrote:
Mafi:
If you want a NullPointerException as part of your program flow, you can
use enforce() (in std.contracts I think). I don't think catching a
NullPointerException in a big code block where you don't know which
dereferencing should fail is good style.
On 2010-08-02 14:34, Steven Schveighoffer wrote:
On Sat, 31 Jul 2010 05:55:40 -0400, Jacob Carlborg d...@me.com wrote:
How do I debug an OutOfMemoryError? I'm trying to run a simple
application that uses SDL and OpenGL with Derelict on Mac OS X 10.6.
It works fine using D1 and Tango but fails
On Mon, Aug 2, 2010 at 14:15, bearophile bearophileh...@lycos.com wrote:
That's one solution, but code like that is most useful when your arrays
liters are long (because if they are little you can just count the items and
avoid using staticArray)
Yes, but as Ziad said:
If I want a static
On Mon, Aug 2, 2010 at 09:18, Lutger lutger.blijdest...@gmail.com wrote:
It isn't supported out of the box. You could further process ddoc output, I
had
something working nicely by spitting out xml instead of html and then using
xquery to generate the docs, but am too much pressed for time
On Monday, August 02, 2010 08:34:50 Jeffrey Yasskin wrote:
That's good to know. Unfortunately, reading through a null pointer
does cause undefined behavior: it's not a guaranteed segfault.
Consider an object with a large array at the beginning, which pushes
later members past the empty pages
Ryan W Sims:
The problem isn't how to check it on a case-by-case basis, there are
plenty of ways to check that a given pointer is non-null. The problem is
debugging _unexpected_ null dereferences, for which a NPE or its
equivalent is very helpful, a segfault is _not_.
I don't know what NPE
On 08/02/2010 11:27 PM, bearophile wrote:
Ryan W Sims:
The problem isn't how to check it on a case-by-case basis, there are
plenty of ways to check that a given pointer is non-null. The problem is
debugging _unexpected_ null dereferences, for which a NPE or its
equivalent is very helpful, a
Jonathan M Davis:
As for indexing into an array, the array itself should be null or not. It has
no
size if it's null, so it makes no sense to talk about large arrays which are
null.
Technically dynamic arrays in D are represented with a 2-word struct that
contains a pointer and length. So
Pelle:
Null Pointer Exception!
Ah, I see. I hate TLA (Three Letter Acronyms).
What I really wish for is non-nullable types, though. Maybe in D3... :P
I think there is no enhancement request in Bugzilla about this, I will add one.
To implement this you have to think about the partially
But now it's probably nearly impossible to make D references nonnullable on
default, so that syntax can't be used. And I don't what syntax to use yet.
Suggestions welcome.
One of the few ideas I have had is to use the @ suffix for this:
class T {}
T nullable_reference;
T@
On 08/03/2010 12:02 AM, bearophile wrote:
Pelle:
What I really wish for is non-nullable types, though. Maybe in D3... :P
I think there is no enhancement request in Bugzilla about this, I will add one.
I think there has been, at least this has been discussed on the newsgroup.
To implement
Pelle:
I think a good thing would be NonNull!T, but I haven't managed to create
one. If this structure exists and becomes good practice to use, maybe we
can get the good syntax in D3. In 20 years or so :P
Maybe we are talking about two different things, I was talking about nonnull
class
On 08/03/2010 12:32 AM, bearophile wrote:
Pelle:
I think a good thing would be NonNull!T, but I haven't managed to create
one. If this structure exists and becomes good practice to use, maybe we
can get the good syntax in D3. In 20 years or so :P
Maybe we are talking about two different
Pelle:
struct NotNull(T) if(is(typeof(T.init !is null))) {
Is this enough?
struct NotNull(T) if (is(T.init is null)) {
this(T t) {
enforce(t !is null, Cannot create NotNull from null);
enforce() is bad, use Design by Contract instead (a precondition with an assert
inside).
Is this enough?
struct NotNull(T) if (is(T.init is null)) {
Sorry, I meant:
struct NotNull(T) if (T.init is null) {
Bye,
bearophile
On 08/03/2010 01:08 AM, bearophile wrote:
Pelle:
struct NotNull(T) if(is(typeof(T.init !is null))) {
Is this enough?
struct NotNull(T) if (is(T.init is null)) {
this(T t) {
enforce(t !is null, Cannot create NotNull from null);
enforce() is bad, use Design by Contract
In the meantime I have written the first part of the Bugzilla entry about
non-null:
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.Darticle_id=114391
Bye,
bearophile
Pelle:
If NotNull will be in a library, it should probably use enforce, if I
have understood things correctly. External input, and all that. I think
most of phobos does it like this currently.
I suspect that Andrei has still to get DbC :-) (And your lib is not Phobos.)
Bye,
bearophile
http://d.puremagic.com/issues/show_bug.cgi?id=4568
Summary: Segfault in program that writes an array
Product: D
Version: D2
Platform: Other
OS/Version: Mac OS X
Status: NEW
Severity: normal
Priority: P2
http://d.puremagic.com/issues/show_bug.cgi?id=3918
--- Comment #3 from Don clugd...@yahoo.com.au 2010-08-02 00:12:09 PDT ---
I investigated this bug because I thought it might be related to the more
difficult bug 4443. Unfortunately, they are unrelated.
This one happens because the variable 'u'
http://d.puremagic.com/issues/show_bug.cgi?id=4570
Summary: ElementType!(void[]) shows error message.
Product: D
Version: D2
Platform: Other
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
98 matches
Mail list logo