View mode: basic / threaded / horizontal-split · Log in · Help
April 09, 2012
Re: Foreach Closures?
On 2012-04-09 15:44, Kapps wrote:

> That was Descent, a plugin for Eclipse. They did it by porting
> DMD, with changes, to Java. A horribly painful task I'd imagine.
> I wonder if it'd be easier by just creating bindings for DMD for
> the language of choice.

That would be horribly painful as well. Since DMD is not made to be used 
as a library. It really does not fit.

> That being said, if MonoDevelop's parser gets to the point where
> it can evaluate this stuff well, I think that'd work just as
> nicely. You won't quite be able to see the actual compiler's
> representation of it, but you'd be able to expand mixins and such.

The MonoDevelop parser will have the same problem as the one for 
Descent. Either it's a port of DMD and needs to play catch up all the 
time. Or it's a completely new parser that will, most likely, not have 
the same behavior as the compiler. A new parser would also need to play 
catch up with DMD.

See my other reply:

http://forum.dlang.org/thread/mailman.1506.1333927673.4860.digitalmars-d@puremagic.com#post-jlutfe:24jal:241:40digitalmars.com

-- 
/Jacob Carlborg
April 10, 2012
Re: Foreach Closures?
On 4/9/12 10:58 PM, Jacob Carlborg wrote:
> On 2012-04-09 15:19, Manu wrote:
>> OMG, DO WANT! :P
>> Who wrote this? I wonder if they'd be interested in adapting it to
>> VisualD + MonoDevelop?
>
> That would be Ary Manzana. I think one of the reasons why he stopped
> working on this was that he ported the DMD frontend to Java and it's
> just a pain to stay updated with DMD.

Yes, it was a pain. I can't understand how I did it. Aaaah... the times 
when one was young. :-P

Robert Fraser also helped a lot with porting, doing some refactorings 
and many other cool stuff. I don't remember seeing a message of him in 
this newsgroup for a long time now...

> This comes back to us again, again and again. We _badly need_ a compiler
> that is usable as a library. Preferably with a stable API which it
> possible to create bindings for other languages. For that compiler to be
> stay up to date it needs to be the reference implementation, i.e. the
> one that Walter works on.
>
> Also Walter won't just drop DMD and replace it with something else or
> start a major refactoring process on the existing code base.

Yes, D definitely needs that. The Eclipse plugin could just use bindings 
to the D compiler API with JNI.

In fact, I think Walter and company should stop working on the current 
DMD codebase and start all over again. The code, as I see it, is a big 
mess. Now that the spec is more or less "clear" and not many new 
features are added, I think this is the time to do it.

Actually, nobody has to wait Walter. The community could just start 
writing a D compiler in D, host it in github and work with pull 
requests... something like what Rubinius has done with Ruby.

Though you might think it'll be harder to catch up with language 
changes, if the code has a better design I think introducing new changes 
should be much easier than in DMD's current codebase.

> BTW, Descent has a compile time debugger as well, if I recall correctly.

Yeah, I'm not sure how well that works.
April 10, 2012
Re: Foreach Closures?
On 4/9/12 9:35 PM, Kevin Cox wrote:
>
> On Apr 9, 2012 9:19 AM, "Manu" <turkeyman@gmail.com
> <mailto:turkeyman@gmail.com>> wrote:
>  >
>  > OMG, DO WANT! :P
>  > Who wrote this? I wonder if they'd be interested in adapting it to
> VisualD + MonoDevelop?
>  >
>  >
>  > On 9 April 2012 12:56, Ary Manzana <ary@esperanto.org.ar
> <mailto:ary@esperanto.org.ar>> wrote:
>  >>
>  >> On 4/9/12 7:26 AM, Kevin Cox wrote:
>  >>>
>  >>> I was wondering about the foreach statement and when you implement
>  >>> opApply() for a class it is implemented using closures.  I was
> wondering
>  >>> if this is just how it is expressed or if it is actually syntatic
>  >>> sugar.  The reason I aski is because if you have a return statement
>  >>> inside a foreach it returns from the outside function not the
> "closure".
>  >>>
>  >>> I was just wondering if anyone could spill the implementation details.
>  >>>
>  >>> Thanks,
>  >>> Kevin
>  >>
>  >>
>  >> In this video you can see what foreach with opApply gets translated
> to (at about minute 1):
>  >>
>  >> http://www.youtube.com/watch?v=oAhrFQVnsrY
>  >
>
> Unfortunately I can't get it working.  Ill have to keep fiddling.
>

