custom AST library

2010-11-25 Thread Alex_Dovhal
Hi, I'm currently making some custom AST parser for D : http://pastebin.com/1hmnTUbY -- AST Parser http://pastebin.com/ZRc5be1p -- Sum example Right now both lexer and syntax parser are just awfull and they don't work in CTFE because of class usage. But example looks rather interesting, with

Re: C#'s greatest mistakes

2010-11-28 Thread Alex_Dovhal
"BLS" ?/?? ? ???:ics611$22s...@digitalmars.com... > So in order to create a Tool which is able to create an SQL2D Translator > (as D2 DLL/so) just by descrining Source an Target EBNF could be a great > help.. Calling such an ready to use Translator whenever the standard D

Re: Slides from my ACCU Silicon Valley talk

2010-12-14 Thread Alex_Dovhal
"Don" wrote: > Agreed. I've just looked through some code that I thought used them > extensively, but found only two complex literals: 1i (dozens of instances) > and 2i (one instance). So if D removes complex literals what the proposed name for Imaginary One would be? _i , i_ , _i_, _

Re: Slides from my ACCU Silicon Valley talk

2010-12-14 Thread Alex_Dovhal
Oh sorry those @i and @j also would be build in. Ignore this.

Re: Slides from my ACCU Silicon Valley talk

2010-12-15 Thread Alex_Dovhal
"Lars T. Kyllingstad" wrote: > And if someone *really* wants to put the "i" in there, they can just > define it in their own app: > > enum i = Complex!double(0, 1); > auto z = 0.998 + 2.72e-2*i; > > -Lars > Looks very nice.

Re: Why Ruby?

2010-12-16 Thread Alex_Dovhal
"Andrej Mitrovic" wrote: > The cool thing about D is that with a little bit of string magic you > can make your own DSL's. Here's a rather hardcoded and superficial > example, but for this simple case it works: > > http://pastebin.com/Xkghv1ky > > Of course you'd need to build your own little DSL

Re: New syntax for string mixins

2010-12-19 Thread Alex_Dovhal
"Don" wrote: > I don't think it's quite the same. In a makefile, every executable is > listed, and so you can have some degree of control over it. But in this > scenario, the compiler is making calls to arbitrary shared libraries with > arbitrary parameters. > It means the compiler cannot be t

Re: Why Ruby?

2010-12-19 Thread Alex_Dovhal
"Stephan Soller" wrote: > I don't think that the syntax improvement of chaining is worth such an > effort. It adds tons of complexity for only a very limited gain. I'm not > sure if I could write such self-parsed code without thinking about that > pipeline. I think I don't fully understand wh

Re: Why Ruby?

2010-12-20 Thread Alex_Dovhal
"Stephan Soller" wrote > I read your post in the context of method chaining with templates like > filter! and map!. Looks like I missed the point. :) > > I think your idea is pretty impressive. Maybe useful for some high-level > stuff like mathematical formulas. Yes, I borrowed the idea and sy

Re: New syntax for string mixins

2010-12-20 Thread Alex_Dovhal
"Don" wrote: > In order for CTFE code to call pre-compiled code, three things are > required: > (1) the compiler needs to be able to find the file (.obj/.lib/shared > library) containing the compiled code; > (2) the compiler needs to be able to load the module and call it. This > requires some

Re: New syntax for string mixins

2010-12-21 Thread Alex_Dovhal
"Don" wrote: > In order for CTFE code to call pre-compiled code, three things are > required: > (1) the compiler needs to be able to find the file (.obj/.lib/shared > library) containing the compiled code; > (2) the compiler needs to be able to load the module and call it. This > requires some

Re: custom AST library

2010-12-21 Thread Alex_Dovhal
"Andrej Mitrovic" wrote: > I'm just having a look at this now, looks rather interesting! I'd love > to be able to use some Python-like list comprehension tricks in my D > code. Yes list comprehension is also possible this way. But it is not very eye handy right now even if fully implemented, beca

Re: custom AST library

2010-12-21 Thread Alex_Dovhal
"Andrej Mitrovic" wrote: > That's why I think it might be a better idea to simply use "DSL > blocks" throughout your code. Instead of having to mixin each > template, you would only have one template where you have all the > rules for your DSL: > > float a = 1 ; > int n = 10 ; > // more D code..

