Re: D array expansion and non-deterministic re-allocation

2009-11-24 Thread Bartosz Milewski
Steven Schveighoffer Wrote: > Bottom line: if a function isn't supposed to change the buffer, the > signature should be const for that parameter. It's one of the principles > of const, and why it's in D2 in the first place. I'd explain to the coder > that he is wrong to expect that modify

Re: Making alloca more safe

2009-11-24 Thread Walter Bright
BCS wrote: Hello Walter, BCS wrote: Yes the ignition (as the the key) doesn't turn off but when the engine quits running the ignition system (as in the magneto or that block of epoxy and silicon under the hood) quits triggering the spark. Tie into that. Trying to determine if the distributo

Re: Non-enum manifest constants: Pie in the sky?

2009-11-24 Thread yigal chripun
bearophile Wrote: > Jason House: > > > IMHO, enum is a patchwork collection of features... manifest constants, > > enumerated lists, and bitmasks are all conflated into something rather > > ugly.< > > Manifest constants defined with enum look a little ugly, and I too don't like > it, but it's

Re: Design by Contract - most requested Java feature!

2009-11-24 Thread bearophile
Walter Bright: > Sorry, I'd overlooked that. You have nothing to be sorry of, good Walter, you are not supposed to read every silly thing that I post on this newsgroups. I like Design by Contract (DbC), even if I don't use it often. I think DbC is a very requested feature for Java because Java

Re: removal of cruft from D

2009-11-24 Thread BCS
Hello KennyTM~, On Nov 21, 09 15:40, Yigal Chripun wrote: On 21/11/2009 02:45, Andrei Alexandrescu wrote: Ellery Newcomer wrote: Nick Sabalausky wrote: "Yigal Chripun" wrote in message news:he6sqe$1dq...@digitalmars.com... Based on recent discussions on the NG a few features were depr

Re: Non-enum manifest constants: Pie in the sky?

2009-11-24 Thread bearophile
Jason House: > IMHO, enum is a patchwork collection of features... manifest constants, > enumerated lists, and bitmasks are all conflated into something rather ugly.< Manifest constants defined with enum look a little ugly, and I too don't like it, but it's not even a syntax problem, it's a nam

Re: thank's ddmd !