Note that, as many already said, it hasn't been updated for a long time 
now, and things won't change. So only use it if coding for a reaaaally 
old D version.
April 10, 2012
Re: Foreach Closures?
On 4/9/12 9:21 PM, Ary Manzana wrote:
> Yes, D definitely needs that. The Eclipse plugin could just use bindings
> to the D compiler API with JNI.

Would the JSON compiler output help?

Andrei
April 10, 2012
Re: Foreach Closures?
On Apr 9, 2012 10:29 PM, "Andrei Alexandrescu" <
SeeWebsiteForEmail@erdani.org> wrote:
>
> On 4/9/12 9:21 PM, Ary Manzana wrote:
>>
>> Yes, D definitely needs that. The Eclipse plugin could just use bindings
>> to the D compiler API with JNI.
>
>
> Would the JSON compiler output help?
>
> Andrei

It would cover the basics but as soon as you want to something more than
slightly advanced you are up a creek.
April 10, 2012
Re: Foreach Closures?
On Tue, Apr 10, 2012 at 10:21:04AM +0800, Ary Manzana wrote:
[...]
> Actually, nobody has to wait Walter. The community could just start
> writing a D compiler in D, host it in github and work with pull
> requests... something like what Rubinius has done with Ruby.
> 
> Though you might think it'll be harder to catch up with language
> changes, if the code has a better design I think introducing new
> changes should be much easier than in DMD's current codebase.
[...]

I've thought about this too. But the question is whether or not this
will dilute the already small number of D compiler contributors to the
point that it harms D more than helps it.


T

-- 
Fact is stranger than fiction.
April 10, 2012
Re: Foreach Closures?
On Mon, Apr 9, 2012 at 8:21 PM, Ary Manzana <ary@esperanto.org.ar> wrote:

> On 4/9/12 10:58 PM, Jacob Carlborg wrote:
>
>> On 2012-04-09 15:19, Manu wrote:
>>
>>> OMG, DO WANT! :P
>>> Who wrote this? I wonder if they'd be interested in adapting it to
>>> VisualD + MonoDevelop?
>>>
>>
>> That would be Ary Manzana. I think one of the reasons why he stopped
>> working on this was that he ported the DMD frontend to Java and it's
>> just a pain to stay updated with DMD.
>>
>
> Yes, it was a pain. I can't understand how I did it. Aaaah... the times
> when one was young. :-P
>
> Robert Fraser also helped a lot with porting, doing some refactorings and
> many other cool stuff. I don't remember seeing a message of him in this
> newsgroup for a long time now...
>
>
>  This comes back to us again, again and again. We _badly need_ a compiler
>> that is usable as a library. Preferably with a stable API which it
>> possible to create bindings for other languages. For that compiler to be
>> stay up to date it needs to be the reference implementation, i.e. the
>> one that Walter works on.
>>
>> Also Walter won't just drop DMD and replace it with something else or
>> start a major refactoring process on the existing code base.
>>
>
> Yes, D definitely needs that. The Eclipse plugin could just use bindings
> to the D compiler API with JNI.
>
> In fact, I think Walter and company should stop working on the current DMD
> codebase and start all over again. The code, as I see it, is a big mess.
> Now that the spec is more or less "clear" and not many new features are
> added, I think this is the time to do it.
>
> Actually, nobody has to wait Walter. The community could just start
> writing a D compiler in D, host it in github and work with pull requests...
> something like what Rubinius has done with Ruby.
>