Re: New syntax for string mixins

2010-12-22 Thread Alex_Dovhal
"Don" wrote: > It's not that complicated. Once you can load the library and call *one* > function in it, the problem is solved. > But at a deeper level, I'm not sure what you'd hope to achieve with this. > I mean (excluding some not-yet implemented features), CTFE allows you to > execute any pur

Re: PROPOSAL: Implicit conversions of integer literals to floating point

2010-12-30 Thread Alex_Dovhal
"Don" wrote: >> Because the coder could have typed `0.0' instead of `0', the coder >> probably wanted the compile time error you described. > > No. People expect sqrt(2) to compile, and to return 1.414 > For example, it works in C and in C++. > > The only other possible solution would be to d

Re: While we were discussing lambda syntax..

2010-12-31 Thread Alex_Dovhal
"Andrej Mitrovic" wrote: > There was some heated discussion about the disadvantages of using strings > as a predicate, and coming up with some new syntax that DMD would support. > Some people did not like using strings and would rather use _ or _0/_1 > instead of this: > > auto arr = [0,1,2,3,

Re: Nimrod language

2011-01-03 Thread Alex_Dovhal
"bearophile" wrote >> - I like the idea of AST macros, they are powerful, > > A nice example of macro usage: > http://lambda-the-ultimate.org/classic/message6437.html > > Bye, > bearophile > D can also do some https://github.com/AlexYD/DPP/blob/master/bin/Debug/test.d

Re: [ ArgumentList ] vs. @( ArgumentList )

2012-11-07 Thread Alex_Dovhal
"Regan Heath" wrote > On Wed, 07 Nov 2012 15:51:50 -, Nick Sabalausky > wrote: > >> On Tue, 06 Nov 2012 22:53:36 +0100 >> Artur Skawina wrote: >>> >>> "@[ArgumentList]". >>> >> >> vote++ >> >> It has all the benefits of '@(...)' (which are very compelling on >> their own), but also has the

Re: Gdc & avr

2012-02-03 Thread Alex_Dovhal
"Andrea Fontana" wrote: >Is it possible to compile for avr (atmel) platform using gdc? It would be >interesting for arduino development... AVR is 8-bit harward architecture while D is designed for at least 32 bits. Besides that AVR's have from (less then 1) to (a few) kB of RAM so it needs an

Re: Gdc & avr

2012-02-03 Thread Alex_Dovhal
>"Manu" wrote: >I think you'll find that most arduino projects are using a much more >capable avr chip, probably avr32 chips. Never used Arduino but it's site and wikipedia mentiones only 8-bit AVR's http://en.wikipedia.org/wiki/Arduino Here http://arduino.cc/en/Main/Hardware also all AVR's are

Re: Gdc & avr

2012-02-03 Thread Alex_Dovhal
>"Manu" wrote: >I think you'll find that most arduino projects are using a much more >capable avr chip, probably avr32 chips. Never actually used arduino, but it's site and wikipedia mentiones 8-bit devices http://en.wikipedia.org/wiki/Arduino . Here also http://arduino.cc/en/Main/Hardware - all

Re: Gdc & avr

2012-02-03 Thread Alex_Dovhal
"Daniel Murphy" wrote: >There are 32 bit avrs. Search for 'AVR32'. Thanks, I know :) But Arduino uses 8-bit.

Re: Gdc & avr

2012-02-03 Thread Alex_Dovhal
>Andrea Fontana" wrote: >In this case can we hope for a d frontend? That depends if it's MCU or MPU. If it will be MCU(like ARM7TDMI), which means Harvard Architecture (where Program code and RAM are physically different). Also internal RAM of a few KB and no Linux. If it'll be MCU then it can h

Re: Gdc & avr

2012-02-04 Thread Alex_Dovhal
"Daniel Murphy" wrote: > I'll take it you've never actually used c on a small embedded system? > > Of course you're doing all those things, if they're needed. Very low > level programming in c does not need a runtime at all. Probably you can stub all C runtime initializations. But why? Common C

Re: Message passing between threads: Java 4 times faster than D

