Re: automated C++ binding generation.. Booost D, NO , Not us. SIMD is more important.

2012-03-16 Thread Gour
On Sat, 17 Mar 2012 02:29:26 +0100 Andrej Mitrovic wrote: > Sorry for the long wait. Turns out I was *extremely* wrong about this. > Generating the D side turned out to be a hell of a lot more work then > I initially thought (mostly due to C++ and D type incompatibilities > and scoping issues).

Re: Dynamic language

2012-03-16 Thread Danni Coy
I mostly do game scripting -- and there are quite a few features in D that I would like access to. Python would be my goto dynamic language mostly because a lot of the applications I use are either partially written in it or can be scripted easily using it. Also it is quite an enjoyable language t

Re: OpenBSD port of dmd?

2012-03-16 Thread Andrei Alexandrescu
On 3/16/12 11:50 PM, Nick Sabalausky wrote: Walter has produced arguments that have convinced a number of us. Daniel and I, at the very least. What Walter has failed to do is convince *you*, and that's a very, very different thing. Especially when he's pitted against counterarguments like "I just

Re: OpenBSD port of dmd?

2012-03-16 Thread Vladimir Panteleev
On Saturday, 17 March 2012 at 01:37:49 UTC, Andrei Alexandrescu wrote: This is in the same vein: "let's avoid else". It seems to me more like "final switch" vs. "default:".

Re: Immutable static arrays