2009-11-24 Thread Don
Travis Boucher wrote: Bill Baxter wrote: On Mon, Nov 23, 2009 at 11:50 AM, Travis Boucher wrote: Denis Koroskin wrote: Travis Boucher has shown his interest in contribution, but he currently has issues with D2 not working on FreeBSD. To quote him: I have dmd working, and druntime (which was

Re: D array expansion and non-deterministic re-allocation

2009-11-24 Thread Steven Schveighoffer
On Tue, 24 Nov 2009 17:35:43 -0500, Bartosz Milewski wrote: Steven Schveighoffer Wrote: On Tue, 24 Nov 2009 16:52:52 -0500, Bartosz Milewski wrote: > Steven Schveighoffer Wrote: >> > Imagine you're reviewing this code written by a relative newbee: >> > >> > char[] quote(char[] word) { >>

Re: The great slice debate -- should slices be separated from arrays?

2009-11-24 Thread Phil Deets
I'm somewhat new to D; so take everything I say with a grain of salt. It seems to me that there is a tension here between high-level and low-level. A high-level Array type might make slices be a Range. The Range would keep a reference to the Array type plus a start and end index. When the s

Re: Non-enum manifest constants: Pie in the sky?

2009-11-24 Thread Jason House
Nick Sabalausky Wrote: > I don't suppose there's any chance that ugly design will be getting cleaned > up for D2 is there? Or maybe at least potentially on the table for D3? I'm with you, but you have quite an uphill battle. Both Andrei and Walter love it. IMHO, enum is a patchwork collection

Re: Switch-case made less buggy, now with PATCH!

2009-11-24 Thread BCS
Hello Chad, Don wrote: I think you've just created the strongest argument AGAINST this feature: that it makes it too hard for machine-generated code. Forget the !: hack. No chance. If that's the strongest argument, then this is cake. I'll go through Phobos and insert goto case's by hand if

Non-enum manifest constants: Pie in the sky?

2009-11-24 Thread Nick Sabalausky
I don't suppose there's any chance that ugly design will be getting cleaned up for D2 is there? Or maybe at least potentially on the table for D3?

Re: Design by Contract - most requested Java feature!

2009-11-24 Thread Walter Bright
bearophile wrote: Walter Bright: http://bugs.sun.com/bugdatabase/top25_rfes.do Yep: http://www.mail-archive.com/digitalmars-d@puremagic.com/msg18755.html Sorry, I'd overlooked that.

News/info on Go and Java

2009-11-24 Thread bearophile
Found on Reddit: This looks a lot like D: http://research.swtch.com/2009/11/go-data-structures.html New features in Java, some of them look like D: http://code.joejag.com/2009/new-language-features-in-java-7/ Bye, bearophile

Re: Design by Contract - most requested Java feature!

2009-11-24 Thread bearophile
Walter Bright: > http://bugs.sun.com/bugdatabase/top25_rfes.do Yep: http://www.mail-archive.com/digitalmars-d@puremagic.com/msg18755.html Bye, bearophile

Design by Contract - most requested Java feature!

2009-11-24 Thread Walter Bright
http://bugs.sun.com/bugdatabase/top25_rfes.do

Small code example

2009-11-24 Thread bearophile
This is a long line of Python2.x code that I've found difficult to translate to nice D1 code, even using my dlibs: result = min( ((arr[i], arr[j]) for i in xrange(len(arr) - 1) for j in xrange(i + 1, min(i + 5, len(arr, key=dist) Where: arr is a list

Re: Can we have this Syntactic sugar.

2009-11-24 Thread Long Chang
2009/11/24 Long Chang : > > > enum CompileTimeOption{ > >     ANCHORED , >     AUTO_CALLOUT , >     CASELESS , >     ENDONLY  , >     DOTALL  , >     EXTENDED , >     EXTRA   , >     FIRSTLINE , >     MULTILINE  , >     NO_AUTO_CAPTURE  , >     UNGREEDY , >     UTF8 , >     NO_UTF8_CHECK  , >     D

Re: Can we have this Syntactic sugar.

2009-11-24 Thread Long Chang
2009/11/24 Steven Schveighoffer : > On Tue, 24 Nov 2009 10:26:08 -0500, Nick Sabalausky wrote: > >> "Long Chang" wrote in message >> news:mailman.499.1259061212.20261.digitalmar...@puremagic.com... >>> >>> class RegExp >>> { >>>   enum Option{ >>>       X, Y, Z >>>   } >>>   int options; >>>   th

Re: D array expansion and non-deterministic re-allocation

2009-11-24 Thread Bartosz Milewski
Steven Schveighoffer Wrote: > On Tue, 24 Nov 2009 16:52:52 -0500, Bartosz Milewski > wrote: > > > Steven Schveighoffer Wrote: > >> > Imagine you're reviewing this code written by a relative newbee: > >> > > >> > char[] quote(char[] word) { > >> > word.length += 2; > >> > word[length-1] = '

Re: Should masked exceptions be an error?

2009-11-24 Thread Walter Bright
Brad Roberts wrote: Alternate thought.. should order matter or should it automatically sort such that most specific catch is preferred. Sort of matches the declaration order doesn't (ok, shouldn't) matter philosophy. I think the user should know if one inherits from the other, so I'm relucta

Re: D array expansion and non-deterministic re-allocation

2009-11-24 Thread Steven Schveighoffer
On Tue, 24 Nov 2009 16:52:52 -0500, Bartosz Milewski wrote: Steven Schveighoffer Wrote: > Imagine you're reviewing this code written by a relative newbee: > > char[] quote(char[] word) { > word.length += 2; > word[length-1] = '"'; > for(int i = word.length-2; i > 0; --i) > word[i]

Re: Should masked exceptions be an error?

2009-11-24 Thread Andrei Alexandrescu
Nick Sabalausky wrote: "Brad Roberts" wrote in message news:alpine.deb.2.00.0911241319190.18...@bellevue.puremagic.com... On Mon, 23 Nov 2009, Andrei Alexandrescu wrote: Consider: try { ... } catch (Exception) { ... } catch (StdioException) { ... } The second handler never matches

Re: D array expansion and non-deterministic re-allocation

2009-11-24 Thread Bartosz Milewski
Steven Schveighoffer Wrote: > > Imagine you're reviewing this code written by a relative newbee: > > > > char[] quote(char[] word) { > > word.length += 2; > > word[length-1] = '"'; > > for(int i = word.length-2; i > 0; --i) > > word[i] = word[i - 1]; > > word[0] = '"'; > > return word

Re: Short list with things to finish for D2

2009-11-24 Thread Travis Boucher
Denis Koroskin wrote: On Tue, 24 Nov 2009 14:00:18 +0300, Gerrit Wichert wrote: how about opLimit ? I recall that Visual Basic has UBound function that returns upper bound of a multi-dimensional array: Dim a(100, 5, 4) As Byte UBound(a, 1) -> 100 UBound(a, 2) -> 5 UBound(a, 3) -> 4 Wor

Re: Should masked exceptions be an error?

2009-11-24 Thread Nick Sabalausky
"Brad Roberts" wrote in message news:alpine.deb.2.00.0911241319190.18...@bellevue.puremagic.com... > On Mon, 23 Nov 2009, Andrei Alexandrescu wrote: > >> Consider: >> >> try { >>... >> } catch (Exception) { >>... >> } catch (StdioException) { >>... >> } >> >> The second handler never

Re: Should masked exceptions be an error?

2009-11-24 Thread Steven Schveighoffer
On Tue, 24 Nov 2009 16:20:14 -0500, Brad Roberts wrote: On Mon, 23 Nov 2009, Andrei Alexandrescu wrote: Consider: try { ... } catch (Exception) { ... } catch (StdioException) { ... } The second handler never matches because StdioException is a subclass of Exception, so the first

Re: Short list with things to finish for D2

2009-11-24 Thread aarti_pl
Don pisze: Additionally in my framework you can pass around parts of SQL e.g. : WhereExpression exp = Where(More(visitcards.id, 100)); You basically *CAN NOT* do it when just using strings. Of course you can define a where clause using strings. (I'm not sure when you'd want to, though. I su

Re: Should masked exceptions be an error?

2009-11-24 Thread Brad Roberts
On Mon, 23 Nov 2009, Andrei Alexandrescu wrote: > Consider: > > try { >... > } catch (Exception) { >... > } catch (StdioException) { >... > } > > The second handler never matches because StdioException is a subclass of > Exception, so the first handler will always match whatever the

Re: The great slice debate -- should slices be separated from arrays?

2009-11-24 Thread Steven Schveighoffer
On Tue, 24 Nov 2009 15:29:22 -0500, Bartosz Milewski wrote: Andrei Alexandrescu Wrote: Array may include a field bool sliceExtracted; that is set to true whenever you take a slice from the array and set to false whenever the array's data is reallocated. The array's documentation could

Re: The great slice debate -- should slices be separated from arrays?

2009-11-24 Thread Steven Schveighoffer
On Tue, 24 Nov 2009 15:25:27 -0500, Andrei Alexandrescu wrote: Steven Schveighoffer wrote: Why do we need this scheme then? If it only makes sense to use slicing when you are done appending, then why not use that model with today's rules? Why make code that uses slices before you are f

Re: D array expansion and non-deterministic re-allocation

2009-11-24 Thread Steven Schveighoffer
On Tue, 24 Nov 2009 15:00:11 -0500, Bartosz Milewski wrote: It's hard to argue whether something is or isn't bug prone and how severe the bugs could be. An experienced programmer knows all the gotchas so he or she will never introduce such bugs. A more bug-prone person will be afraid to

Re: The great slice debate -- should slices be separated from arrays?

2009-11-24 Thread Bartosz Milewski
Andrei Alexandrescu Wrote: > Array may include a field > > bool sliceExtracted; > > that is set to true whenever you take a slice from the array and set to > false whenever the array's data is reallocated. The array's > documentation could mention that ~= is amortized constant if there are

Re: The great slice debate -- should slices be separated from arrays?

2009-11-24 Thread Andrei Alexandrescu
Steven Schveighoffer wrote: On Tue, 24 Nov 2009 14:07:27 -0500, Andrei Alexandrescu wrote: Steven Schveighoffer wrote: On Tue, 24 Nov 2009 11:07:43 -0500, Andrei Alexandrescu wrote: Steven Schveighoffer wrote: In many other posts, people have been festering over dropping T[new] and not

Re: The great slice debate -- should slices be separated from arrays?

2009-11-24 Thread Andrei Alexandrescu
Steven Schveighoffer wrote: On Tue, 24 Nov 2009 14:55:55 -0500, Andrei Alexandrescu wrote: Because we don't know how to make things perfect in all circumstances. Well, this makes things less than perfect in most circumstances for the sake of a small questionable use case. IMO, this is a h

Re: The great slice debate -- should slices be separated from arrays?

2009-11-24 Thread Steven Schveighoffer
On Tue, 24 Nov 2009 14:55:55 -0500, Andrei Alexandrescu wrote: Because we don't know how to make things perfect in all circumstances. Well, this makes things less than perfect in most circumstances for the sake of a small questionable use case. IMO, this is a huge step backwards. -Stev

Re: D array expansion and non-deterministic re-allocation

2009-11-24 Thread Bartosz Milewski
It's hard to argue whether something is or isn't bug prone and how severe the bugs could be. An experienced programmer knows all the gotchas so he or she will never introduce such bugs. A more bug-prone person will be afraid to speak up in public so as not to appear stupid or be bullied away. It

Re: The great slice debate -- should slices be separated from arrays?

2009-11-24 Thread Andrei Alexandrescu
Steven Schveighoffer wrote: On Tue, 24 Nov 2009 14:07:27 -0500, Andrei Alexandrescu wrote: Steven Schveighoffer wrote: On Tue, 24 Nov 2009 11:07:43 -0500, Andrei Alexandrescu wrote: Steven Schveighoffer wrote: In many other posts, people have been festering over dropping T[new] and not

Re: The great slice debate -- should slices be separated from arrays?

2009-11-24 Thread Steven Schveighoffer
On Tue, 24 Nov 2009 14:07:27 -0500, Andrei Alexandrescu wrote: Steven Schveighoffer wrote: On Tue, 24 Nov 2009 11:07:43 -0500, Andrei Alexandrescu wrote: Steven Schveighoffer wrote: In many other posts, people have been festering over dropping T[new] and not having a reference array t

Re: The great slice debate -- should slices be separated from arrays?

2009-11-24 Thread Andrei Alexandrescu
Steven Schveighoffer wrote: On Tue, 24 Nov 2009 11:07:43 -0500, Andrei Alexandrescu wrote: Steven Schveighoffer wrote: In many other posts, people have been festering over dropping T[new] and not having a reference array type. The argument is (and forgive me if this is a strawman, someone

Re: D array expansion and non-deterministic re-allocation

2009-11-24 Thread Steven Schveighoffer
On Tue, 24 Nov 2009 12:46:37 -0500, Andrei Alexandrescu wrote: Steven Schveighoffer wrote: Lookup should be atomic without locking (I think, simply an integer load right?), but you'd have to lock to actually do an append. I don't think we solve the lock problem without having multiple he

Re: D array expansion and non-deterministic re-allocation

2009-11-24 Thread Steven Schveighoffer
On Tue, 24 Nov 2009 12:46:37 -0500, Andrei Alexandrescu wrote: Steven Schveighoffer wrote: On Tue, 24 Nov 2009 11:41:17 -0500, Steven Schveighoffer wrote: The cache is a thread-local map from pointers to size_t. Using it does not require any locking I think. When reallocating, do you

Re: D array expansion and non-deterministic re-allocation

2009-11-24 Thread Steven Schveighoffer
On Tue, 24 Nov 2009 12:46:37 -0500, Andrei Alexandrescu wrote: Steven Schveighoffer wrote: On Tue, 24 Nov 2009 11:41:17 -0500, Steven Schveighoffer wrote: The cache is a thread-local map from pointers to size_t. Using it does not require any locking I think. When reallocating, do you

Re: D array expansion and non-deterministic re-allocation

2009-11-24 Thread dsimcha
== Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s article > Steven Schveighoffer wrote: > > On Tue, 24 Nov 2009 11:41:17 -0500, Steven Schveighoffer > > wrote: > > > > > >>> The cache is a thread-local map from pointers to size_t. Using it > >>> does not require any locking I thi

Re: D array expansion and non-deterministic re-allocation

2009-11-24 Thread Andrei Alexandrescu
Steven Schveighoffer wrote: On Tue, 24 Nov 2009 11:41:17 -0500, Steven Schveighoffer wrote: The cache is a thread-local map from pointers to size_t. Using it does not require any locking I think. When reallocating, do you not also need to update the allocated length in the heap, even if t

Re: D array expansion and non-deterministic re-allocation

2009-11-24 Thread Andrei Alexandrescu
Bill Baxter wrote: On Tue, Nov 24, 2009 at 8:26 AM, Andrei Alexandrescu wrote: Steven Schveighoffer wrote: On Tue, 24 Nov 2009 11:01:10 -0500, Andrei Alexandrescu wrote: Steven Schveighoffer wrote: [snip] Andrei has mentioned that he thinks we can store the allocated length in the GC block

Re: D array expansion and non-deterministic re-allocation

2009-11-24 Thread Bill Baxter
On Tue, Nov 24, 2009 at 8:26 AM, Andrei Alexandrescu wrote: > Steven Schveighoffer wrote: >> >> On Tue, 24 Nov 2009 11:01:10 -0500, Andrei Alexandrescu >> wrote: >> >>> Steven Schveighoffer wrote: >>> [snip] Andrei has mentioned that he thinks we can store the allocated length in t

Re: D array expansion and non-deterministic re-allocation

2009-11-24 Thread Steven Schveighoffer
On Tue, 24 Nov 2009 11:41:17 -0500, Steven Schveighoffer wrote: The cache is a thread-local map from pointers to size_t. Using it does not require any locking I think. When reallocating, do you not also need to update the allocated length in the heap, even if the allocation fits into th

Re: GDC on ARM CPUs?

2009-11-24 Thread s_lange
Moritz Warning schrieb: apart from gdc, ldc might work as well http://dsource.org/projects/ldc. This looks quiet promising, except it still is beta, but hopefully this will get changed

Re: D array expansion and non-deterministic re-allocation

2009-11-24 Thread Steven Schveighoffer
On Tue, 24 Nov 2009 11:26:11 -0500, Andrei Alexandrescu wrote: Steven Schveighoffer wrote: On Tue, 24 Nov 2009 11:01:10 -0500, Andrei Alexandrescu wrote: Steven Schveighoffer wrote: [snip] Andrei has mentioned that he thinks we can store the allocated length in the GC block, which I t

Re: Can we have this Syntactic sugar.

2009-11-24 Thread Nick Sabalausky
"Nick Sabalausky" wrote in message news:heh1v5$1te...@digitalmars.com... > > Come to think of it though, I think my favorite is still making the > "Foo.Option." optional wherever a Foo.Option is expected. But, I'd > consider anything (except the Haxe-style approach of polluting the > namespace

Re: 16bit half floating point type as defined in IEEE-754r in D?

2009-11-24 Thread Andrei Alexandrescu
s_lange wrote: A 16 bit precision floating point type has been defined by the IEEE in the revision of the 754 floating point standard and declared as optional. These small data types are heavily used in all kinds of graphics rendering software. The most prominent example beeing the gl librarie

Re: Can we have this Syntactic sugar.

2009-11-24 Thread Nick Sabalausky
"Robert Clipsham" wrote in message news:hegv1c$1mo...@digitalmars.com... > Long Chang wrote: >> class RegExp >> { >> enum Option{ >> X, Y, Z >> } >> int options; >> this(int options = 0){ this.options = options; } >> } >> >> void main(){ >>auto reg = new RegExp("^

Re: Can we have this Syntactic sugar.

2009-11-24 Thread Steven Schveighoffer
On Tue, 24 Nov 2009 10:44:45 -0500, Robert Clipsham wrote: Long Chang wrote: class RegExp { enum Option{ X, Y, Z } int options; this(int options = 0){ this.options = options; } } void main(){ auto reg = new RegExp("^A.", .Option( X |Y|Z ) ); assert(

Re: D array expansion and non-deterministic re-allocation

2009-11-24 Thread Andrei Alexandrescu
Steven Schveighoffer wrote: On Tue, 24 Nov 2009 11:01:10 -0500, Andrei Alexandrescu wrote: Steven Schveighoffer wrote: [snip] Andrei has mentioned that he thinks we can store the allocated length in the GC block, which I think would also work. You also wouldn't need an MRU cache in that ca

Re: GDC on ARM CPUs?

2009-11-24 Thread Moritz Warning
On Tue, 24 Nov 2009 17:14:06 +0100, s_lange wrote: > I know there are ways to get GDC working on ARM CPUs, but I'm interested > to know whether there is also an ARM version of the DMD compiler. If it > isn't yet, then if it is planned or scheduled to port it to ARM, and if > it already is, in what

16bit half floating point type as defined in IEEE-754r in D?

2009-11-24 Thread s_lange
A 16 bit precision floating point type has been defined by the IEEE in the revision of the 754 floating point standard and declared as optional. These small data types are heavily used in all kinds of graphics rendering software. The most prominent example beeing the gl libraries of the OpenGL

Re: The great slice debate -- should slices be separated from arrays?

2009-11-24 Thread Steven Schveighoffer
On Tue, 24 Nov 2009 11:07:43 -0500, Andrei Alexandrescu wrote: Steven Schveighoffer wrote: In many other posts, people have been festering over dropping T[new] and not having a reference array type. The argument is (and forgive me if this is a strawman, someone from the other side can po

Re: GDC on ARM CPUs?

2009-11-24 Thread Denis Koroskin
On Tue, 24 Nov 2009 19:14:06 +0300, s_lange wrote: I know there are ways to get GDC working on ARM CPUs, but I'm interested to know whether there is also an ARM version of the DMD compiler. If it isn't yet, then if it is planned or scheduled to port it to ARM, and if it already is, in what

Re: Can we have this Syntactic sugar.

2009-11-24 Thread Nick Sabalausky
"Steven Schveighoffer" wrote in message news:op.u3woiqnyeav...@localhost.localdomain... > On Tue, 24 Nov 2009 10:26:08 -0500, Nick Sabalausky wrote: > >> "Long Chang" wrote in message >> news:mailman.499.1259061212.20261.digitalmar...@puremagic.com... >>> class RegExp >>> { >>>enum Option{

GDC on ARM CPUs?

2009-11-24 Thread s_lange
I know there are ways to get GDC working on ARM CPUs, but I'm interested to know whether there is also an ARM version of the DMD compiler. If it isn't yet, then if it is planned or scheduled to port it to ARM, and if it already is, in what status it currently is. I'm specifically interested on

Re: D array expansion and non-deterministic re-allocation

2009-11-24 Thread Steven Schveighoffer
On Tue, 24 Nov 2009 11:01:10 -0500, Andrei Alexandrescu wrote: Steven Schveighoffer wrote: [snip] Andrei has mentioned that he thinks we can store the allocated length in the GC block, which I think would also work. You also wouldn't need an MRU cache in that case, but he says it's in *a

Re: Short list with things to finish for D2

2009-11-24 Thread Don
aarti_pl wrote: Lutger pisze: yigal chripun wrote: aarti_pl Wrote: There's nothing more hideous than all those frameworks in Java/C++ that try to re-enginer SQL into functions, templates, LINQ, whatever. SQL *is* a perfectly designed language for its purpose and it doesn't need to be

Re: The great slice debate -- should slices be separated from arrays?

2009-11-24 Thread Andrei Alexandrescu
Steven Schveighoffer wrote: In many other posts, people have been festering over dropping T[new] and not having a reference array type. The argument is (and forgive me if this is a strawman, someone from the other side can post if I'm incorrect): If we make arrays a separate type from slices,

Re: The great slice debate -- should slices be separated from arrays?

2009-11-24 Thread Steven Schveighoffer
On Tue, 24 Nov 2009 09:27:22 -0500, Steven Schveighoffer wrote: I think dsichma already is working on such a type. Gah! my apologies to David, I should know better as someone who has a hard-to-spell last name. For some reason I always read "dee-sic-ma" when I see your handle :) I mean

Re: D array expansion and non-deterministic re-allocation

2009-11-24 Thread Andrei Alexandrescu
Steven Schveighoffer wrote: [snip] Andrei has mentioned that he thinks we can store the allocated length in the GC block, which I think would also work. You also wouldn't need an MRU cache in that case, but he says it's in *addition* to the MRU cache, so I'm not sure what he means. [snip] Re

Re: Should masked exceptions be an error?

2009-11-24 Thread Andrei Alexandrescu
Walter Bright wrote: Andrei Alexandrescu wrote: Should that be a compile-time error? I think so. = class A : Exception { this(string msg) { super(msg); } } void foo() { try { } catch (Exception e) { } catch (A e) { } } ==

Re: Can we have this Syntactic sugar.

2009-11-24 Thread Robert Clipsham
Long Chang wrote: class RegExp { enum Option{ X, Y, Z } int options; this(int options = 0){ this.options = options; } } void main(){ auto reg = new RegExp("^A.", .Option( X |Y|Z ) ); assert( RegExp .Option.X | RegExp .Option.Y| RegExp .Option.Z == reg

Re: Can we have this Syntactic sugar.

2009-11-24 Thread bearophile
Nick Sabalausky: > That's a very good idea, I like that a lot. I don't understand that idea yet, sorry :-) Is that proposal asking for sugar to write: enum Option { X, Y, Z } Option.X | Option.Y | Option.Z As: Option(X | Y | Z) ? Or is it asking for something more, like omitting the class name in

Re: Can we have this Syntactic sugar.

2009-11-24 Thread Steven Schveighoffer
On Tue, 24 Nov 2009 10:26:08 -0500, Nick Sabalausky wrote: "Long Chang" wrote in message news:mailman.499.1259061212.20261.digitalmar...@puremagic.com... class RegExp { enum Option{ X, Y, Z } int options; this(int options = 0){ this.options = options; } } void main(){

Re: The great slice debate -- should slices be separated from arrays?

2009-11-24 Thread Steven Schveighoffer
On Tue, 24 Nov 2009 10:19:57 -0500, Lutger wrote: Just to clarify, is it true that stomping over mutable arrays is covered by the spec (currently), but stomping immutable arrays is classified as a bug? I was very surprised by this. Stomping of arrays is covered by the spec (without refe

Re: Should masked exceptions be an error?

2009-11-24 Thread Denis Koroskin
On Tue, 24 Nov 2009 18:31:27 +0300, Nick Sabalausky wrote: "Lars T. Kyllingstad" wrote in message news:heg9jk$7f...@digitalmars.com... I think the spec should state as a general rule that unreachable code is an error. Disagree very much with this. I don't want to have to carefully comment

Re: Should masked exceptions be an error?

2009-11-24 Thread Nick Sabalausky
"Lars T. Kyllingstad" wrote in message news:heg9jk$7f...@digitalmars.com... > > I think the spec should state as a general rule that unreachable code is > an error. Disagree very much with this. I don't want to have to carefully comment out temporarily-dead code when I'm inserting debugging br

Re: Can we have this Syntactic sugar.

2009-11-24 Thread Nick Sabalausky
"Long Chang" wrote in message news:mailman.499.1259061212.20261.digitalmar...@puremagic.com... > class RegExp > { >enum Option{ >X, Y, Z >} >int options; >this(int options = 0){ this.options = options; } > } > > void main(){ > auto reg = new RegExp("^A.", .Option(

Re: The great slice debate -- should slices be separated from arrays?

2009-11-24 Thread Lutger
Just to clarify, is it true that stomping over mutable arrays is covered by the spec (currently), but stomping immutable arrays is classified as a bug? I was very surprised by this.

Re: The great slice debate -- should slices be separated from arrays?

2009-11-24 Thread Steven Schveighoffer
On Tue, 24 Nov 2009 09:27:22 -0500, Steven Schveighoffer wrote: This stomping becomes more of a problem for library writers: char * toStringZ(string s) { s ~= '\0'; return s.ptr; } Apologies, this should be written: immutable(char) * toStringZ(string s) -Steve

The great slice debate -- should slices be separated from arrays?

2009-11-24 Thread Steven Schveighoffer
In many other posts, people have been festering over dropping T[new] and not having a reference array type. The argument is (and forgive me if this is a strawman, someone from the other side can post if I'm incorrect): If we make arrays a separate type from slices, and only allow appending

Re: is this a dmd bug ?

2009-11-24 Thread Long Chang
this.outer also. work on d1.  thank you guys.

Re: Switch-case made less buggy, now with PATCH!

2009-11-24 Thread Jason House
Don Wrote: > Bill Baxter wrote: > > On Mon, Nov 23, 2009 at 11:33 AM, Leandro Lucarella > > wrote: > >> I'm just saying > >> that the patch was mostly turned down because he didn't asked for other > >> devs permission to make the patch, not because of the quality of the patch > >> (or the featur

Re: is this a dmd bug ?

2009-11-24 Thread Steven Schveighoffer
On Tue, 24 Nov 2009 08:09:28 -0500, Long Chang wrote: I use the d1 & tango trunk & dwt-win. there is a new dispose method for Object, and Dwt-win already have a dispose width Event argument. I try it with outer, the error is : x.d(17): Error: undefined identifier outer x.d(17): Error:

Re: is this a dmd bug ?

2009-11-24 Thread Denis Koroskin
On Tue, 24 Nov 2009 16:09:28 +0300, Long Chang wrote: I use the d1 & tango trunk & dwt-win. there is a new dispose method for Object, and Dwt-win already have a dispose width Event argument. I try it with outer, the error is : x.d(17): Error: undefined identifier outer x.d(17): Error:

Re: is this a dmd bug ?

2009-11-24 Thread Long Chang
I use the d1 & tango trunk & dwt-win. there is a new dispose method for Object, and Dwt-win already have a dispose width Event argument. I try it with outer, the error is : x.d(17): Error: undefined identifier outer x.d(17): Error: undefined identifier outer x.d(17): Error: no property 'toStrin

Re: is this a dmd bug ?

2009-11-24 Thread Steven Schveighoffer
On Tue, 24 Nov 2009 07:38:51 -0500, Long Chang wrote: how about this case: public interface Listener { void handleEvent (int); } class Test{ this(){ Listener listener= new class() Listener { public void handleEvent(int evt) { toString(evt);

Re: D array expansion and non-deterministic re-allocation

2009-11-24 Thread Steven Schveighoffer
On Mon, 23 Nov 2009 18:34:48 -0500, Leandro Lucarella wrote: Steven Schveighoffer, el 23 de noviembre a las 15:18 me escribiste: On Mon, 23 Nov 2009 11:10:48 -0500, Leandro Lucarella wrote: > >The thing is, with realloc() is less likely that you forget that the data >can be copied because

Re: is this a dmd bug ?

2009-11-24 Thread Long Chang
how about this case: public interface Listener { void handleEvent (int); } class Test{ this(){ Listener listener= new class() Listener { public void handleEvent(int evt) { toString(evt); } }; } void toString(int evt){

Re: is this a dmd bug ?

2009-11-24 Thread Steven Schveighoffer
On Tue, 24 Nov 2009 06:55:44 -0500, Long Chang wrote: public interface Listener { void handleEvent (int); } void main(){ void print(int evt){ } Listener listener= new class() Listener { public void handleEvent(int evt) { .print(evt); } };

Re: is this a dmd bug ?

2009-11-24 Thread Denis Koroskin
On Tue, 24 Nov 2009 14:55:44 +0300, Long Chang wrote: public interface Listener { void handleEvent (int); } void main(){ void print(int evt){ } Listener listener= new class() Listener { public void handleEvent(int evt) { .print(evt); } };

is this a dmd bug ?

2009-11-24 Thread Long Chang
public interface Listener { void handleEvent (int); } void main(){ void print(int evt){ } Listener listener= new class() Listener { public void handleEvent(int evt) { .print(evt); } }; } -

Re: Should masked exceptions be an error?

2009-11-24 Thread Ary Borenszweig
Michal Minich wrote: Andrei Alexandrescu wrote: Consider: try { ... } catch (Exception) { ... } catch (StdioException) { ... } The second handler never matches because StdioException is a subclass of Exception, so the first handler will always match whatever the second matches. Should that be

Re: Short list with things to finish for D2

2009-11-24 Thread Denis Koroskin
On Tue, 24 Nov 2009 14:00:18 +0300, Gerrit Wichert wrote: how about opLimit ? I recall that Visual Basic has UBound function that returns upper bound of a multi-dimensional array: Dim a(100, 5, 4) As Byte UBound(a, 1) -> 100 UBound(a, 2) -> 5 UBound(a, 3) -> 4 Works for single-dimensi

Re: Short list with things to finish for D2

2009-11-24 Thread Gerrit Wichert
how about opLimit ?

Re: Can we have this Syntactic sugar.

2009-11-24 Thread Long Chang
class RegExp { enum Option{ X, Y, Z } int options; this(int options = 0){ this.options = options; } } void main(){ auto reg = new RegExp("^A.", .Option( X |Y|Z ) ); assert( RegExp .Option.X | RegExp .Option.Y| RegExp .Option.Z == reg.options ); }

Can we have this Syntactic sugar.

2009-11-24 Thread Long Chang
enum CompileTimeOption{ ANCHORED , AUTO_CALLOUT , CASELESS , ENDONLY , DOTALL , EXTENDED , EXTRA , FIRSTLINE , MULTILINE , NO_AUTO_CAPTURE , UNGREEDY , UTF8 , NO_UTF8_CHECK , DUPNAMES , NEWLINE_CR , NEWLINE_LF , NEWLIN

Re: Should masked exceptions be an error?

2009-11-24 Thread Rory McGuire
Andrei Alexandrescu wrote: > Consider: > > try { > ... > } catch (Exception) { > ... > } catch (StdioException) { > ... > } > > The second handler never matches because StdioException is a subclass of > Exception, so the first handler will always match whatever the second > match

Re: Should masked exceptions be an error?

2009-11-24 Thread Walter Bright
Andrei Alexandrescu wrote: Should that be a compile-time error? I think so. = class A : Exception { this(string msg) { super(msg); } } void foo() { try { } catch (Exception e) { } catch (A e) { } } = gives: test.

Re: Should masked exceptions be an error?

2009-11-24 Thread Michal Minich
Andrei Alexandrescu wrote: Consider: try { ... } catch (Exception) { ... } catch (StdioException) { ... } The second handler never matches because StdioException is a subclass of Exception, so the first handler will always match whatever the second matches. Should that be a compile-time error?

Re: Should masked exceptions be an error?

2009-11-24 Thread Lars T. Kyllingstad
Andrei Alexandrescu wrote: Consider: try { ... } catch (Exception) { ... } catch (StdioException) { ... } The second handler never matches because StdioException is a subclass of Exception, so the first handler will always match whatever the second matches. Should that be a compile

Re: Should masked exceptions be an error?

2009-11-24 Thread Ary Borenszweig
Andrei Alexandrescu wrote: Consider: try { ... } catch (Exception) { ... } catch (StdioException) { ... } The second handler never matches because StdioException is a subclass of Exception, so the first handler will always match whatever the second matches. Should that be a compile

Re: Should masked exceptions be an error?

2009-11-24 Thread Denis Koroskin
On Tue, 24 Nov 2009 10:30:30 +0300, Andrei Alexandrescu wrote: Consider: try { ... } catch (Exception) { ... } catch (StdioException) { ... } The second handler never matches because StdioException is a subclass of Exception, so the first handler will always match whatever the

Re: D array expansion and non-deterministic re-allocation

2009-11-24 Thread Bartosz Milewski
Andrei Alexandrescu Wrote: > sharing for ~=. Also I am not ruling out the possibility that we can > guarantee a ~= that never keeps sharing with existing arrays. (One idea > I discussed with Walter was encoding uniqueness of arrays in a bit > stored with the array limits.) I've been thinking th

  1   2   >