Re: Anonymous function syntax

2011-09-22 Thread Jacob Carlborg
On 2011-09-22 22:54, Andrei Alexandrescu wrote: On 9/21/11 5:17 PM, Walter Bright wrote: I've collected a few from various languages for comparison: [snip] I think we should do the following: 1. Introduce a new token "=>" 2. Add this rewrite to the grammar: symbol => expression translates

Re: Anonymous function syntax

2011-09-22 Thread Jacob Carlborg
On 2011-09-22 23:08, bearophile wrote: Andrei Alexandrescu: A function literal should be comparable to another for equality. Are you willing to explain me why, and show an use case? Bye, bearophile When using lambdas as event handlers: class Foo { event[] events; void registerEve

Re: Anonymous function syntax

2011-09-22 Thread Daniel Murphy
"Jacob Carlborg" wrote in message news:j5h98l$ors$1...@digitalmars.com... > What I'm saying is that you can ignore the returned value of a delegate > therefore I think it should be possible implicitly convert a delegate > returning a value, to a delegate returning void. The same for function >

Re: Anonymous function syntax

2011-09-22 Thread Jacob Carlborg
On 2011-09-22 23:46, Walter Bright wrote: On 9/22/2011 1:13 PM, Jacob Carlborg wrote: I function/delegate that returns a value should be implicitly converted to a function/delegate that returns void. That doesn't work in some cases - consider a function that returns an object that the caller

Re: Anonymous function syntax

2011-09-22 Thread bearophile
Robert Jacques: > What I worry about though is variable hijacking rules. e.g. > > auto b = 5; > reduce!\a+b(map!\a+b([1,2,3,4)); Right, it's a bit too much magical and inflexible for my taste. bye, bearophile

Re: thoughts on immutability in D

2011-09-22 Thread Walter Bright
On 9/22/2011 4:39 AM, bearophile wrote: Walter: You're right. Logical const is only a convention, since it cannot be enforced by the compiler. Even if it can't be enforced in 100% of the cases, I think it's still useful. So you need to look at the situation from a bit wider point of view. I

Re: Dangling Else, Yet Again

2011-09-22 Thread Nick Sabalausky
"Andrei Alexandrescu" wrote in message news:j5gv0j$825$1...@digitalmars.com... > http://www.reddit.com/r/programming/comments/kooiy/dangling_else_yet_again/ > > Andrei "It works by keeping track of any lexically enclosing statement that is looking for an else clause, so if an else clause is fou

Re: Anonymous function syntax

2011-09-22 Thread Robert Jacques
On Thu, 22 Sep 2011 18:59:31 -0400, Jason House wrote: std.algorithm already introduces a sort of lambda syntax... map!"a+b"(...) or map!q{a+b}(...) If D is looking for its own style of short lambda, maybe implicit use of a and b could be extended. Candidates: a+b {a+b} f{a+b} auto{a+b} auto

Re: Formal Review of region allocator begins

2011-09-22 Thread Jonathan M Davis
Okay. The review period for the region allocator is over (actually, it was over about 2 days ago, but I've been busy and forgot to post about it). So, the question is: Is it ready for a vote, or does it need further revision and review? Looking over the thread, it's not at all clear to me that

Re: __restrict, architecture intrinsics vs asm, consoles, and other

2011-09-22 Thread Andrei Alexandrescu
On 9/22/11 9:11 PM, so wrote: On Fri, 23 Sep 2011 02:40:11 +0300, Andrei Alexandrescu wrote: On 9/22/11 6:00 PM, so wrote: On Thu, 22 Sep 2011 17:07:25 +0300, Andrei Alexandrescu wrote: I think we should put swizzle in std.numeric once and for all. Is anyone interested in taking up that ta

Dangling Else, Yet Again

2011-09-22 Thread Andrei Alexandrescu
http://www.reddit.com/r/programming/comments/kooiy/dangling_else_yet_again/ Andrei

Re: __restrict, architecture intrinsics vs asm, consoles, and other

2011-09-22 Thread so
On Fri, 23 Sep 2011 02:40:11 +0300, Andrei Alexandrescu wrote: On 9/22/11 6:00 PM, so wrote: On Thu, 22 Sep 2011 17:07:25 +0300, Andrei Alexandrescu wrote: I think we should put swizzle in std.numeric once and for all. Is anyone interested in taking up that task? You mean some helper fu

Re: Anonymous function syntax

2011-09-22 Thread hhaammaadd
On 09/22/2011 01:17 AM, Walter Bright wrote: I've collected a few from various languages for comparison: D (a,b) { return a + b; } I prefer to make "return" optional as the argument type

Rewrite rules [Was: Re: The Strange Loop conference]

2011-09-22 Thread bearophile
Timon Gehr: > Furthermore, DMD does not do any advanced optimizations In Haskell there are ways to add library-defined optimizations, with rewrite rules: http://www.haskell.org/haskellwiki/Playing_by_the_rules http://www.haskell.org/haskellwiki/GHC/Using_rules There are also papers about this.

Re: The Strange Loop conference

2011-09-22 Thread Sean Kelly
You might wan to play with GC.reserve. Sent from my iPhone On Sep 22, 2011, at 4:35 PM, Timon Gehr wrote: > On 09/22/2011 02:29 PM, Christophe wrote: >> "Nick Sabalausky" , dans le message (digitalmars.D:145002), a écrit : For example, in Haskell, map (correctly) has the signature:

Re: Anonymous function syntax

2011-09-22 Thread Timon Gehr
On 09/22/2011 11:46 PM, Walter Bright wrote: On 9/22/2011 1:13 PM, Jacob Carlborg wrote: I function/delegate that returns a value should be implicitly converted to a function/delegate that returns void. That doesn't work in some cases - consider a function that returns an object that the call

Re: __restrict, architecture intrinsics vs asm, consoles, and other

2011-09-22 Thread Andrei Alexandrescu
On 9/22/11 6:00 PM, so wrote: On Thu, 22 Sep 2011 17:07:25 +0300, Andrei Alexandrescu wrote: I think we should put swizzle in std.numeric once and for all. Is anyone interested in taking up that task? You mean some helper functions to be used in user structures? I was thinking of a templat

Re: The Strange Loop conference

2011-09-22 Thread Timon Gehr
On 09/22/2011 02:29 PM, Christophe wrote: "Nick Sabalausky" , dans le message (digitalmars.D:145002), a écrit : For example, in Haskell, map (correctly) has the signature: map :: (a -> b) -> [a] -> [b] but in D, std.map has the signature (expressed in some Haskell/D pseudocode) map :: (a -

Re: __restrict, architecture intrinsics vs asm, consoles, and other

2011-09-22 Thread so
On Fri, 23 Sep 2011 02:00:50 +0300, so wrote: It refuses to except a few things which i think it should. accept...

Re: __restrict, architecture intrinsics vs asm, consoles, and other

2011-09-22 Thread so
On Thu, 22 Sep 2011 17:07:25 +0300, Andrei Alexandrescu wrote: I think we should put swizzle in std.numeric once and for all. Is anyone interested in taking up that task? You mean some helper functions to be used in user structures? Because i don't know of any structure in std.numerics t

Re: Anonymous function syntax

2011-09-22 Thread Jason House
std.algorithm already introduces a sort of lambda syntax... map!"a+b"(...) or map!q{a+b}(...) If D is looking for its own style of short lambda, maybe implicit use of a and b could be extended. Candidates: a+b {a+b} f{a+b} auto{a+b} auto a+b Personally, I like the 2nd or 3rd one. The second is v

Re: Anonymous function syntax

2011-09-22 Thread Andrei Alexandrescu
On 09/22/11 16:08, bearophile wrote: Andrei Alexandrescu: A function literal should be comparable to another for equality. Are you willing to explain me why, and show an use case? An important application is optimizing for specific lambdas (e.g. equality). For example, a substring search u

Re: Anonymous function syntax

2011-09-22 Thread Jonathan M Davis
On Thursday, September 22, 2011 14:47 Andrei Alexandrescu wrote: > On 9/22/11 4:13 PM, dsimcha wrote: > > I'd much rather see the bugs in the current lambda syntax get fixed (e.g. > > http://d.puremagic.com/issues/show_bug.cgi?id=4724) rather than spend > > more time bikeshedding. > > That's not a

Re: Anonymous function syntax

2011-09-22 Thread Andrei Alexandrescu
On 9/22/11 4:13 PM, dsimcha wrote: I'd much rather see the bugs in the current lambda syntax get fixed (e.g. http://d.puremagic.com/issues/show_bug.cgi?id=4724) rather than spend more time bikeshedding. That's not an either-or choice, and of course improving current lambdas (btw that's not a p

Re: Anonymous function syntax

2011-09-22 Thread Walter Bright
On 9/22/2011 1:13 PM, Jacob Carlborg wrote: I function/delegate that returns a value should be implicitly converted to a function/delegate that returns void. That doesn't work in some cases - consider a function that returns an object that the caller must destruct. Or even just returns a stru

Re: Anonymous function syntax

2011-09-22 Thread Walter Bright
On 9/22/2011 2:03 PM, Steven Schveighoffer wrote: On Thu, 22 Sep 2011 16:54:55 -0400, Andrei Alexandrescu wrote: 4. Add this rewrite to the grammar: (comma_separated_parms) => expression translates to (comma_separated_parms) => expression Am I missing something here? I like easy rewrit

Re: Anonymous function syntax

2011-09-22 Thread Cristi Cobzarenco
--- Cristi Cobzarenco BSc in Artificial Intelligence and Computer Science University of Edinburgh Profile: http://www.google.com/profiles/cristi.cobzarenco On 22 September 2011 22:03, Steven Schveighoffer wrote: > On Thu, 22 Sep 2011 16:54:55 -0400, Andrei Alexandrescu > wrote: > > >> 4. Add t

Re: Anonymous function syntax

2011-09-22 Thread Andrei Alexandrescu
On 9/22/11 4:03 PM, Steven Schveighoffer wrote: On Thu, 22 Sep 2011 16:54:55 -0400, Andrei Alexandrescu wrote: 4. Add this rewrite to the grammar: (comma_separated_parms) => expression translates to (comma_separated_parms) => expression Am I missing something here? I am. The rewrite sh

Re: Fast 2D matrix of bits

2011-09-22 Thread bearophile
Denis Shelomovskij: > Is it? Every conditional branch can break CPU command queue and slow > down execution. Anyway, I saw same problem not far-away (2^n sized > OpenGL textures). Hours ago Don has written a comment in one of my enhancement requests that is related to this topic: http://d.pure

Re: The Strange Loop conference

2011-09-22 Thread bearophile
Andrei Alexandrescu: I have missed to answer a small part: > On 9/21/11 5:22 PM, bearophile wrote: > > This is why I have asked for functions like amap/afilter in Phobos, > > because in many situations in D you need an array instead of a lazy > > range. > > I don't think that was being asked. I

Re: Anonymous function syntax

2011-09-22 Thread dsimcha
I'd much rather see the bugs in the current lambda syntax get fixed (e.g. http://d.puremagic.com/issues/show_bug.cgi?id=4724) rather than spend more time bikeshedding. == Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s article > On 9/21/11 5:17 PM, Walter Bright wrote: > > I've co

Re: Anonymous function syntax

2011-09-22 Thread bearophile
Andrei Alexandrescu: > A function literal should be comparable to another for equality. Are you willing to explain me why, and show an use case? Bye, bearophile

Re: Anonymous function syntax

2011-09-22 Thread Steven Schveighoffer
On Thu, 22 Sep 2011 16:54:55 -0400, Andrei Alexandrescu wrote: 4. Add this rewrite to the grammar: (comma_separated_parms) => expression translates to (comma_separated_parms) => expression Am I missing something here? -Steve

Re: Anonymous function syntax

2011-09-22 Thread Andrei Alexandrescu
On 9/22/11 3:54 PM, Andrei Alexandrescu wrote: On 9/21/11 5:17 PM, Walter Bright wrote: I've collected a few from various languages for comparison: [snip] I think we should do the following: [snip] I can't believe I forgot an all-important aspect. A function literal should be comparable to

Re: Anonymous function syntax

2011-09-22 Thread Andrei Alexandrescu
On 9/21/11 5:17 PM, Walter Bright wrote: I've collected a few from various languages for comparison: [snip] I think we should do the following: 1. Introduce a new token "=>" 2. Add this rewrite to the grammar: symbol => expression translates to (symbol) { return expression; } 3. Add this

Re: 64 bit version?

2011-09-22 Thread Trass3r
or ldc, I thought that could also compile d2 LLVM still doesn't support SEH, though it's being worked on.

Re: Anonymous function syntax

2011-09-22 Thread Jacob Carlborg
On 2011-09-22 18:06, Andrei Alexandrescu wrote: On 9/22/11 10:42 AM, pillsy wrote: == Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s article On 9/22/11 1:47 AM, Max Klyga wrote: Actually Scala doesn't need type declarations in labmda literals. Most of the time argument types

Re: Anonymous function syntax

2011-09-22 Thread Lutger Blijdestijn
Andrei Alexandrescu wrote: > On 9/22/11 10:42 AM, pillsy wrote: >> == Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s >> article >>> On 9/22/11 1:47 AM, Max Klyga wrote: Actually Scala doesn't need type declarations in labmda literals. Most of the time argument types are

Re: 64 bit version?

2011-09-22 Thread maarten van damme
or ldc, I thought that could also compile d2 2011/9/22 Trass3r > Currently you have to use GDC. >

Re: 64 bit version?

2011-09-22 Thread Trass3r
Currently you have to use GDC.

dmd - AST dump.

2011-09-22 Thread Alexey Veselovsky
Is it posiible to dump AST for given D source file (like "clang++ -cc1 -ast-dump myCoolSrc.cpp", for example)?

Re: 64 bit version?

2011-09-22 Thread Jonathan M Davis
On Thursday, September 22, 2011 19:38:25 mok-kong shen wrote: > I just read that D fits nicely to the 64-bit architecture. Is there > currently a D compiler that fully exploits the 64-bit hardware under > Windows 7? I mean e.g. one can have operations in D on unsigned long int of > 64 bits size tha

64 bit version?

2011-09-22 Thread mok-kong shen
I just read that D fits nicely to the 64-bit architecture. Is there currently a D compiler that fully exploits the 64-bit hardware under Windows 7? I mean e.g. one can have operations in D on unsigned long int of 64 bits size that correspond directly to hardware operations so as to achieve high eff

Re: Paradox about D's popularity.

2011-09-22 Thread Peter Alexander
On 21/09/11 6:41 PM, bearophile wrote: Gor Gyolchanyan: I'm ready to donate money to sponsor an ad campaign. Advertising has to be done at the right time and rhythm. Too little and no one knows you, too much and you risk wasting the single opportunity certain persons will give you. D doesn'

Re: Anonymous function syntax

2011-09-22 Thread Walter Bright
On 9/22/2011 9:06 AM, Andrei Alexandrescu wrote: On 9/22/11 10:42 AM, pillsy wrote: _1 + _2 I'm not exactly a D template metaprogramming pro, but I think this would work for a lot of common cases. Such an approach has caused more trouble than benefits in C++. Besides just looking awfully ha

Re: Anonymous function syntax

2011-09-22 Thread Walter Bright
On 9/22/2011 4:36 AM, Timon Gehr wrote: Indeed, but it currently only works if the delegate literal is a template parameter, in which case the literal is actually fully generic, right? It gets internally rewritten into being a template function.

Re: __restrict, architecture intrinsics vs asm, consoles, and other

2011-09-22 Thread Walter Bright
On 9/22/2011 5:11 AM, a wrote: It also seems that the compiler doesn't inline functions containing asm. That's correct, it currently does not.

Re: __restrict, architecture intrinsics vs asm, consoles, and other

2011-09-22 Thread Marco Leise
Am 22.09.2011, 19:26 Uhr, schrieb Peter Alexander : On 22/09/11 7:39 AM, Don wrote: On 22.09.2011 05:24, a wrote: How would one do something like this without intrinsics (the code is c++ using gcc vector extensions): [snip] At present, you can't do it without ultimately resorting to inline

Re: The Strange Loop conference

2011-09-22 Thread Dmitry Olshansky
On 22.09.2011 1:53, Timon Gehr wrote: On 09/21/2011 11:11 PM, Andrei Alexandrescu wrote: On 9/21/11 3:34 PM, Peter Alexander wrote: What if foo is a virtual member function? Those can't be templates. Then it would need to take a dynamic Range as parameter, parameterized with the element type.

Re: Anonymous function syntax

2011-09-22 Thread pillsy
== Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s article > On 9/22/11 10:42 AM, pillsy wrote: > > == Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s article [...] > >> Already does. We're looking for a briefer syntax. > > What is the problem with just inferring

Re: __restrict, architecture intrinsics vs asm, consoles, and other stuff

2011-09-22 Thread Peter Alexander
On 22/09/11 1:38 AM, Walter Bright wrote: D doesn't have __restrict. I'm going to argue that it is unnecessary. AFAIK, __restrict is most used in writing vector operations. D, on the other hand, has a dedicated vector operation syntax: a[] += b[] * c; where a[] and b[] are required to not be ov

Re: Why do we have transitive const, again?

2011-09-22 Thread Peter Alexander
On 21/09/11 6:15 PM, Mehrdad wrote: I can't find the thread, but I remember someone (bearophile?) mentioned that the reason we have transitive const is to support purity. I don't think I understand why this is necessary, though -- could someone please explain why we have transitive const, and wh

Re: __restrict, architecture intrinsics vs asm, consoles, and other

2011-09-22 Thread Peter Alexander
On 22/09/11 7:39 AM, Don wrote: On 22.09.2011 05:24, a wrote: How would one do something like this without intrinsics (the code is c++ using gcc vector extensions): [snip] At present, you can't do it without ultimately resorting to inline asm. But, what we've done is to move SIMD into the mach

Re: Anonymous function syntax

2011-09-22 Thread Jesse Phillips
Jacob Carlborg Wrote: > * Inferred parameter types > * Automatically return the last expression > * No need for ending with a semicolon > * One line lambdas can omit the braces > > Note that Scala can infer the parameter types. > > An additional question, do we want/need a new syntax for declari

Re: thoughts on immutability in D

2011-09-22 Thread Peter Alexander
On 22/09/11 1:34 PM, Vladimir Panteleev wrote: On Thu, 22 Sep 2011 11:02:27 +0300, Peter Alexander wrote: Thanks for the reddit'ing. I launched up google analytics this morning and noticed a sudden spike. That could only mean one thing :-) I tried adding your blog to Planet D, but I can't fi

Re: Anonymous function syntax

2011-09-22 Thread bearophile
Andrei Alexandrescu: > Yes :o). http://d.puremagic.com/issues/show_bug.cgi?id=6714 Thank you for adding it, and sorry for not filing it myself in past. Bye, bearophile

Re: thoughts on immutability in D

2011-09-22 Thread Peter Alexander
On 22/09/11 12:39 PM, bearophile wrote: Andrei Alexandrescu: The initial submission got junked so I resubmitted: http://www.reddit.com/r/programming/comments/knn5p/thoughts_on_immutability_in_d/ A logical const can coexist beside the other two (three) kinds of const of D. For simplicity I u

Re: Type tuple of all constructors?

2011-09-22 Thread Jakob Ovrum
On 2011/09/23 1:11, Benjamin Thaut wrote: Is there a way to get a type tuple of all aviable constructors in a class? class Test { public: this(Foo foo){ m_foo = foo; } this(bool flop){ } this(int x, int y){ } } For this class I would expect something like ((Foo),(bool),(int,int)) $ cat test

Re: Paradox about D's popularity.

2011-09-22 Thread Adam D. Ruppe
I'm thinking the best way to translate C headers is to run it through a string processor instead of a compiler. There's some places where I want the compiler - especially figuring out the values of some constants - but usually, when translating C headers, I just copy/paste and find/replace.

Type tuple of all constructors?

2011-09-22 Thread Benjamin Thaut
Is there a way to get a type tuple of all aviable constructors in a class? class Test { public: this(Foo foo){ m_foo = foo; } this(bool flop){ } this(int x, int y){ } } For this class I would expect something like ((Foo),(bool),(int,int)) -- Kind Regards Benjami

Re: Anonymous function syntax

2011-09-22 Thread Andrei Alexandrescu
On 9/22/11 10:42 AM, pillsy wrote: == Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s article On 9/22/11 1:47 AM, Max Klyga wrote: Actually Scala doesn't need type declarations in labmda literals. Most of the time argument types are infered. Already does. We're looking for a

Re: Paradox about D's popularity.

2011-09-22 Thread Sean Kelly
Ideally, you also want to simply convert #ifdefs to static ifs as well. It's details like this that have convinced me I can manually convert headers in less time than it takes me to manually post-process the result of an automatic translator. Sad. Sent from my iPhone On Sep 21, 2011, at 2:33

Re: Anonymous function syntax

2011-09-22 Thread pillsy
== Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s article > On 9/22/11 1:47 AM, Max Klyga wrote: > > Actually Scala doesn't need type declarations in labmda literals. Most > > of the time argument types are infered. > Already does. We're looking for a briefer syntax. What is the

Re: __restrict, architecture intrinsics vs asm, consoles, and other

2011-09-22 Thread Marco Leise
Am 22.09.2011, 08:39 Uhr, schrieb Don : On 22.09.2011 05:24, a wrote: How would one do something like this without intrinsics (the code is c++ using gcc vector extensions): [snip] At present, you can't do it without ultimately resorting to inline asm. But, what we've done is to move SIMD

Re: Go and generic programming on reddit, also touches on D

2011-09-22 Thread Robert Jacques
On Wed, 21 Sep 2011 16:02:53 -0400, Andrei Alexandrescu wrote: On 9/21/11 1:49 PM, Don wrote: On 19.09.2011 18:12, Andrei Alexandrescu wrote: On 9/19/11 10:46 AM, Robert Jacques wrote: So, on balance, I'd say the two pointers representation is categorically worse than the fat pointer represe

Re: Anonymous function syntax

2011-09-22 Thread Andrei Alexandrescu
On 9/22/11 9:17 AM, Jacob Carlborg wrote: void foo (int delegate (int, int) a){} void main () { foo((a, b) { return a +b;}); } Results in: main.d(48): Error: undefined identifier a main.d(48): Error: undefined identifier b main.d(48): Error: function main.foo (int delegate(int, int) a) is not

Re: Anonymous function syntax

2011-09-22 Thread Jacob Carlborg
On 2011-09-22 16:11, Andrei Alexandrescu wrote: On 9/22/11 3:49 AM, Jacob Carlborg wrote: On 2011-09-22 00:50, Andrei Alexandrescu wrote: On 9/21/11 5:29 PM, bearophile wrote: Walter Bright: D (a,b) { return a + b; } In D to define a true lambda you need types too: auto f = (int a,int b){

Re: Anonymous function syntax

2011-09-22 Thread Andrei Alexandrescu
On 9/22/11 3:49 AM, Jacob Carlborg wrote: On 2011-09-22 00:50, Andrei Alexandrescu wrote: On 9/21/11 5:29 PM, bearophile wrote: Walter Bright: D (a,b) { return a + b; } In D to define a true lambda you need types too: auto f = (int a,int b){ return a + b; }; No. Andrei void foo (int de

Re: thoughts on immutability in D

2011-09-22 Thread Andrei Alexandrescu
On 9/22/11 3:02 AM, Peter Alexander wrote: On 22/09/11 7:04 AM, Andrei Alexandrescu wrote: The initial submission got junked so I resubmitted: http://www.reddit.com/r/programming/comments/knn5p/thoughts_on_immutability_in_d/ Andrei Thanks for the reddit'ing. I launched up google analytics t

Re: Anonymous function syntax

2011-09-22 Thread Andrei Alexandrescu
On 9/22/11 1:47 AM, Max Klyga wrote: Actually Scala doesn't need type declarations in labmda literals. Most of the time argument types are infered. Already does. We're looking for a briefer syntax. Andrei

Re: __restrict, architecture intrinsics vs asm, consoles, and other

2011-09-22 Thread Andrei Alexandrescu
On 9/22/11 1:39 AM, Don wrote: On 22.09.2011 05:24, a wrote: How would one do something like this without intrinsics (the code is c++ using gcc vector extensions): [snip] At present, you can't do it without ultimately resorting to inline asm. But, what we've done is to move SIMD into the machi

Re: Anonymous function syntax

2011-09-22 Thread Andrei Alexandrescu
On 9/22/11 2:35 AM, Walter Bright wrote: On 9/21/2011 11:47 PM, Max Klyga wrote: It would be awesome if D infered argument types for labdas too. It does, and it is awesome! C++'s lambdas require the types to be present, which some consider a large mistake. Andrei

Re: __restrict, architecture intrinsics vs asm, consoles, and other stuff

2011-09-22 Thread Benjamin Thaut
== Auszug aus Walter Bright (newshou...@digitalmars.com)'s Artikel > On 9/21/2011 10:56 PM, Benjamin Thaut wrote: > > Even if I manually allocate v1,v2 and result, the temporary variable that > > the > > compiler uses to compute the expression might be unaligned. > > That is a total killer for SSE

Re: thoughts on immutability in D

2011-09-22 Thread Vladimir Panteleev
On Thu, 22 Sep 2011 11:02:27 +0300, Peter Alexander wrote: Thanks for the reddit'ing. I launched up google analytics this morning and noticed a sudden spike. That could only mean one thing :-) I tried adding your blog to Planet D, but I can't figure out how to get an RSS feed of the D catego

Re: The Strange Loop conference

2011-09-22 Thread Christophe
"Nick Sabalausky" , dans le message (digitalmars.D:145002), a écrit : >> For example, in Haskell, map (correctly) has the signature: >> >> map :: (a -> b) -> [a] -> [b] >> >> but in D, std.map has the signature (expressed in some Haskell/D >> pseudocode) >> >> map :: (a -> b) -> [a] -> Map!((a ->

Re: __restrict, architecture intrinsics vs asm, consoles, and other

2011-09-22 Thread a
> which compiles to a single shufps instruction. Doesn't it often require additional needless movaps instructions? For example, the following: asm { movaps XMM0, a; movaps XMM1, b; addps XMM0, XMM1; movaps a, XMM0; } asm { movaps XMM0, a; movaps XMM1, b; a

Re: Paradox about D's popularity.

2011-09-22 Thread Jacob Carlborg
On 2011-09-22 11:47, Regan Heath wrote: At one time (2+ years back) I started writing a C lexer, and then C preprocessor in D. In part to learn about how compilers work and in part to convert C headers to D (there was no .di at that stage) so I could interface C. The lexer was no trouble, I even

Re: Paradox about D's popularity.

2011-09-22 Thread deadalnix
Le 22/09/2011 12:31, Jonathan M Davis a écrit : On Thursday, September 22, 2011 11:15:23 Regan Heath wrote: as results speak louder than proposals I have found. It's often easy to come up with ideas. The hard part is implementing them, and in many cases, they need to be implemented to be shown

Re: thoughts on immutability in D

2011-09-22 Thread bearophile
Andrei Alexandrescu: > The initial submission got junked so I resubmitted: > > http://www.reddit.com/r/programming/comments/knn5p/thoughts_on_immutability_in_d/ A logical const can coexist beside the other two (three) kinds of const of D. For simplicity I use the "lconst" keyword. lconst works

Re: Anonymous function syntax

2011-09-22 Thread Timon Gehr
On 09/22/2011 09:35 AM, Walter Bright wrote: On 9/21/2011 11:47 PM, Max Klyga wrote: It would be awesome if D infered argument types for labdas too. It does, and it is awesome! Indeed, but it currently only works if the delegate literal is a template parameter, in which case the literal is

Re: D features

2011-09-22 Thread Marco Leise
Am 21.09.2011, 01:20 Uhr, schrieb Walter Bright : On 9/20/2011 2:28 PM, Jonathan M Davis wrote: On Tue, 20 Sep 2011 15:58:06 -0400, Rishat Galiulin 2) Why D not using functions exceptions specification list like Java? Checked exceptions have generally been determined to have been a bad ide

Re: The Strange Loop conference

2011-09-22 Thread Nick Sabalausky
"Peter Alexander" wrote in message news:j5dhe0$2ln6$1...@digitalmars.com... > > For example, in Haskell, map (correctly) has the signature: > > map :: (a -> b) -> [a] -> [b] > > but in D, std.map has the signature (expressed in some Haskell/D > pseudocode) > > map :: (a -> b) -> [a] -> Map!((a -

Re: Paradox about D's popularity.

2011-09-22 Thread Jonathan M Davis
On Thursday, September 22, 2011 11:15:23 Regan Heath wrote: > as results speak louder than proposals I have found. It's often easy to come up with ideas. The hard part is implementing them, and in many cases, they need to be implemented to be shown that they're viable and to iron them out. Also,

Re: Paradox about D's popularity.

2011-09-22 Thread Regan Heath
On Wed, 21 Sep 2011 22:01:04 +0100, Gor F. Gyolchanyan wrote: You're right. I gotta apologize for my over-reaction to D's problems. It's just, that i want it to thrive. Maybe i care too much and i make too bit a deal out of this. :-) Never appologise for enthusiasm! :) I had the same e

Re: Paradox about D's popularity.

2011-09-22 Thread Regan Heath
On Wed, 21 Sep 2011 22:33:06 +0100, Dmitry Olshansky wrote: On 22.09.2011 1:14, Gor F. Gyolchanyan wrote: I had an idea of a D library for including C headers for a while now. All i need is to make a compile-time C parser for that. This thing would literally remove any need for binding. T

Re: Anonymous function syntax

2011-09-22 Thread Jacob Carlborg
On 2011-09-22 08:47, Max Klyga wrote: Actually Scala doesn't need type declarations in labmda literals. Most of the time argument types are infered. It would be awesome if D infered argument types for labdas too. Also Java 8 adopted the same lambda syntax as Scala and C#. To add a few things to

Re: The Strange Loop conference

2011-09-22 Thread Jacob Carlborg
On 2011-09-21 22:20, Andrei Alexandrescu wrote: On 9/21/11 2:29 PM, Timon Gehr wrote: On 09/21/2011 06:55 PM, Andrei Alexandrescu wrote: I'm back from the Strange Loop conference. It's been an interesting experience. The audience was very diverse, with interest in everything functional (you'd o

Re: C compatibility module for phobos.

2011-09-22 Thread Jacob Carlborg
On 2011-09-21 21:02, Gor F. Gyolchanyan wrote: I didn't know about core.stdc package because it doesn't show u on dpl.org. The difference is, that some compilers make long 64 bit for 64-bit systems, and some leave the long 32-bit no matter what. core.stdc.config handles that. -- /Jacob Carlbo

Re: D's confusing strings (was Re: D on hackernews)

2011-09-22 Thread Christophe
"Jonathan M Davis" , dans le message (digitalmars.D:144962), a écrit : >> - char[], etc. being real arrays. > > Which is actually arguably a _bad_ thing, since it doesn't generally make > sense to operate on individual chars. What you really want 99.999% of > the time is code points not

Re: Anonymous function syntax

2011-09-22 Thread Jacob Carlborg
On 2011-09-22 00:17, Walter Bright wrote: I've collected a few from various languages for comparison: D (a,b) { return a + b; } Ruby ->(a,b) { a + b } C++0x [](int a, int b) { return a + b; } C# (a,b) => a + b Scala (a:Int, b:Int) => a + b Erlang fun(a, b) -> a + b end. Haskell \a b -> a +

Re: Anonymous function syntax

2011-09-22 Thread Jacob Carlborg
On 2011-09-22 00:50, Andrei Alexandrescu wrote: On 9/21/11 5:29 PM, bearophile wrote: Walter Bright: D (a,b) { return a + b; } In D to define a true lambda you need types too: auto f = (int a,int b){ return a + b; }; No. Andrei void foo (int delegate (int, int) a){} void main () {

Re: Anonymous function syntax

2011-09-22 Thread Christophe
Walter Bright , dans le message (digitalmars.D:144959), a écrit : > I've collected a few from various languages for comparison: > > D > (a,b) { return a + b; } Few ideas: (a,b){ a + b } Lambdas can avoid to type 'return'. returning void would be harder, except if to return void, you can ju

Re: Why do we have transitive const, again?

2011-09-22 Thread Jonathan M Davis
On Wednesday, September 21, 2011 10:15:31 Mehrdad wrote: > I can't find the thread, but I remember someone (bearophile?) mentioned > that the reason we have transitive const is to support purity. > > I don't think I understand why this is necessary, though -- could > someone please explain why we

Re: thoughts on immutability in D

2011-09-22 Thread Peter Alexander
On 22/09/11 7:04 AM, Andrei Alexandrescu wrote: The initial submission got junked so I resubmitted: http://www.reddit.com/r/programming/comments/knn5p/thoughts_on_immutability_in_d/ Andrei Thanks for the reddit'ing. I launched up google analytics this morning and noticed a sudden spike. That

Re: Anonymous function syntax

2011-09-22 Thread Rory McGuire
Perhaps bearofile refers to this: import std.stdio; string getit(alias runme)() { return runme("b","da"); } string getit2(string delegate(string,string) dg) { return dg("b", "da"); } void main() { writefln("this is a %s", getit!((a,b){ return "lam"~a~b; })()); /+

Re: Anonymous function syntax

2011-09-22 Thread Walter Bright
On 9/21/2011 11:47 PM, Max Klyga wrote: It would be awesome if D infered argument types for labdas too. It does, and it is awesome!

Re: Anonymous function syntax

2011-09-22 Thread Walter Bright
On 9/21/2011 8:10 PM, Jesse Phillips wrote: On Wed, 21 Sep 2011 18:29:34 -0400, bearophile wrote: Walter Bright: D (a,b) { return a + b; } In D to define a true lambda you need types too: auto f = (int a,int b){ return a + b; }; This is true of C# too and I think is appropriate to m

Re: __restrict, architecture intrinsics vs asm, consoles, and other stuff

2011-09-22 Thread Walter Bright
On 9/21/2011 10:56 PM, Benjamin Thaut wrote: Even if I manually allocate v1,v2 and result, the temporary variable that the compiler uses to compute the expression might be unaligned. That is a total killer for SSE optimizations because you can not hide them away. Does DMC++ have __declspec(align

Re: __restrict, architecture intrinsics vs asm, consoles, and other stuff

2011-09-22 Thread Kagamin
Manu Wrote: > I'd love to try out D on some console systems. Fortunately there are > some great home-brew scenes available for a bunch of slightly older > consoles; PSP/PS2 (MIPS), XBox1 (embedded x86), GameCube/Wii (PPC), > Dreamcast (SH4). They all have GCC compilers maintained by the > communit