It's already been started.  SDC: https://github.com/bhelyer/SDC

Regards,
Brad Anderson


>
> Though you might think it'll be harder to catch up with language changes,
> if the code has a better design I think introducing new changes should be
> much easier than in DMD's current codebase.
>
>
>  BTW, Descent has a compile time debugger as well, if I recall correctly.
>>
>
> Yeah, I'm not sure how well that works.
>
April 10, 2012
Re: Foreach Closures?
On 4/10/12 10:47 AM, Brad Anderson wrote:
> On Mon, Apr 9, 2012 at 8:21 PM, Ary Manzana <ary@esperanto.org.ar
> <mailto:ary@esperanto.org.ar>> wrote:
>
>     On 4/9/12 10:58 PM, Jacob Carlborg wrote:
>
>         On 2012-04-09 15:19, Manu wrote:
>
>             OMG, DO WANT! :P
>             Who wrote this? I wonder if they'd be interested in adapting
>             it to
>             VisualD + MonoDevelop?
>
>
>         That would be Ary Manzana. I think one of the reasons why he stopped
>         working on this was that he ported the DMD frontend to Java and it's
>         just a pain to stay updated with DMD.
>
>
>     Yes, it was a pain. I can't understand how I did it. Aaaah... the
>     times when one was young. :-P
>
>     Robert Fraser also helped a lot with porting, doing some
>     refactorings and many other cool stuff. I don't remember seeing a
>     message of him in this newsgroup for a long time now...
>
>
>         This comes back to us again, again and again. We _badly need_ a
>         compiler
>         that is usable as a library. Preferably with a stable API which it
>         possible to create bindings for other languages. For that
>         compiler to be
>         stay up to date it needs to be the reference implementation,
>         i.e. the
>         one that Walter works on.
>
>         Also Walter won't just drop DMD and replace it with something
>         else or
>         start a major refactoring process on the existing code base.
>
>
>     Yes, D definitely needs that. The Eclipse plugin could just use
>     bindings to the D compiler API with JNI.
>
>     In fact, I think Walter and company should stop working on the
>     current DMD codebase and start all over again. The code, as I see
>     it, is a big mess. Now that the spec is more or less "clear" and not
>     many new features are added, I think this is the time to do it.
>
>     Actually, nobody has to wait Walter. The community could just start
>     writing a D compiler in D, host it in github and work with pull
>     requests... something like what Rubinius has done with Ruby.
>
>
> It's already been started.  SDC: https://github.com/bhelyer/SDC
>
> Regards,
> Brad Anderson

Awesome!
April 10, 2012
Re: Foreach Closures?
On 4/10/12 10:24 AM, Andrei Alexandrescu wrote:
> On 4/9/12 9:21 PM, Ary Manzana wrote:
>> Yes, D definitely needs that. The Eclipse plugin could just use bindings
>> to the D compiler API with JNI.
>
> Would the JSON compiler output help?
>
> Andrei

Not sure. At least in Descent you could hover over an "auto" keyword and 
know the inferred type, even inside function bodies. I don't think te 
JSON compiler output gives you any information about function bodies... 
right?
April 10, 2012
Re: Foreach Closures?
On 2012-04-10 04:21, Ary Manzana wrote:

> In fact, I think Walter and company should stop working on the current
> DMD codebase and start all over again. The code, as I see it, is a big
> mess. Now that the spec is more or less "clear" and not many new
> features are added, I think this is the time to do it.

I think so as well.

> Actually, nobody has to wait Walter. The community could just start
> writing a D compiler in D, host it in github and work with pull
> requests... something like what Rubinius has done with Ruby.
>
> Though you might think it'll be harder to catch up with language
> changes, if the code has a better design I think introducing new changes
> should be much easier than in DMD's current codebase.

Yeah, it will be easier to add changes if the compiler has a better 
design, but you still need to catch up with the reference implementation.

-- 
/Jacob Carlborg
1 2 3 4
Top | Discussion index | About this forum | D home