Re: Spec#, nullables and more

2010-11-07 Thread Walter Bright
bearophile wrote: Walter Bright: Adding ranged integer types increases the coverage from 1% to 2% of the cases. (Pulling random numbers out of the ether, but still, I think the point is valid.) I don't know if that point is valid. SPARK language is able to have a testable low bug count, and

Re: Should pure functions be prevented from reading changeable immutable static variables?

2010-11-07 Thread Don
Jonathan M Davis wrote: On Saturday 06 November 2010 07:42:52 Don wrote: Michel Fortin wrote: On 2010-11-05 21:32:47 -0400, Don nos...@nospam.com said: The motivation for wanting to ban them is to prevent the optimiser from generating bad code. It seems to me that disabling pure

Re: null [re: spec#]

2010-11-07 Thread Nick Sabalausky
Walter Bright newshou...@digitalmars.com wrote in message news:ib5bue$2ld...@digitalmars.com... Jonathan M Davis wrote: Going C# or Java's route forces the programmer to initialize variables even in cases where they know that it's not necessary (which is annoying but may or may not be worth

Re: Spec#, nullables and more

2010-11-07 Thread Jérôme M. Berger
Walter Bright wrote: Very, very few (if any) dmd issues on bugzilla would have been caught by ranged integers or non-null pointers (despite there being several seg fault bugs). The vast majority of the problems were the result of an incomplete understanding of how things should be done,

Re: Spec#, nullables and more

2010-11-07 Thread Denis Koroskin
On Sun, 07 Nov 2010 00:58:57 +0300, Walter Bright newshou...@digitalmars.com wrote: FeepingCreature wrote: Walter Bright Wrote: FeepingCreature wrote: Walter Bright Wrote: All that does is reinvent the null pointer seg fault. The hardware does this for you for free. Walter, I know

Re: Helper unit testing functions in Phobos (possible std.unittests)

2010-11-07 Thread Jérôme M. Berger
Jonathan M Davis wrote: Every other unit test library that I've used stops running a test when that test fails. I've only used one (CUnit), but it defines two kinds of assertions. The standard kind (CU_ASSERT, CU_ASSERT_EQUAL, etc) simply prints a message and records a count of

Re: why a part of D community do not want go to D2 ?

2010-11-07 Thread Denis Koroskin
On Sun, 07 Nov 2010 02:11:59 +0300, bioinfornatics bioinfornat...@fedoraproject.org wrote: hello, I have a question (i would like understand), they are many important people of D community who do not want go to D2, why ? thanks for answer Many of the D2-only features are half-baked: -

Re: Spec#, nullables and more

2010-11-07 Thread Denis Koroskin
On Sat, 06 Nov 2010 23:37:09 +0300, Gary Whatmore n...@spam.sp wrote: Walter Bright Wrote: Adam Burton wrote: I wouldn't consider that as the same thing. null represents the lack of a value where as 25 is the wrong value. Based on that argument the application should fail immediately

Re: Spec#, nullables and more

2010-11-07 Thread Walter Bright
bearophile wrote: Concurrency bugs are far harder to fix (or even to find) than null pointer exceptions. This thread is not about ways to avoid concurrency bugs The hardest problems are concurrency issues, followed by memory corruption.

Re: Helper unit testing functions in Phobos (possible std.unittests)

2010-11-07 Thread spir
On Sat, 06 Nov 2010 19:45:32 + Adam Burton adz...@gmail.com wrote: bearophile wrote: spir: Jonathan M Davis: I believe strongly that a unit test block which has a failure should end excecution. For many such tests, continuing would be utterly pointless, since each

Re: Helper unit testing functions in Phobos (possible std.unittests)

2010-11-07 Thread spir
On Sat, 6 Nov 2010 16:07:15 -0700 Jonathan M Davis jmdavisp...@gmx.com wrote: There was a rather long discussion on this on the Phobos list a few months back ( you should probably start reading it here if you really want to read it: http://is.gd/gN1fq ) after Walter had made it so that all

Re: Should pure functions be prevented from reading changeable immutable static variables?

2010-11-07 Thread Michel Fortin
On 2010-11-07 01:41:47 -0500, Don nos...@nospam.com said: The guarantee of independence is the most important feature. From a performance point of view, the big win 'pure' gives you comes from memory management. All memory allocation can be done using a thread-local memory pool. Hum, are

Re: Should pure functions be prevented from reading changeable immutable static variables?

2010-11-07 Thread spir
On Sat, 6 Nov 2010 17:41:22 -0700 Jonathan M Davis jmdavisp...@gmx.com wrote: That's probably doable, if we largely abandon the idea that the return value of a pure function can be cacheable. Which I think is a bit of a fanciful idea anyway. If they're not cacheable, what's the point

Re: why a part of D community do not want go to D2 ?

2010-11-07 Thread Moritz Warning
On Sat, 06 Nov 2010 23:11:59 +, bioinfornatics wrote: hello, I have a question (i would like understand), they are many important people of D community who do not want go to D2, why ? thanks for answer - D2 trades complexity for more features - D2 has a lot of compiler bugs

Re: null [re: spec#]

2010-11-07 Thread foobar
Jonathan M Davis Wrote: On Saturday 06 November 2010 19:05:32 Nick Sabalausky wrote: foobar f...@bar.com wrote in messagend in a pointlessly roundabout way. 2. null is an a type-system attribute, hence should be checked at compile time and would have ZERO affect on run-time

Re: null [re: spec#]

2010-11-07 Thread spir
On Sun, 07 Nov 2010 07:20:10 -0500 foobar f...@bar.com wrote: Simple, ain't it? And it supports Walter's convoluted examples AND is explicit about it so it prevents illegal operations at compile time. ... AND it makes to safe case default ;-) Denis -- -- -- -- -- -- -- vit esse estrany ☣

missing new -- Error: no property 'opCall'...

2010-11-07 Thread spir
Hello, class C {int i;} void main () { auto c = C(i); } __trials__.d(31): Error: no property 'opCall' for type '__trials__.C' Is there a way for the compiler to detect the missing new and write a more appropriate message? (Or maybe add a hint in parens? (Did you try to initialise a class

Re: why a part of D community do not want go to D2 ?

2010-11-07 Thread Jacob Carlborg
On 2010-11-07 10:50, Denis Koroskin wrote: On Sun, 07 Nov 2010 02:11:59 +0300, bioinfornatics bioinfornat...@fedoraproject.org wrote: hello, I have a question (i would like understand), they are many important people of D community who do not want go to D2, why ? thanks for answer Many of

Re: null [re: spec#]

2010-11-07 Thread Jonathan M Davis
On Sunday 07 November 2010 04:20:10 foobar wrote: Both the current D way and the C# way are ugly hacks. Ideally you should have TWO types: T and Option!T (ignore syntax for now). Most of the time you would use: auto variable = new T(params); // no need for nulls here! and for the

Re: D Best Practices: Default initializers for structs

2010-11-07 Thread d'oh
On 07/11/10 15:28, Jonathan M Davis wrote: Here's an interesting thought. All built-in types in D default initialize to the closest thing that they have to an error. Floating points arguably do the best job of this with NAN, and integral types arguably the worst with 0, but that is, as I

Re: D Best Practices: Default initializers for structs

2010-11-07 Thread Simen kjaeraas
d'oh ho...@simpsons.name wrote: Arguable floating points would do better with -Infinity Why? A signaling nan tells you 'you'trying to use an uninitialized value!'. and integral types with a negative value e.g. -1, -2 or as negative as possible. Why? I can see some reasons, like foo * -1

Re: Spec#, nullables and more

2010-11-07 Thread FeepingCreature
Walter Bright Wrote: FeepingCreature wrote: Walter Bright Wrote: FeepingCreature wrote: Walter Bright Wrote: All that does is reinvent the null pointer seg fault. The hardware does this for you for free. Walter, I know you're a Windows programmer but this cannot be the first

Re: null [re: spec#]

2010-11-07 Thread retard
Sun, 07 Nov 2010 01:54:24 -0500, Nick Sabalausky wrote: Nick Sabalausky a...@a.a wrote in message news:ib5ht0$2uf...@digitalmars.com... Walter Bright newshou...@digitalmars.com wrote in message news:ib5bue$2ld...@digitalmars.com... Jonathan M Davis wrote: Going C# or Java's route forces the

Re: why a part of D community do not want go to D2 ?

2010-11-07 Thread bioinfornatics
So D community will be split in 2. And D1 continue to evolve without D2 community, D1 frontend is open source and he coulb be used for improve and fix D1

Re: null [re: spec#]

2010-11-07 Thread steveh
foobar Wrote: Jonathan M Davis Wrote: On Saturday 06 November 2010 19:05:32 Nick Sabalausky wrote: foobar f...@bar.com wrote in messagend in a pointlessly roundabout way. 2. null is an a type-system attribute, hence should be checked at compile time and would have ZERO

Re: null [re: spec#]

2010-11-07 Thread Denis Koroskin
On Sun, 07 Nov 2010 18:01:32 +0300, steveh steve...@hotmai.l wrote: Sounds more retarded than the notorious 'retard' here. It's because of people like u that D3 might not come. If you disagree too much with AA and WB they have no interest to make D3. This nonnull question might be good

Re: null [re: spec#]

2010-11-07 Thread bearophile
Nick Sabalausky: You can label C#-style init-checking wishy-washy all you want, but that's still a hell of a lot better than wrong, which is what D does (as evidenced by my first example above). I think all you have written in this post is correct. In this regard D is better than C and C#

Re: null [re: spec#]

2010-11-07 Thread Andrei Alexandrescu
On 11/7/10 9:08 AM, Denis Koroskin wrote: On Sun, 07 Nov 2010 18:01:32 +0300, steveh steve...@hotmai.l wrote: Sounds more retarded than the notorious 'retard' here. It's because of people like u that D3 might not come. If you disagree too much with AA and WB they have no interest to make D3.

Re: Spec#, nullables and more

2010-11-07 Thread so
Hah people bringing up the argument bad syntax, when they got nothing to say! Like they type Matrix!(double, 5, 5) every time they use a matrix no you never do that, you just: alias Matrix!(double, 5, 5) mat5; // sweet isn't it? Remember! it is a type! On Sat, 06 Nov 2010 12:27:34 +0200,

Re: null [re: spec#]

2010-11-07 Thread Roman Ivanov
On 11/7/2010 1:02 AM, Walter Bright wrote: Jonathan M Davis wrote: Going C# or Java's route forces the programmer to initialize variables even in cases where they know that it's not necessary (which is annoying but may or may not be worth it), Correct. It's not that doing flow analysis is

Re: null [re: spec#]

2010-11-07 Thread Roman Ivanov
On 11/7/2010 10:51 AM, Roman Ivanov wrote: On 11/7/2010 1:02 AM, Walter Bright wrote: Jonathan M Davis wrote: Going C# or Java's route forces the programmer to initialize variables even in cases where they know that it's not necessary (which is annoying but may or may not be worth it),

in-parameter

2010-11-07 Thread spir
Hello, I'd like to know, aside user-side semantics, whether the compiler uses the in qualifier for efficiency (pass arrays structs by ref under the hood?). Well, seems obvious, but there may be some hidden constraint I'm unable to realise. Denis -- -- -- -- -- -- -- vit esse estrany ☣

Re: Should pure functions be prevented from reading changeable immutable static variables?

2010-11-07 Thread Don
Michel Fortin wrote: On 2010-11-07 01:41:47 -0500, Don nos...@nospam.com said: The guarantee of independence is the most important feature. From a performance point of view, the big win 'pure' gives you comes from memory management. All memory allocation can be done using a thread-local

Re: null [re: spec#]

2010-11-07 Thread so
On Sat, 06 Nov 2010 13:30:56 +0200, foobar f...@bar.com wrote: bearophile Wrote: foobar: Any type can be wrapped by an OPTION type. trying to do the converse of this is impractical and is bad design. Discussing this is a waste of time now, this part of the D language will probably

Re: null [re: spec#]

2010-11-07 Thread bearophile
so: Fine having a nun-null type or ranged integer or special float whatever in a language library, but asking a new syntax for it? Not really. There's no way you may implement all the relative semantics in the D language. You and Andrei are wrong. Bye, bearophile

Re: null [re: spec#]

2010-11-07 Thread so
On a related note, I *hate* that D silently sticks in a default value whenever anything isn't properly inited. This is one thing where I really think C# got it right, and D got it wrong. And waving the It's not leaving it with an undefined value like C does! banner is an irritating strawman:

Can non-nullable references be implemented as a library?

2010-11-07 Thread Denis Koroskin
Since many people think that non-nullable references can be implemented as a library and thus don't belong to core language, I've decided to show that it is in fact impossible to do so. How do you enforce the following behavior: class Foo { this() { // error: variable

Re: Can non-nullable references be implemented as a library?

2010-11-07 Thread Simen kjaeraas
Denis Koroskin 2kor...@gmail.com wrote: Since many people think that non-nullable references can be implemented as a library and thus don't belong to core language, I've decided to show that it is in fact impossible to do so. How do you enforce the following behavior: [snip] Without

Re: Can non-nullable references be implemented as a library?

2010-11-07 Thread steveh
Denis Koroskin Wrote: Since many people think that non-nullable references can be implemented as a library and thus don't belong to core language, I've decided to show that it is in fact impossible to do so. How do you enforce the following behavior: class Foo { this() {

Re: null [re: spec#]

2010-11-07 Thread Simen kjaeraas
Roman Ivanov isroman@ete.km.ru wrote: I know what your mean, but the example is flawed: public void foo() { if (m) { Object p = new Object(); p.toString(); } } You misunderstand. The idea is this: void foo( ) { Object p; if ( m ) { p = new Object( );

Re: Can non-nullable references be implemented as a library?

2010-11-07 Thread Simen kjaeraas
Simen kjaeraas simen.kja...@gmail.com wrote: Denis Koroskin 2kor...@gmail.com wrote: Since many people think that non-nullable references can be implemented as a library and thus don't belong to core language, I've decided to show that it is in fact impossible to do so. How do you

Re: why a part of D community do not want go to D2 ?

2010-11-07 Thread Fawzi Mohamed
On 7-nov-10, at 13:05, Moritz Warning wrote: On Sat, 06 Nov 2010 23:11:59 +, bioinfornatics wrote: hello, I have a question (i would like understand), they are many important people of D community who do not want go to D2, why ? thanks for answer - D2 trades complexity for more

Re: Can non-nullable references be implemented as a library?

2010-11-07 Thread Denis Koroskin
On Sun, 07 Nov 2010 20:21:49 +0300, steveh steve...@useshotmai.l wrote: Andrei's stance is, either a library addon or ship D without that feature. D's library already contains both tuples and algebraic data types. They're simple to use, almost like in Python. The reason for library addons

Re: Can non-nullable references be implemented as a library?

2010-11-07 Thread so
Andrei's stance is, either a library addon or ship D without that feature. D's library already contains both tuples and algebraic data types. They're simple to use, almost like in Python. The reason for library addons isn't that builtin features make less sense, the reason is that TDPL is

Re: Can non-nullable references be implemented as a library?

2010-11-07 Thread bearophile
so: Also It is not only Andrei, every single people here agreed on stopping lets add this new feature to D today. What's stopped is adding features to D2, but I have meant nonull types for D3. I don't think D evolution is finished right now. On the other hand new features add complexity,

Re: Spec#, nullables and more

2010-11-07 Thread Daniel Gibson
Kagamin schrieb: FeepingCreature Wrote: This means stack traces are out unless you have special handling for segfaults that decodes the stack and prints the error pos. That in turn means you need to have a debugger attached to get stacktraces, which can be annoying especially in

Re: null [re: spec#]

2010-11-07 Thread Nick Sabalausky
Simen kjaeraas simen.kja...@gmail.com wrote in message news:op.vls9bigxvxi...@biotronic-pc.lan... Roman Ivanov isroman@ete.km.ru wrote: I know what your mean, but the example is flawed: public void foo() { if (m) { Object p = new Object(); p.toString(); }

Re: null [re: spec#]

2010-11-07 Thread Nick Sabalausky
steveh steve...@hotmai.l wrote in message news:ib6f0c$2s4...@digitalmars.com... Sounds more retarded than the notorious 'retard' here. It's because of people like u that D3 might not come. If you disagree too much with AA and WB they have no interest to make D3. This nonnull question might

Re: null [re: spec#]

2010-11-07 Thread Nick Sabalausky
so s...@so.do wrote in message news:op.vls71ytk7dt...@so-pc... On a related note, I *hate* that D silently sticks in a default value whenever anything isn't properly inited. This is one thing where I really think C# got it right, and D got it wrong. And waving the It's not leaving it with an

Re: Immutable fields

2010-11-07 Thread Stewart Gordon
On 03/11/2010 03:06, Daniel Murphy wrote: bearophilebearophileh...@lycos.com wrote in message news:iaqbsb$1d3...@digitalmars.com... Is it correct for immutable struct fields to act like enum or static const fields? (I don't think so, but I am wrong often): immutable struct fields can be

Re: null [re: spec#]

2010-11-07 Thread Nick Sabalausky
foobar f...@bar.com wrote in message news:ib5l2a$1v...@digitalmars.com... Nick Sabalausky Wrote: foobar f...@bar.com wrote in message news:ib3a8k$1i5...@digitalmars.com... 1. the INVENTOR of the reference concept himself admits that this is a flawed design. see:

Re: null [re: spec#]

2010-11-07 Thread Simen kjaeraas
Nick Sabalausky a...@a.a wrote: If you do that, then there's two possibilities: A. You intended p to get inited on all code paths but forgot a codepath. With real init-checking the compiler will tell you and you can fix it. With D as it is, you're not informed at all, and you may or may not

Re: why a part of D community do not want go to D2 ?

2010-11-07 Thread Stewart Gordon
On 06/11/2010 23:11, bioinfornatics wrote: hello, I have a question (i would like understand), they are many important people of D community who do not want go to D2, why ? thanks for answer Sick of waiting for D1 to be finished. So many differences between D1 and D2 now that it's a

Re: null [re: spec#]

2010-11-07 Thread Nick Sabalausky
bearophile bearophileh...@lycos.com wrote in message news:ib6fuj$3j...@digitalmars.com... This paper contains the solution of about 1/4 of the problems, that may require a @notDelayed attribute (the other problems are collection initialization and simplified typestate management):

Re: null [re: spec#]

2010-11-07 Thread Nick Sabalausky
Simen kjaeraas simen.kja...@gmail.com wrote in message news:op.vltiombuvxi...@biotronic-pc.lan... Nick Sabalausky a...@a.a wrote: If you do that, then there's two possibilities: A. You intended p to get inited on all code paths but forgot a codepath. With real init-checking the compiler will

Re: null [re: spec#]

2010-11-07 Thread Simen kjaeraas
Nick Sabalausky a...@a.a wrote: - if ( m 12 ) { + if ( p m 12 ) { And you can toss in an if(m12) assert(p); if you're worried about that. Of course. But the point is, this is unnecessary. We know p !is null when m 4. -- Simen

Re: nullable done right, was #Spec

2010-11-07 Thread Jimmy Cao
On Sun, Nov 7, 2010 at 2:53 PM, BLS windev...@hotmail.de wrote: The following code does not fail at compile-time or run-time because the if statement proves that the call is safe: class Foo def bar(s as String?) if s # same as if s is not nil print Utils.countChars(s,

Re: Can non-nullable references be implemented as a library?

2010-11-07 Thread bearophile
retard: There are these DIPs in wiki4d. Were they useful? At least it seems that this thread is leading nowhere. Half of the people don't know what non- nullable means. It's hard to trust this process when it seems to go nowhere. No one wants to validate the design decisions. If a language

Re: null [re: spec#]

2010-11-07 Thread bearophile
Nick Sabalausky: Also, I'm curious what you mean by collection initialization and simplified typestate management. Collections, like an array, need a temporary transient state where they may contain nulls too. The simple typestate management means that if you want to implement nonnull

Re: null [re: spec#]

2010-11-07 Thread Walter Bright
Simen kjaeraas wrote: You misunderstand. The idea is this: void foo( ) { Object p; if ( m ) { p = new Object( ); p.DoSomethingThatNeedsToBeDoneNow( ); } // 20 lines of code here if ( m ) { p.doSomethingWeird( dataFromAbove ); } } You're right, the real cases where this

Re: null [re: spec#]

2010-11-07 Thread Wyrlon
I think it's reasonable to let the current references and pointers continue to be as they are, and work on @disable (particularly its interaction with constructors) to make it easy to implement restricted subsets of values. Then NonNull would be a useful library artifact among other ones.

Re: null [re: spec#]

2010-11-07 Thread bearophile
Andrei Alexandrescu: And what was exactly the claim that was wrong? That there is no need of compiler syntax support to implement good enough nonnullable reference types in D. What's a relative semantics? - The limited form of typestate change, as shown in the original Spec# paper I've

Re: null [re: spec#]

2010-11-07 Thread so
In the end seeing the amount of holes left in the design of the D module system and immutables, this nonnull design may be too much hard for D, most people here don't even see 1/2 of the problems needed to implement nonnullables well enough. So maybe we are just wasting time here. D

Re: Can non-nullable references be implemented as a library?

2010-11-07 Thread retard
Sun, 07 Nov 2010 17:06:12 -0500, bearophile wrote: retard: There are these DIPs in wiki4d. Were they useful? At least it seems that this thread is leading nowhere. Half of the people don't know what non- nullable means. It's hard to trust this process when it seems to go nowhere. No one

Re: null [re: spec#]

2010-11-07 Thread bearophile
so: You are saying as it is something trivial. :) Const/Immutable is one of the most important and complex part of a language. Sorry, I didn't mean to sound like that. It's indeed hard to design the immutable system of D. And my mind is not good enough yet to design it. Nonetheless there

Re: Can non-nullable references be implemented as a library?

2010-11-07 Thread bearophile
retard: I bet even the basic class/interface/exception system of D is too complex to explain for some members of the audience. You can't assume that the same people who *use* the language can/want to understand the implementation of the features. You are right. The people that use the

Re: The D Scripting Language

2010-11-07 Thread Jesse Phillips
Tomek Sowiñski Wrote: This wraps up a thread from a few days ago. Pascal featured my D examples on his Scriptometer site. http://rigaux.org/language-study/scripting-language/ D comes 17th out of 28, so it's so-so for scripting. -- Tomek When I looked over his scoring from the

Visual studio project files

2010-11-07 Thread div0
I've created vs project files to build DMD and a patch for 2.049 You can grab them from: http://www.sstk.co.uk/d.php if anybody is interested. -- My enormous talent is exceeded only by my outrageous laziness. http://www.ssTk.co.uk

Re: Can non-nullable references be implemented as a library?

2010-11-07 Thread Andrei Alexandrescu
On 11/7/10 1:54 PM, retard wrote: Sun, 07 Nov 2010 19:39:09 +0200, so wrote: Andrei's stance is, either a library addon or ship D without that feature. D's library already contains both tuples and algebraic data types. They're simple to use, almost like in Python. The reason for library addons

Re: Immutable fields

2010-11-07 Thread Andrei Alexandrescu
On 11/7/10 2:40 PM, Stewart Gordon wrote: On 03/11/2010 03:06, Daniel Murphy wrote: bearophilebearophileh...@lycos.com wrote in message news:iaqbsb$1d3...@digitalmars.com... Is it correct for immutable struct fields to act like enum or static const fields? (I don't think so, but I am wrong

Re: Can non-nullable references be implemented as a library?

2010-11-07 Thread bearophile
Andrei: This thread does have a good outcome: Walter will at least consider improving flow analysis in constructors to support @disable'd default constructors. That is the key improvement that allows NonNull as a library. Good :-) Bye, bearophile

Re: null [re: spec#]

2010-11-07 Thread Andrei Alexandrescu
On 11/7/10 4:21 PM, bearophile wrote: Andrei Alexandrescu: And what was exactly the claim that was wrong? That there is no need of compiler syntax support to implement good enough nonnullable reference types in D. The only change needed is constructor flow to make sure types with

Re: The D Scripting Language

2010-11-07 Thread Andrei Alexandrescu
On 11/7/10 5:34 PM, Jesse Phillips wrote: Tomek Sowiñski Wrote: This wraps up a thread from a few days ago. Pascal featured my D examples on his Scriptometer site. http://rigaux.org/language-study/scripting-language/ D comes 17th out of 28, so it's so-so for scripting. -- Tomek When I

Re: null [re: spec#]

2010-11-07 Thread retard
Sun, 07 Nov 2010 14:09:01 -0800, Walter Bright wrote: Simen kjaeraas wrote: You misunderstand. The idea is this: void foo( ) { Object p; if ( m ) { p = new Object( ); p.DoSomethingThatNeedsToBeDoneNow( ); } // 20 lines of code here if ( m ) { p.doSomethingWeird(

Re: null [re: spec#]

2010-11-07 Thread so
That's why we have immutable variables. They force you to think what to put in the variables. A lot of cases like the one above would be solved if if-then-else was an functional expression instead of a void returning statement. C/C++/D has the ternary ?: but the syntax is obfuscated. Object p =

Re: The D Scripting Language

2010-11-07 Thread Eric Poggel
On 11/7/2010 8:49 PM, Andrei Alexandrescu wrote: On 11/7/10 5:34 PM, Jesse Phillips wrote: Tomek Sowiñski Wrote: This wraps up a thread from a few days ago. Pascal featured my D examples on his Scriptometer site. http://rigaux.org/language-study/scripting-language/ D comes 17th out of 28,

Re: null [re: spec#]

2010-11-07 Thread Eric Poggel
On 11/6/2010 6:50 AM, bearophile wrote: foobar: Any type can be wrapped by an OPTION type. trying to do the converse of this is impractical and is bad design. Discussing this is a waste of time now, this part of the D language will probably never change. This is why other people and me are

Re: The D Scripting Language

2010-11-07 Thread BCS
Hello Tomek, This wraps up a thread from a few days ago. Pascal featured my D examples on his Scriptometer site. http://rigaux.org/language-study/scripting-language/ D comes 17th out of 28, so it's so-so for scripting. The link from D seems dead to me (missing ':' after http).

Re: null [re: spec#]

2010-11-07 Thread Nick Sabalausky
Simen kjaeraas simen.kja...@gmail.com wrote in message news:op.vltjpebhvxi...@biotronic-pc.lan... Nick Sabalausky a...@a.a wrote: - if ( m 12 ) { + if ( p m 12 ) { And you can toss in an if(m12) assert(p); if you're worried about that. Of course. But the point is, this is

Re: null [re: spec#]

2010-11-07 Thread Nick Sabalausky
Walter Bright newshou...@digitalmars.com wrote in message news:ib783u$1od...@digitalmars.com... The real problem with the spurious errors is that then people will put in an initialization just to shut the compiler up. Time passes, and the next guy is looking at the code and wonders why x is

Re: null [re: spec#]

2010-11-07 Thread Nick Sabalausky
so s...@so.do wrote in message news:op.vltk19pq7dt...@so-pc... On Sun, 07 Nov 2010 22:41:41 +0200, Nick Sabalausky a...@a.a wrote: so s...@so.do wrote in message news:op.vls71ytk7dt...@so-pc... On a related note, I *hate* that D silently sticks in a default value whenever anything isn't

Re: null [re: spec#]

2010-11-07 Thread Nick Sabalausky
Nick Sabalausky a...@a.a wrote in message news:ib84bo$1vc...@digitalmars.com... so s...@so.do wrote in message news:op.vltk19pq7dt...@so-pc... On Sun, 07 Nov 2010 22:41:41 +0200, Nick Sabalausky a...@a.a wrote: so s...@so.do wrote in message news:op.vls71ytk7dt...@so-pc... On a related note,

Re: null [re: spec#]

2010-11-07 Thread Walter Bright
Nick Sabalausky wrote: Well I'll be damned, even C/C++ knows that uninitialized variables shouldn't be used, and yet D doesn't. This is where Walter claims that getting rid of that warning improves safety because it prevents people from shutting the compiler up by changing this: int i = i +

Re: null [re: spec#]

2010-11-07 Thread so
I think I figured out what you meant. When I said C# got it right, you thought I was talking about how C# doesn't allow any int x = void; whatsoever, right? That's not what I meant. I was talking about how C# issues a compile-time error whenever a variable is read before it's guaranteed to have

Re: in-parameter

2010-11-07 Thread Daniel Murphy
spir denis.s...@gmail.com wrote in message news:mailman.157.1289146124.21107.digitalmar...@puremagic.com... I'd like to know, aside user-side semantics, whether the compiler uses the in qualifier for efficiency (pass arrays structs by ref under the hood?). Well, seems obvious, but there may be

Re: null [re: spec#]

2010-11-07 Thread so
On Mon, 08 Nov 2010 08:17:09 +0200, Jussi Jumppanen jus...@zeuseedit.com wrote: so Wrote: Not related to this but i have to share. Try compiling this in C/C++. int i = i + 5; // something like this. void main() { int i = i + 5; // something like this. } Microsoft (R) 32-bit C/C++

Re: Can non-nullable references be implemented as a library?

2010-11-07 Thread spir
On Sun, 07 Nov 2010 19:12:02 -0600 Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: On 11/7/10 1:54 PM, retard wrote: Sun, 07 Nov 2010 19:39:09 +0200, so wrote: Andrei's stance is, either a library addon or ship D without that feature. D's library already contains both tuples and

Re: Can non-nullable references be implemented as a library?

2010-11-07 Thread Kagamin
Adam Burton Wrote: The above seems correct to me. You are assigning a nullable to a non- nullable so you force the user to assess that is correct and provide an override. Based on that I've had a crack at this myself. This becomes not just an annotation, but another type. When you pass

Re: Can non-nullable references be implemented as a library?

2010-11-07 Thread spir
On Sun, 07 Nov 2010 18:12:50 -0500 bearophile bearophileh...@lycos.com wrote: retard: I bet even the basic class/interface/exception system of D is too complex to explain for some members of the audience. You can't assume that the same people who *use* the language can/want to

Re: just stop program

2010-11-07 Thread spir
On Sun, 07 Nov 2010 11:00:04 + div0 d...@sourceforge.net wrote: OIC, that makes sense. I guess people should be discourged from using the C bits anyway; there ought to be better D versions of everyting in the C standard lib. That make sense; or at least have the ones that need no

array of elements of various subclasses

2010-11-07 Thread spir
Hello, Say I have some subclasses of Pattern. When I try to write Pattern[] patterns = [x,y,z]; I get an error because, apparently, D types the array according to the class of z (Choice is here the type of z): DeeMatch.d(473): Error: cannot implicitly convert expression (x) of type

Re: array of elements of various subclasses

2010-11-07 Thread spir
On Sun, 7 Nov 2010 16:17:38 +0100 spir denis.s...@gmail.com wrote: And I'd like to know, as a possible workaround, if there is a way to save a variadic arg list: class C { ??? xs; this(X xs...) { this.xs = xs; } } Denis -- --

Re: array of elements of various subclasses

2010-11-07 Thread Jesse Phillips
spir Wrote: On Sun, 7 Nov 2010 16:17:38 +0100 spir denis.s...@gmail.com wrote: And I'd like to know, as a possible workaround, if there is a way to save a variadic arg list: class C { ??? xs; this(X xs...) { this.xs = xs; } }

Re: [import,module] got biting again :(

2010-11-07 Thread Don
%u wrote: Yay, free access to a! I searched for this bug in the bug-reports.. Why are there so many basic import bugs? There's only really one. But it's huge.

Re: array of elements of various subclasses

2010-11-07 Thread Stewart Gordon
On 07/11/2010 15:49, spir wrote: snip And I'd like to know, as a possible workaround, if there is a way to save a variadic arg list: class C { ??? xs; this(X xs...) { this.xs = xs; } } What exactly are you trying to do here?

[Issue 4709] ICE(mtype.c): undefined variable in const struct

2010-11-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4709 Don clugd...@yahoo.com.au changed: What|Removed |Added Keywords||patch --- Comment #3 from

[Issue 5184] New: throw ClassName.templatedStaticMethod(...) cannot be parsed

2010-11-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5184 Summary: throw ClassName.templatedStaticMethod(...) cannot be parsed Product: D Version: D1 D2 Platform: All OS/Version: Windows Status: NEW Severity:

[Issue 5185] New: unittest in template classes: recursive template expansion error

2010-11-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5185 Summary: unittest in template classes: recursive template expansion error Product: D Version: D1 Platform: x86 OS/Version: Windows Status: NEW Severity:

[Issue 4434] ICE(mtype.c, 887) alias with const, shared, or immutable

2010-11-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4434 Walter Bright bugzi...@digitalmars.com changed: What|Removed |Added Status|NEW |RESOLVED

[Issue 4366] ICE(mtype.c) constrained template pure function with array/pointer parameter

2010-11-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4366 Walter Bright bugzi...@digitalmars.com changed: What|Removed |Added Status|NEW |RESOLVED

  1   2   >