2012-02-09 Thread Alex_Dovhal
"Nicolae Mihalache" wrote: > Hello, > > I'm a complete newbie in D and trying to compare with Java. I > implemented a simple test for measuring the throughput in message > passing between threads. I see that Java can pass about 4mil > messages/sec while D only achieves 1mil/sec. I thought that D

Re: Message passing between threads: Java 4 times faster than D

2012-02-09 Thread Alex_Dovhal
Sorry, my mistake. It's strange to have different 'n', but you measure speed as 1000*n/time, so it's doesn't matter if n is 10 times bigger.

Re: More lexer questions

2012-02-12 Thread Alex_Dovhal
"Martin Nowak" wrote: > Just wanted to point you to my working D lexer (needs a CTFE bugfix > http://d.puremagic.com/issues/show_bug.cgi?id=6815). > > https://gist.github.com/1262321 D part > https://gist.github.com/1255439 Generic part Hi, how it should be compiled? I tried with DMD 2.057: >dmd

Re: reddit discussion about Go turns to D again

2011-05-16 Thread Alex_Dovhal
"Andrei Alexandrescu" ???/ ? ?: news:iqq4jv$2eh3$2...@digitalmars.com... >> So you have to write >> std.parallel_algorithm.map() instead of map() all the time? > > alias std.parallel_algorithm p; Not so easy: 1. This alias would break UFCS possibility. 2. p is very

Re: [Article Contest, first draft] D Slices

2011-05-18 Thread Alex_Dovhal
"Steven Schveighoffer" ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ: news:op.vvou3fbgeav7ka@localhost.localdomain... > Having seen quite a few incorrect descriptions of how D slices work > (particularly regarding appending), I wrote an article that tries to > describe how D slices work, and why they

UFCS idea

2011-06-08 Thread Alex_Dovhal
There have been several topics discussing UFCS recently. So here is one more) One idea about UFCS - mark UFCS argument with @, @_, or _ symbol, e.g. you have some function: void func(Type1 p1, Type2 p2); and later call it: fucn(a, b); //or a.func(@_, b); //or b.func(a, @_); This way Timon Gehr

Re: UFCS idea

2011-06-08 Thread Alex_Dovhal
"Andrej Mitrovic" ???/ ? ?: news:mailman.717.1307563594.14074.digitalmar...@puremagic.com... > @_ <- that's a snail. > thanks, i didn't knew that :)

Re: UFCS idea

2011-06-08 Thread Alex_Dovhal
"Dmitry Olshansky" wrote > what was so bad about having 'this' inside parameters? > I thought it was rather compelling: > > void func(Type1 this, Type2 p2); > which is legal only as a free function and inside structs/classes it's > declaration syntax error. > > [3,2,5,3].cycle.stride(2).take(10);

Re: UFCS idea