2012-03-16 Thread H. S. Teoh
On Sat, Mar 17, 2012 at 03:51:01PM +1100, Daniel Murphy wrote: > "H. S. Teoh" wrote in message > news:mailman.806.1331959335.4860.digitalmar...@puremagic.com... > > > > Argh. So I have to hack around this by casting an immutable static > > array key into a mutable one inside the AA? (Which should

Re: OpenBSD port of dmd?

2012-03-16 Thread Nick Sabalausky
"Andrei Alexandrescu" wrote in message news:jk0ptd$29g2$1...@digitalmars.com... > On 3/16/12 8:16 PM, Daniel Murphy wrote: >> The only time to make this decision is when implementing >> support for a specific platform, and this pattern forces you to consider >> each place where platform specific

Re: Immutable static arrays

2012-03-16 Thread Daniel Murphy
"H. S. Teoh" wrote in message news:mailman.806.1331959335.4860.digitalmar...@puremagic.com... > > Argh. So I have to hack around this by casting an immutable static array > key into a mutable one inside the AA? (Which should work, I suppose, > because a copy is being made.) Or should I just leave

Re: Immutable static arrays

2012-03-16 Thread H. S. Teoh
On Sat, Mar 17, 2012 at 03:03:02PM +1100, Daniel Murphy wrote: > "H. S. Teoh" wrote in message > news:mailman.804.1331956668.4860.digitalmar...@puremagic.com... [...] > > P.S. The error message is: > > > > newAA.d(58): Error: slice this.key[] is not mutable [...] > > Why is the assignment being t

Re: Immutable static arrays

2012-03-16 Thread Daniel Murphy
"H. S. Teoh" wrote in message news:mailman.805.1331958621.4860.digitalmar...@puremagic.com... > On Sat, Mar 17, 2012 at 02:59:55PM +1100, Daniel Murphy wrote: > [...] >> > So there's no tail-const type for static arrays? >> > >> > More to the point, how should AA's with immutable static array ke

Re: Immutable static arrays

2012-03-16 Thread Daniel Murphy
"H. S. Teoh" wrote in message news:mailman.804.1331956668.4860.digitalmar...@puremagic.com... > On Fri, Mar 16, 2012 at 08:53:06PM -0700, H. S. Teoh wrote: > [...] >> More to the point, how should AA's with immutable static array keys be >> implemented? The current implementation doesn't work at

Re: Immutable static arrays

2012-03-16 Thread H. S. Teoh
On Sat, Mar 17, 2012 at 02:59:55PM +1100, Daniel Murphy wrote: [...] > > So there's no tail-const type for static arrays? > > > > More to the point, how should AA's with immutable static array keys > > be implemented? The current implementation doesn't work at all > > because the input static array

Re: Immutable static arrays

2012-03-16 Thread Daniel Murphy
"H. S. Teoh" wrote in message news:mailman.803.1331956296.4860.digitalmar...@puremagic.com... > Is this a bug? > > import std.stdio; > void main() { > immutable(int)[4] a; > immutable(int[4]) b; > writeln(typeid(a)); > writeln(typeid(b)); > } > > Output: > > immutable(int[4]) > immutable(int[4])

Re: Immutable static arrays

2012-03-16 Thread H. S. Teoh
On Fri, Mar 16, 2012 at 08:53:06PM -0700, H. S. Teoh wrote: [...] > More to the point, how should AA's with immutable static array keys be > implemented? The current implementation doesn't work at all because the > input static array can't be assigned to the Slot (the static array field > in Slot i

Immutable static arrays

2012-03-16 Thread H. S. Teoh
Is this a bug? import std.stdio; void main() { immutable(int)[4] a; immutable(int[4]) b; writeln(typeid(a)); writeln(typeid(b)); } Output: immutable(int[4]) immutable(int[4]) So there's no ta

Re: automated C++ binding generation.. Booost D, NO , Not us. SIMD is more important.

2012-03-16 Thread Andrej Mitrovic
On 3/17/12, Brad Anderson wrote: > Could the wxc generator be be used as a base for building bindings for > other libraries? I hope it will be. It's kind of crazy that the first thing I'm using it on is a huge library like wxD, this will likely be its biggest unittest, so to speak. :p Doxygen ca

Re: OpenBSD port of dmd?

2012-03-16 Thread Walter Bright
On 3/16/2012 5:16 PM, Andrei Alexandrescu wrote: > Not convinced. They call it specialization, and it's a powerful concept. We use > it in std.algorithm all over the place. I'll admit my argument may not sound convincing. But I've lived this problem for 25 years. Through trial and error, mostly

Re: OpenBSD port of dmd?

2012-03-16 Thread Daniel Murphy
"Alex Rønne Petersen" wrote in message news:jk0rr8$2c3n$1...@digitalmars.com... > > I think this post is basically proof that we need logical and/or in > version statements. I'm just putting that out there > > -- > - Alex Yeah. While I agree with Walter's arguments against this, forcing t

Re: automated C++ binding generation.. Booost D, NO , Not us. SIMD is more important.

2012-03-16 Thread Brad Anderson
On Fri, Mar 16, 2012 at 7:29 PM, Andrej Mitrovic wrote: > On 2/11/12, Andrej Mitrovic wrote: > > The D classes > > are not yet generated until I get wxc done, but wxc is 95% of the > > source of difficulty. Generating wxd should be easy after that. > > Sorry for the long wait. Turns out I was *e

Re: OpenBSD port of dmd?

2012-03-16 Thread Alex Rønne Petersen
On 17-03-2012 02:16, Daniel Murphy wrote: "Andrei Alexandrescu" wrote in message news:jk0naq$257e$1...@digitalmars.com... But why duplicate doItSlowWay(); which may be an arbitrarily long sequence? If duplicating that block is a problem, there are other ways to do it. version(ThisOS) {

Re: OpenBSD port of dmd?

2012-03-16 Thread Daniel Murphy
"Andrei Alexandrescu" wrote in message news:jk0ptd$29g2$1...@digitalmars.com... >>> >>> But why duplicate doItSlowWay(); which may be an arbitrarily long >>> sequence? >> >> If duplicating that block is a problem, there are other ways to do it. > [snip] > > This is in the same vein: "let's avoid

Re: OpenBSD port of dmd?

2012-03-16 Thread Andrei Alexandrescu
On 3/16/12 8:16 PM, Daniel Murphy wrote: "Andrei Alexandrescu" wrote in message news:jk0naq$257e$1...@digitalmars.com... But why duplicate doItSlowWay(); which may be an arbitrarily long sequence? If duplicating that block is a problem, there are other ways to do it. [snip] This is in the

Re: Scala macros

2012-03-16 Thread H. S. Teoh
On Fri, Mar 16, 2012 at 01:42:51PM -0400, bearophile wrote: > There are plans of adding macros to Scala language, and I think they are > already partially implemented: > > https://docs.google.com/document/d/1O879Iz-567FzVb8kw6N5OBpei9dnbW0ZaT7-XNSa6Cs/edit?hl=en_US > > > >From the article: > >

Re: automated C++ binding generation.. Booost D, NO , Not us. SIMD is more important.

2012-03-16 Thread Andrej Mitrovic
On 2/11/12, Andrej Mitrovic wrote: > The D classes > are not yet generated until I get wxc done, but wxc is 95% of the > source of difficulty. Generating wxd should be easy after that. Sorry for the long wait. Turns out I was *extremely* wrong about this. Generating the D side turned out to be a

Re: Proposal: user defined attributes

2012-03-16 Thread Alvaro
El 16/03/2012 14:35, Adam D. Ruppe escribió: We introduce two new things to the language: 1) the @note(expression) attribute. You can put as many "notes" on a declaration as you want by simply listing them. I like that. I learned about annotations a couple years ago in two contexts: - We

Re: OpenBSD port of dmd?

2012-03-16 Thread Daniel Murphy
"Andrei Alexandrescu" wrote in message news:jk0naq$257e$1...@digitalmars.com... > > But why duplicate doItSlowWay(); which may be an arbitrarily long > sequence? If duplicating that block is a problem, there are other ways to do it. version(ThisOS) { version = FastWayA; } else version(ThatO

Re: Proposal: user defined attributes

2012-03-16 Thread Kapps
On Saturday, 17 March 2012 at 00:54:02 UTC, Andrej Mitrovic wrote: On 3/17/12, Kapps wrote: @WebForm("Account"); @PostTo("Services/CreateAccount") @SecureOnly(true) struct CreateAccountForm { That kind of turns D from a structural to a declarative language. :p Web design is quite a declara

Re: OpenBSD port of dmd?

2012-03-16 Thread Andrei Alexandrescu
On 3/16/12 7:45 PM, Daniel Murphy wrote: You can do that just as well without using an 'else' block. version(ThisOS) { doItThisWay(); } else version(ThatOS) { doItThatWay(); } else version(SomeOS) { doItSlowWay(); } else version(OtherOS) { doItSlowWay(); } else static assert(

Re: Proposal: user defined attributes

2012-03-16 Thread Andrej Mitrovic
On 3/17/12, Kapps wrote: > @WebForm("Account"); > @PostTo("Services/CreateAccount") > @SecureOnly(true) > struct CreateAccountForm { That kind of turns D from a structural to a declarative language. :p

Re: OpenBSD port of dmd?

2012-03-16 Thread Daniel Murphy
"Andrei Alexandrescu" wrote in message news:jk0l57$20hs$1...@digitalmars.com... > > Not convinced. They call it specialization, and it's a powerful concept. > We use it in std.algorithm all over the place. > > Andrei You can do that just as well without using an 'else' block. version(ThisOS) {

Re: Proposal: user defined attributes

2012-03-16 Thread Kapps
On Friday, 16 March 2012 at 16:09:55 UTC, Andrei Alexandrescu wrote: So we have: class A { @note(Serializable.yes) int a; ... } vs. a hypothetical in-language solution: class A { int a; mixin(note("a", Serializable.yes)); ... } I wonder to what extent the in-language solut

Re: OpenBSD port of dmd?

2012-03-16 Thread Andrei Alexandrescu
On 3/16/12 6:30 PM, Walter Bright wrote: On 3/16/2012 4:18 PM, Walter Bright wrote: On 3/16/2012 4:04 PM, Andrei Alexandrescu wrote: Never say never. There are I/O routines that are specialized for several OSs and fall back to a generic (slower) implementation. I'm going to suggest that is wr

Re: Dynamic language

2012-03-16 Thread bearophile
so: > Not related to D but this is a community which i can find at > least a few objective person. I want to invest some "quality" > time on a dynamic language but i am not sure which one. Would you > please suggest one? > > To give you an idea what i am after: > Of all one-liners i have heard

Re: Multiple return values...

2012-03-16 Thread bearophile
Simen K.: > Now, a pattern that our productive friend bearophile posted earlier was > this: > > int[] foo(); > > (auto a, b) = foo(); > > ---> > > auto __t = foo(); > assert( __t.length > 0 ); > auto a = __t[0]; > auto b = __t[1..$]; > > Is this something we might also want? That's not a g

Re: Dynamic language

2012-03-16 Thread Adam D. Ruppe
On Friday, 16 March 2012 at 11:22:07 UTC, Boscop wrote: How would it be possible, the type of the delegate can't be typechecked at the call-site, because the type info is lost in the variant. The trick is to build wrapper functions at the assignment point, where you still have all the type inf

Re: Dynamic language

2012-03-16 Thread Adam D. Ruppe
On Friday, 16 March 2012 at 22:48:44 UTC, F i L wrote: Yes it does. I'm sure it wont be too long before all this stuff is fixed up a bit. Aye. I just sent a pull request for the minor std.variant thing (so strings can be converted to ints - we can do weak typing more easily now if we want). Th

Re: OpenBSD port of dmd?

2012-03-16 Thread Walter Bright
On 3/16/2012 4:18 PM, Walter Bright wrote: On 3/16/2012 4:04 PM, Andrei Alexandrescu wrote: Never say never. There are I/O routines that are specialized for several OSs and fall back to a generic (slower) implementation. I'm going to suggest that is wrong as well. It's fine for a new port to u

Re: OpenBSD port of dmd?

2012-03-16 Thread Walter Bright
On 3/16/2012 4:04 PM, Andrei Alexandrescu wrote: Never say never. There are I/O routines that are specialized for several OSs and fall back to a generic (slower) implementation. I'm going to suggest that is wrong as well. It's fine for a new port to use a generic slow implementation, but that

Re: OpenBSD port of dmd?

2012-03-16 Thread Andrei Alexandrescu
On 3/16/12 5:27 PM, Walter Bright wrote: There should never, EVER, in the library code be something like: version (FreeBSD) ... do something weird with FreeBSD ... else ... do the default ... If you find any code like this in the library, please file a bugzilla entry for it. Instead: version

Re: Ideas for Phobos., u++ STL speed comparison

2012-03-16 Thread Jay Norwood
On Friday, 16 March 2012 at 14:26:19 UTC, Andrei Alexandrescu wrote: http://www.ultimatepp.org/www$uppweb$vsd$en-us.html The test uses a specific data structure, an indexed contiguous array. To conclude from here that C++ is faster than D is quite a stretch. Andrei In fact the claim is no

Re: Dynamic language

2012-03-16 Thread F i L
On Friday, 16 March 2012 at 14:23:20 UTC, Adam D. Ruppe wrote: On Friday, 16 March 2012 at 09:12:57 UTC, F i L wrote: Alright I give up dammit! How do you use opCall() to make a.cool() work? I was a little unclear... but you'll have to modify std.variant and/or wrap it. Here's a solution that

Re: OpenBSD port of dmd?

2012-03-16 Thread Walter Bright
On 3/16/2012 1:38 PM, Jonathan M Davis wrote: That's not necessarily a bad thing, It's very deliberate, and it's *certainly* not a bad thing. No ifs, ands, or buts about it. Supporting a new OS by assuming that declarations for some other random OS will work is a recipe for unending frustra

Re: Something wrong with win32 dmd 2.059head?

2012-03-16 Thread Vladimir Panteleev
On Friday, 16 March 2012 at 21:26:40 UTC, Jonathan M Davis wrote: Well, I believe that the error gagging was temporarily turned off (with the idea of re-enabling closer to the release of 2.059), so you do get a ton of error messages when there's anything wrong with a template. I don't know why

Re: Changing the name of the language?

2012-03-16 Thread Manu
On 16 March 2012 23:29, Nick Sabalausky wrote: > "Manu" wrote in message > news:mailman.778.1331920080.4860.digitalmar...@puremagic.com... > > On 16 March 2012 03:23, ixid wrote: > > > >> D is a very poor name for a language. I appreciate it's late in the day > >> for this and that it has proba

Re: std.simd

2012-03-16 Thread Manu
On 16 March 2012 22:39, Robert Jacques wrote: > On Fri, 16 Mar 2012 08:24:58 -0500, David Nadlinger > wrote: > > On Thursday, 15 March 2012 at 23:32:29 UTC, Robert Jacques wrote: >> >>> Then you should to leave namespace room for that higher level library. >>> >> >> What makes you thing that th

Re: OpenBSD port of dmd?

2012-03-16 Thread Sean Kelly
On Mar 16, 2012, at 2:19 PM, Johannes Pfau wrote: > Am Fri, 16 Mar 2012 12:08:01 -0700 > schrieb Walter Bright : > >> On 3/16/2012 7:53 AM, Andrei Alexandrescu wrote: >>> Just found this, has anyone tried dmd or friends on OpenBSD? >>> >>> http://stackoverflow.com/questions/9698581/programming-i

Re: Changing the name of the language?

2012-03-16 Thread Nick Sabalausky
"Manu" wrote in message news:mailman.778.1331920080.4860.digitalmar...@puremagic.com... > On 16 March 2012 03:23, ixid wrote: > >> D is a very poor name for a language. I appreciate it's late in the day >> for this and that it has probably been discussed before (not that I could >> find such a d

Re: Something wrong with win32 dmd 2.059head?

2012-03-16 Thread Jonathan M Davis
On Saturday, March 17, 2012 00:43:48 Dmitry Olshansky wrote: > I meant to ask this before, but am I the only one seeing pages of error > messages on win32 while showing reasonable few lines on pretty much any > other platform? > Compare my failing (due to wrong predicate passed to assertSorted) pul

Re: OpenBSD port of dmd?

2012-03-16 Thread Johannes Pfau
Am Fri, 16 Mar 2012 12:08:01 -0700 schrieb Walter Bright : > On 3/16/2012 7:53 AM, Andrei Alexandrescu wrote: > > Just found this, has anyone tried dmd or friends on OpenBSD? > > > > http://stackoverflow.com/questions/9698581/programming-in-d-for-openbsd > > There was a start on an OpenBSD port,

Re: Proposal: user defined attributes

2012-03-16 Thread Johannes Pfau
Am Fri, 16 Mar 2012 16:21:41 +0100 schrieb Piotr Szturmaj : > > @note(Serializable.yes) int a; > > This is just enum. If you use struct or class attributes (like in C#) > then direct @Struct(constructor args..) might be better. > > +1 > > The expression inside is appended to a list on > > the

Re: Something wrong with win32 dmd 2.059head?

2012-03-16 Thread Dmitry Olshansky
On 17.03.2012 0:43, Dmitry Olshansky wrote: I meant to ask this before, but am I the only one seeing pages of error messages on win32 while showing reasonable few lines on pretty much any other platform? Compare my failing (due to wrong predicate passed to assertSorted) pull 462 test runs: win32:

Something wrong with win32 dmd 2.059head?

2012-03-16 Thread Dmitry Olshansky
I meant to ask this before, but am I the only one seeing pages of error messages on win32 while showing reasonable few lines on pretty much any other platform? Compare my failing (due to wrong predicate passed to assertSorted) pull 462 test runs: win32: http://d.puremagic.com/test-results/pull.

Re: std.simd

2012-03-16 Thread Robert Jacques
On Fri, 16 Mar 2012 08:24:58 -0500, David Nadlinger wrote: On Thursday, 15 March 2012 at 23:32:29 UTC, Robert Jacques wrote: Then you should to leave namespace room for that higher level library. What makes you thing that there would be only one such high-level library wanting to define

Re: OpenBSD port of dmd?

2012-03-16 Thread Jonathan M Davis
On Friday, March 16, 2012 16:00:47 Nick Sabalausky wrote: > "Martin Nowak" wrote in message > news:op.wa9r9izqsqugbd@localhost... > > > On Fri, 16 Mar 2012 15:53:45 +0100, Andrei Alexandrescu > > > > wrote: > >> Just found this, has anyone tried dmd or friends on OpenBSD? > >> > >> http://stac

Re: Dynamic language

2012-03-16 Thread Nick Sabalausky
"Simon" wrote in message news:jk053b$sg0$1...@digitalmars.com... > On 16/03/2012 02:28, Nick Sabalausky wrote: >> "James Miller" wrote in message >> news:mailman.733.1331853568.4860.digitalmar...@puremagic.com... >>> >>> I hate the fact that Flash games are created the way they are. For >>> one,

Re: OpenBSD port of dmd?

2012-03-16 Thread Nick Sabalausky
"Martin Nowak" wrote in message news:op.wa9r9izqsqugbd@localhost... > On Fri, 16 Mar 2012 15:53:45 +0100, Andrei Alexandrescu > wrote: > >> Just found this, has anyone tried dmd or friends on OpenBSD? >> >> http://stackoverflow.com/questions/9698581/programming-in-d-for-openbsd >> > OpenBSD wou

Re: Proposal: user defined attributes

2012-03-16 Thread Steven Schveighoffer
On Fri, 16 Mar 2012 14:33:37 -0400, Adam D. Ruppe wrote: On Friday, 16 March 2012 at 18:07:18 UTC, Steven Schveighoffer wrote: Quote from TDPL (section 5.9.1 on page 156): Huh. There's nothing I can see in the compiler that even hints at this. The @ thing is just another storage class as f

Re: Dynamic language

2012-03-16 Thread Simon
On 16/03/2012 02:28, Nick Sabalausky wrote: "James Miller" wrote in message news:mailman.733.1331853568.4860.digitalmar...@puremagic.com... I hate the fact that Flash games are created the way they are. For one, it's impenetrable to try and learn properly, I had so much trouble figuring out ho

Re: Multiple return values...

2012-03-16 Thread Simen Kjærås
On Fri, 16 Mar 2012 03:26:55 +0100, Andrei Alexandrescu wrote: I think this is a reasonable request: (auto a, b) = fun(); ---> static assert(fun().length == 2); auto __t = fun(); auto a = __t[0]; auto b = __t[1]; That would be nice. As was mentioned in a later post, this works for stat

Re: Unified toHash() for all native types

2012-03-16 Thread H. S. Teoh
On Thu, Mar 15, 2012 at 04:55:09PM -0700, H. S. Teoh wrote: > I'm working on making AA literals work with my new AA implementation, > and ran into a major roadblock with using CTFE to compute AA literals: > currently built-in types like arrays require TypeInfo in order to > compute the hash, but Ty

Re: "Improve this page"

2012-03-16 Thread Simon
On 16/03/2012 04:27, James Miller wrote: On 16 March 2012 17:14, Brad Anderson wrote: I have a pending pull request which adds an "Improve this page" button to the upper right corner all pages on the website. From t

Re: OpenBSD port of dmd?

2012-03-16 Thread Walter Bright
On 3/16/2012 7:53 AM, Andrei Alexandrescu wrote: Just found this, has anyone tried dmd or friends on OpenBSD? http://stackoverflow.com/questions/9698581/programming-in-d-for-openbsd There was a start on an OpenBSD port, but it hasn't progressed very far. It shouldn't be hard - if someone want

Re: Interesting Memory Optimization

2012-03-16 Thread Xinok
On Friday, 16 March 2012 at 18:56:00 UTC, Timon Gehr wrote: It can't because there must be a terminating zero byte. It does not do it even if it could though. immutable string x = "123"; immutable string y = "123"; void foo(string a){ string b = "123"; writeln(a is b); } void

Re: Interesting Memory Optimization

2012-03-16 Thread Timon Gehr
On 03/16/2012 07:52 PM, Xinok wrote: On Friday, 16 March 2012 at 18:44:53 UTC, Xinok wrote: On Friday, 16 March 2012 at 15:41:32 UTC, Timon Gehr wrote: On 03/16/2012 03:28 PM, H. S. Teoh wrote: More to the point, does dmd perform this optimization currently? T No. immutable string a = "1

Re: Interesting Memory Optimization

2012-03-16 Thread Adam D. Ruppe
On Friday, 16 March 2012 at 18:44:53 UTC, Xinok wrote: It actually does, but only identical strings. It doesn't seem to do strings within strings. Don't forget that "123" is /not/ a substring of "123456" because of the invisible 0 terminator (which is there for easy compatibility with C functio

Re: Interesting Memory Optimization

2012-03-16 Thread Xinok
On Friday, 16 March 2012 at 18:44:53 UTC, Xinok wrote: On Friday, 16 March 2012 at 15:41:32 UTC, Timon Gehr wrote: On 03/16/2012 03:28 PM, H. S. Teoh wrote: More to the point, does dmd perform this optimization currently? T No. immutable string a = "123"; immutable string b = a; void ma

Re: Interesting Memory Optimization

2012-03-16 Thread Xinok
On Friday, 16 March 2012 at 15:41:32 UTC, Timon Gehr wrote: On 03/16/2012 03:28 PM, H. S. Teoh wrote: More to the point, does dmd perform this optimization currently? T No. immutable string a = "123"; immutable string b = a; void main(){writeln(a.ptr is b.ptr);} // "false" It actually

Re: Proposal: user defined attributes

2012-03-16 Thread Adam D. Ruppe
On Friday, 16 March 2012 at 18:07:18 UTC, Steven Schveighoffer wrote: Quote from TDPL (section 5.9.1 on page 156): Huh. There's nothing I can see in the compiler that even hints at this. The @ thing is just another storage class as far as it's concerned right now. Nor do I see a huge number of

Re: Proposal: user defined attributes

2012-03-16 Thread Andrej Mitrovic
On 3/16/12, Adam D. Ruppe wrote: > The current language solution isn't really *bad* with enough > library help, but it isn't particularly *good* either and I > don't think it can be. I've tried a few things, and I still > see the lack of user annotations as D's biggest miss right now. Yeah, but I

Re: Proposal: user defined attributes

2012-03-16 Thread Steven Schveighoffer
On Fri, 16 Mar 2012 13:36:42 -0400, Adam D. Ruppe wrote: On Friday, 16 March 2012 at 16:57:26 UTC, Steven Schveighoffer wrote: I thought @ was supposed to be a user-defined annotation. Otherwise, why did we introduce @syntax? idk, to "reduce" the number of keywords or somethiny. Quote

Re: Multiple return values...

2012-03-16 Thread Manu
On 16 March 2012 19:53, Timon Gehr wrote: > On 03/16/2012 06:33 PM, Manu wrote: > >> On 16 March 2012 18:37, Andrei Alexandrescu >> > > >> >> >> wrote: >> >>Actually, as has been mentioned, swizzling can be done very nicely >>inside the language. >

Re: Multiple return values...

2012-03-16 Thread Timon Gehr
On 03/16/2012 06:33 PM, Manu wrote: On 16 March 2012 18:37, Andrei Alexandrescu mailto:seewebsiteforem...@erdani.org>> wrote: Actually, as has been mentioned, swizzling can be done very nicely inside the language. How? Use opDispatch. a = a.yxwz; The only example I saw in this thr

Re: Changing the name of the language?

2012-03-16 Thread Manu
On 16 March 2012 03:23, ixid wrote: > D is a very poor name for a language. I appreciate it's late in the day > for this and that it has probably been discussed before (not that I could > find such a discussion with Google which relates to my point). Although the > results for D are fine when goo

Scala macros

2012-03-16 Thread bearophile
There are plans of adding macros to Scala language, and I think they are already partially implemented: https://docs.google.com/document/d/1O879Iz-567FzVb8kw6N5OBpei9dnbW0ZaT7-XNSa6Cs/edit?hl=en_US >From the article: << Here is a prototypical macro definition: def m(x: T): R = macro implR

Re: Multiple return values...

2012-03-16 Thread Manu
On 16 March 2012 19:13, Iain Buclaw wrote: > On 16 March 2012 16:53, Andrei Alexandrescu > wrote: > > On 3/16/12 11:50 AM, Iain Buclaw wrote: > >> > >> If you were to forget all about MRV for a brief moment, the change > >> request being proposed here is to return *all* structures (including > >

Thrift bindings for D review?

2012-03-16 Thread Andrei Alexandrescu
David Nadlinger's GSoC 2011 code is now pending acceptance in Apache Thrift: https://issues.apache.org/jira/browse/THRIFT-1500 A couple of people at Facebook and Apache have looked at it, but the reviews of a few more people who know D would be useful. I'll try to make the time to give it a th

Re: Proposal: user defined attributes

2012-03-16 Thread Adam D. Ruppe
On Friday, 16 March 2012 at 16:57:26 UTC, Steven Schveighoffer wrote: I thought @ was supposed to be a user-defined annotation. Otherwise, why did we introduce @syntax? idk, to "reduce" the number of keywords or somethiny. This is why I call it a mistake or missed opportunity right now though

Re: Multiple return values...

2012-03-16 Thread Manu
On 16 March 2012 18:53, Andrei Alexandrescu wrote: > On 3/16/12 11:50 AM, Iain Buclaw wrote: > >> If you were to forget all about MRV for a brief moment, the change >> request being proposed here is to return *all* structures (including >> delegates, complex types and vectors) in registers if at a

Re: OpenBSD port of dmd?

2012-03-16 Thread Paulo Pinto
Am 16.03.2012 15:53, schrieb Andrei Alexandrescu: Just found this, has anyone tried dmd or friends on OpenBSD? http://stackoverflow.com/questions/9698581/programming-in-d-for-openbsd Thanks, Andrei It is a bit off-topic, but I have started to look at a possible port to Minix 3.2.0, which

Re: Multiple return values...

2012-03-16 Thread Manu
On 16 March 2012 18:37, Andrei Alexandrescu wrote: > Actually, as has been mentioned, swizzling can be done very nicely inside > the language. > How? The only example I saw in this thread was your from()/to() approach, which Timon said didn't actually work...? On 3/16/12 6:29 AM, Manu wrote: >

Re: Multiple return values...

2012-03-16 Thread Iain Buclaw
On 16 March 2012 16:53, Andrei Alexandrescu wrote: > On 3/16/12 11:50 AM, Iain Buclaw wrote: >> >> If you were to forget all about MRV for a brief moment, the change >> request being proposed here is to return *all* structures (including >> delegates, complex types and vectors) in registers if at

Re: Changing the name of the language?

2012-03-16 Thread Steven Schveighoffer
On Thu, 15 Mar 2012 22:42:15 -0400, Andrej Mitrovic wrote: On 16-03-2012 03:17, ixid wrote: Do you think a minor renaming like using Dlang as the name consistently would be damaging? But what about all those people who have D tattooed on their necks? D is awesome. De. Just add lang.

Re: Standalone AA implementation ready for review (Was: Re:

2012-03-16 Thread H. S. Teoh
On Fri, Mar 16, 2012 at 08:25:08AM -0400, bearophile wrote: > H. S. Teoh: > > > Alright, I've made a preliminary implementation of AA literals as a > > function that constructs an AA given an array of keys and and an array > > of values (just like the current aaA.d implementation). > > See also:

Re: Proposal: user defined attributes

2012-03-16 Thread Steven Schveighoffer
On Fri, 16 Mar 2012 09:35:54 -0400, Adam D. Ruppe wrote: On the ride over here today, I had a thought that I think neatly solves the user defined attribute question. enum Serializable { yes, no } @note(Serializable.yes) int a; I thought @ was supposed to be a user-defined annotation. O

Re: Multiple return values...

2012-03-16 Thread Andrei Alexandrescu
On 3/16/12 11:50 AM, Iain Buclaw wrote: If you were to forget all about MRV for a brief moment, the change request being proposed here is to return *all* structures (including delegates, complex types and vectors) in registers if at all possible even if the underlying ABI default is to return it

Re: Multiple return values...

2012-03-16 Thread Andrei Alexandrescu
On 3/16/12 3:48 AM, Iain Buclaw wrote: This could also be done for arrays too. (int a, b) = arr[]; -> static assert(arr.length == 2); int a = arr[0]; int b = arr[1]; Yah, the rewrite is purely syntactic, not tuple-specific. That's a major thing I like about it. Or possibly a use in v

Re: Multiple return values...

2012-03-16 Thread Iain Buclaw
On 16 March 2012 16:37, Andrei Alexandrescu wrote: > On 3/16/12 6:29 AM, Manu wrote: >> >> On 16 March 2012 04:26, Andrei Alexandrescu >> mailto:seewebsiteforem...@erdani.org>> >> >> wrote: >> >>        A good design should strive to provide general features instead of >>        special cases (E.g

Re: Multiple return values...

2012-03-16 Thread Andrei Alexandrescu
On 3/16/12 6:29 AM, Manu wrote: On 16 March 2012 04:26, Andrei Alexandrescu mailto:seewebsiteforem...@erdani.org>> wrote: A good design should strive to provide general features instead of special cases (E.g. swap is limited to the 2-tuple case). Also, why force an overhe

Re: Proposal: user defined attributes

2012-03-16 Thread Adam D. Ruppe
On Friday, 16 March 2012 at 16:09:55 UTC, Andrei Alexandrescu wrote: I wonder to what extent the in-language solution can be made to work. It can sort of work, but it isn't very good. (I thought you might say this too; check out this post: http://forum.dlang.org/thread/bccwycoexxykfgxve...@for

Re: Proposal: user defined attributes

2012-03-16 Thread Andrei Alexandrescu
On 3/16/12 8:35 AM, Adam D. Ruppe wrote: enum Serializable { yes, no } @note(Serializable.yes) int a; [...] foreach(i, exp; __traits(getNotes, a)) { static assert(is(typeof(exp) == Serializable); static assert(exp == Serializable.yes); } So we have: class A { @note(Serializable.yes) int

Re: Interesting Memory Optimization

2012-03-16 Thread Timon Gehr
On 03/16/2012 03:28 PM, H. S. Teoh wrote: On Fri, Mar 16, 2012 at 08:24:34AM -0400, Kevin Cox wrote: [...] And the previous examples were language agnostic. In D and other languages where the length of a string is stored we can nest strings anywhere inside other strings. const char[] a = "foof

Re: OpenBSD port of dmd?

2012-03-16 Thread Martin Nowak
On Fri, 16 Mar 2012 15:53:45 +0100, Andrei Alexandrescu wrote: Just found this, has anyone tried dmd or friends on OpenBSD? http://stackoverflow.com/questions/9698581/programming-in-d-for-openbsd OpenBSD would need some druntime work.

Re: Interesting Memory Optimization

2012-03-16 Thread Jakob Ovrum
On Friday, 16 March 2012 at 12:24:45 UTC, Kevin Cox wrote: On Mar 16, 2012 7:45 AM, "Alex Rønne Petersen" wrote I don't see any reason why c couldn't point to element number 3 of b, and have its length set to 3... -- - Alex And the previous examples were language agnostic. In D and oth

Re: Proposal: user defined attributes

2012-03-16 Thread Piotr Szturmaj
Adam D. Ruppe wrote: On the ride over here today, I had a thought that I think neatly solves the user defined attribute question. enum Serializable { yes, no } @note(Serializable.yes) int a; This is just enum. If you use struct or class attributes (like in C#) then direct @Struct(constructor

Re: Proposal: user defined attributes

2012-03-16 Thread Manu
On 16 March 2012 17:14, Adam D. Ruppe wrote: > On Friday, 16 March 2012 at 15:10:06 UTC, Manu wrote: > >> Interesting approach, how will that affect 'thing's type? >> > > It will strictly be myAttribute!int, but alias this > means that you can pass it anywhere an int is expected > too (and assign

Re: Proposal: user defined attributes

2012-03-16 Thread Adam D. Ruppe
On Friday, 16 March 2012 at 15:10:06 UTC, Manu wrote: Interesting approach, how will that affect 'thing's type? It will strictly be myAttribute!int, but alias this means that you can pass it anywhere an int is expected too (and assign ints to it all the same). Check it: void cool(int a) {} vo

Re: Proposal: user defined attributes

2012-03-16 Thread Adam D. Ruppe
Another argument against would be "can we do this in the language today?" And the answer is "sort of, but not really": void a(@note(...) int arg) {} You could perhaps do something like: void a(int arg) {} mixin("enum " ~ a.mangleof ~ "_arg = " ~ ...); and then get the listing by looking at a

Re: Proposal: user defined attributes

2012-03-16 Thread Manu
On 16 March 2012 16:51, Adam D. Ruppe wrote: > On Friday, 16 March 2012 at 14:11:35 UTC, Manu wrote: > >> Surely the term you're looking for here is @annotate(...) ? >> > > Meh, I don't care that much about names. I went > with "note" anticipating people would complain about > @add_user_defined_a

Re: Proposal: user defined attributes

2012-03-16 Thread Adam D. Ruppe
On Friday, 16 March 2012 at 14:11:35 UTC, Manu wrote: Surely the term you're looking for here is @annotate(...) ? Meh, I don't care that much about names. I went with "note" anticipating people would complain about @add_user_defined_attribute() being too long :) What if you want to annotate

Re: Ideas for Phobos., u++ STL speed comparison

2012-03-16 Thread Andrei Alexandrescu
On 3/16/12 8:39 AM, Jay Norwood wrote: On Friday, 16 March 2012 at 13:20:39 UTC, Jay Norwood wrote: btw, the u++ page claims in the link below to be faster than D by 70% on some operations, which they attribute to their STL rewrite. Maybe someone should take a look at what they've done. Or maybe

Re: Interesting Memory Optimization

2012-03-16 Thread H. S. Teoh
On Fri, Mar 16, 2012 at 08:24:34AM -0400, Kevin Cox wrote: [...] > And the previous examples were language agnostic. In D and other > languages where the length of a string is stored we can nest strings > anywhere inside other strings. > > const char[] a = "foofoo"; > const char[] b = "oof"; > >

  1   2   >