2011-06-08 Thread Alex_Dovhal
"Dmitry Olshansky" ???/ ? ?: news:isopbg$1l5d$1...@digitalmars.com... >> How does that prevent hijacking? If you want it to overload against >> members of the >> same name, you would have to introduce another overload set, not just >> another >> overload. (But inde

Re: UFCS idea

2011-06-08 Thread Alex_Dovhal
"Dmitry Olshansky" wrote: >> Sure here you can, but in more complex cases or when you don't want to >> strain you mind and memory. >> a.someUnknownToReaderFunc(b).otherNotOftenUsedFunc(c) >> > Generally they are known to reader - they are free functions (and even > small subset of those) anyway,

Re: UFCS idea

2011-06-08 Thread Alex_Dovhal
"Alex_Dovhal" wrote:... [snip] > member3(x, 1); //hundred times in user code > > And later library writer adds void member3(int a) member to class A. > Now user code has name collision. Sorry I meant x.member3(1);

Re: UFCS idea

2011-06-09 Thread Alex_Dovhal
"Jonathan M Davis" wote: > Regardless, I see little point in using it for UFCS. If we want to > specifically mark parameters for it, I think that the suggestion of using > "this" makes a lot more sense. You wouldn't even have to change the > grammar > (unlike if you used @). You'd just change the

Re: Mixin template evaluated to string can convert to string mixin expression implicitly

2011-06-24 Thread Alex_Dovhal
"Timon Gehr" wrote: > String mixins themselves are 'a little bit ugly' (but unquestionably very > useful). > I think the syntax should keep reflecting that. > > Your proposal is a try to make up for Ds lack of macros. I'd prefer > macros. > Also overloading the meaning of 'mixin template' seems

Re: Mixin template evaluated to string can convert to string mixinexpression implicitly

2011-06-24 Thread Alex_Dovhal
"kenji hara" wrote: > My proposal is just a syntactic sugar. > You can develop such library without it. yes, but still stable DMD release can't handle pointers in CTFE. And without such syntactic sugar it's ungly to write something like that mixin(sum!q{i : iota(N); mixin(sum!q{j : iota(M), j

Re: Mixin template evaluated to string can convert to string mixin expression implicitly

2011-06-24 Thread Alex_Dovhal
"Timon Gehr" wrote: > Macros operate on ASTs, not strings. You won't get real macros, just > something > that feels somewhat like them. You still could implement the equivalent to > C > macros (not real macros either) in a library, but they would have all the > problems > of C macros, as string

Re: Mixin template evaluated to string can convert to stringmixinexpression implicitly

2011-06-24 Thread Alex_Dovhal
"kenji hara" wrote: >Note: A simple way to construct environment for build dmd/druntime/phobos >is: >1. Expand newest release package. >2. Replace dmd2/src/dmd, dmd2/src/druntime, and dmd2/src/phobos to >checkouted git repositories. >3. Copy https://gist.github.com/1045205 into dmd2/src >I am

Re: Mixin template evaluated to string can convert to string mixinexpression implicitly

2011-06-24 Thread Alex_Dovhal
"%u" wrote: > == Quote from kenji hara (k.hara...@gmail.com)'s article >> Note: A simple way to construct environment for build dmd/druntime/phobos >> i >> s: >> 1. Expand newest release package. >> 2. Replace dmd2/src/dmd, dmd2/src/druntime, and dmd2/src/phobos to >> checkouted git repositories.

Re: Mixin template evaluated to string can convert to string mixin expression implicitly

2011-06-24 Thread Alex_Dovhal
"Timon Gehr" wrote: > My question could not possibly be answered with 'yes', actually I was > interested > in what functionality your library would provide for the end user. > You answered the question "Would your library be capable of building an > AST?". Sorry for ambiguity, "yes" was answer

Re: Complete floating point literals

2011-07-10 Thread Alex_Dovhal
"bearophile" wrote: [...] +1.0 vote. Also, no one writes .5 or 3. on paper to save one char.

Re: Anonymous function syntax

2011-09-23 Thread Alex_Dovhal
"Robert Jacques" wrote > What I worry about though is variable hijacking rules. e.g. > > auto b = 5; > reduce!\a+b(map!\a+b([1,2,3,4)); Nice. What if we extend your proposal to \(comma_separated_params)simple_expression \(comma_separated_params){expressions} Then no variable hijacking would be

Re: Anonymous function syntax

2011-09-23 Thread Alex_Dovhal
"Alex_Dovhal" wrote > reduce!\(a)a+b(map!\(x)x+b([1,2,3,4)); Sorry, my mistake reduce!\(a,b)a+b(map!\(x)x+b([1,2,3,4));

Re: Anonymous function syntax

2011-09-24 Thread Alex_Dovhal
"Robert Jacques" wrote > Well, actually, this is Jason's proposal and it's explicitly for a > std.algorithm style, by convention, super-short lambda syntax. i.e. > primarily for one liners and std.algorithm. If you go the > comma_separated_params, then I think the a => a+x; route is better. Ma

Re: [OT] Extra time spent

2014-06-04 Thread Alex_Dovhal via Digitalmars-d
On Wednesday, 4 June 2014 at 19:04:19 UTC, H. S. Teoh via Digitalmars-d wrote: It's strange, I find that even ambient music distracts me, yet the loud noise of an occasional passing train doesn't. Similarly, even whispers will distract me, but birds chirping, trees rustling, etc., don't. It's

Re: std.math performance (SSE vs. real)

2014-06-28 Thread Alex_Dovhal via Digitalmars-d
On Saturday, 28 June 2014 at 10:42:19 UTC, Walter Bright wrote: It happens with both numerical integration and inverting matrices. Inverting matrices is commonplace for solving N equations with N unknowns. Errors accumulate very rapidly and easily overwhelm the significance of the answer. i