January 27, 2009 Re: Descent 0.5.4 released | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ary Borenszweig | On Wed, Jan 28, 2009 at 12:46 AM, Ary Borenszweig <ary@esperanto.org.ar> wrote: > Ary Borenszweig wrote: > > Here's the video! > > http://www.youtube.com/watch?v=oAhrFQVnsrY > > :-) > By the way, in the vid you use a plain int param in your opApply delegate, instead of "ref int". I think this will not work. At least I seem to remember finding that opApply doesn't work unless I make all the delegate's arguments ref. I think some of that came from an auto-complete code template, so if the code template doesn't include the 'ref' it should, as a hint to the programmer. Another question -- I was wondering what it does for CTFE functions. I'm guessing it evaluates them and spits out the result. If so that could be very very helpful. Especially for code-building CTFE mixins. I don't think you had an example like that in the vid. This compile time view could be a great debugging and learning aid for D. I think it's quite exciting. I wonder if someone can get it working on something like http://paste.dprogramming.com/ --bb |
January 28, 2009 Re: Descent 0.5.4 released | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ary Borenszweig | Ary Borenszweig wrote:
> ---
> int foo(int x) {
> return x * 2 * 2;
> }
>
> int bar(int x) {
> return 2 * 2 * x;
> }
> ---
>
> is transformed to this:
>
> ---
> int foo(int x) {
> return x * 2 * 2;
> }
>
> int bar(int x) {
> return 4 * x;
> }
> ---
Those should be shifts.
|
January 28, 2009 Re: Descent 0.5.4 released | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bill Baxter | Bill Baxter escribió: > On Wed, Jan 28, 2009 at 12:46 AM, Ary Borenszweig <ary@esperanto.org.ar> wrote: >> Ary Borenszweig wrote: >> >> Here's the video! >> >> http://www.youtube.com/watch?v=oAhrFQVnsrY >> >> :-) >> > > By the way, in the vid you use a plain int param in your opApply > delegate, instead of "ref int". I think this will not work. At least > I seem to remember finding that opApply doesn't work unless I make all > the delegate's arguments ref. > > I think some of that came from an auto-complete code template, so if > the code template doesn't include the 'ref' it should, as a hint to > the programmer. I'll correct that, then. > > Another question -- I was wondering what it does for CTFE functions. > I'm guessing it evaluates them and spits out the result. If so that > could be very very helpful. Especially for code-building CTFE mixins. > I don't think you had an example like that in the vid. It does! See the first part of the video, when I do: int x = 1 + 2 + 3 + 4 + someFunc(5); and it shows: int x = 25; It just evaluated someFunc. :-) > > This compile time view could be a great debugging and learning aid for > D. I think it's quite exciting. I wonder if someone can get it > working on something like http://paste.dprogramming.com/ You mean, web? The java code can be used in the backend for that with little modification, I think that's quite possible. > > --bb |
January 28, 2009 Re: Descent 0.5.4 released | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ary Borenszweig | On Wed, Jan 28, 2009 at 10:33 AM, Ary Borenszweig <ary@esperanto.org.ar> wrote: > Bill Baxter escribió: >> >> On Wed, Jan 28, 2009 at 12:46 AM, Ary Borenszweig <ary@esperanto.org.ar> wrote: >>> >>> Ary Borenszweig wrote: >>> >>> Here's the video! >>> >>> http://www.youtube.com/watch?v=oAhrFQVnsrY >>> >>> :-) >>> >> >> By the way, in the vid you use a plain int param in your opApply delegate, instead of "ref int". I think this will not work. At least I seem to remember finding that opApply doesn't work unless I make all the delegate's arguments ref. >> >> I think some of that came from an auto-complete code template, so if the code template doesn't include the 'ref' it should, as a hint to the programmer. > > I'll correct that, then. > >> >> Another question -- I was wondering what it does for CTFE functions. >> I'm guessing it evaluates them and spits out the result. If so that >> could be very very helpful. Especially for code-building CTFE mixins. >> I don't think you had an example like that in the vid. > > It does! See the first part of the video, when I do: > > int x = 1 + 2 + 3 + 4 + someFunc(5); > > and it shows: > > int x = 25; > > It just evaluated someFunc. :-) Rockin! >> This compile time view could be a great debugging and learning aid for D. I think it's quite exciting. I wonder if someone can get it working on something like http://paste.dprogramming.com/ > > You mean, web? The java code can be used in the backend for that with little modification, I think that's quite possible. Yeh, web. There's already a site where you can paste in D code and the server will compile and run the code for you. A compile-time view button on that page would be great. Not that you should be the one to do it or anything. Just thinking it would be nifty, that's all. --bb |
January 28, 2009 Re: Descent 0.5.4 released | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ary Borenszweig | Ary Borenszweig wrote:
> Bill Baxter escribió:
>> Another question -- I was wondering what it does for CTFE functions.
>> I'm guessing it evaluates them and spits out the result. If so that
>> could be very very helpful. Especially for code-building CTFE mixins.
>> I don't think you had an example like that in the vid.
>
> It does! See the first part of the video, when I do:
>
> int x = 1 + 2 + 3 + 4 + someFunc(5);
>
> and it shows:
>
> int x = 25;
>
> It just evaluated someFunc. :-)
Given that int x isn't a const expression, is someFunc(5) supposed to be evaluated at compile time like that?
Later,
Brad
|
January 28, 2009 Re: Descent 0.5.4 released | ||||
---|---|---|---|---|
| ||||
Brad Roberts wrote:
> Ary Borenszweig wrote:
>> Bill Baxter escribió:
>>> Another question -- I was wondering what it does for CTFE functions.
>>> I'm guessing it evaluates them and spits out the result. If so that
>>> could be very very helpful. Especially for code-building CTFE mixins.
>>> I don't think you had an example like that in the vid.
>> It does! See the first part of the video, when I do:
>>
>> int x = 1 + 2 + 3 + 4 + someFunc(5);
>>
>> and it shows:
>>
>> int x = 25;
>>
>> It just evaluated someFunc. :-)
>
> Given that int x isn't a const expression, is someFunc(5) supposed to be evaluated at compile time like that?
>
> Later,
> Brad
Hrm.. unless it's just bog standard inlining and const folding going on, which is quite possible.
Nevermind,
Brad
|
January 28, 2009 Re: Descent 0.5.4 released | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ary Borenszweig | On Tue, 27 Jan 2009 21:19:36 +0200, Ary Borenszweig <ary@esperanto.org.ar> wrote: > Where can I find a version of obj2asm for Windows to see what's going on in those cases? Try the free version of IDA (Interactive DisAssembler) instead: http://www.hex-rays.com/idapro/idadownfreeware.htm -- Best regards, Vladimir mailto:thecybershadow@gmail.com |
January 28, 2009 Re: Descent 0.5.4 released | ||||
---|---|---|---|---|
| ||||
Posted in reply to Brad Roberts | Brad Roberts escribió: > Brad Roberts wrote: >> Ary Borenszweig wrote: >>> Bill Baxter escribió: >>>> Another question -- I was wondering what it does for CTFE functions. >>>> I'm guessing it evaluates them and spits out the result. If so that >>>> could be very very helpful. Especially for code-building CTFE mixins. >>>> I don't think you had an example like that in the vid. >>> It does! See the first part of the video, when I do: >>> >>> int x = 1 + 2 + 3 + 4 + someFunc(5); >>> >>> and it shows: >>> >>> int x = 25; >>> >>> It just evaluated someFunc. :-) >> Given that int x isn't a const expression, is someFunc(5) supposed to be >> evaluated at compile time like that? >> >> Later, >> Brad > > Hrm.. unless it's just bog standard inlining and const folding going on, > which is quite possible. Great observation! I remember functions like that not being evaluated unless the variable was declared const. I just debugged that and checked with DMD's source code, and it seems the expression in the initializer is evaluated if the variable declaration is not inside a function (check VarDeclaration::semantic2 and ExpInitializer::semantic, which invoked optimize at the end). I wonder why is that behaviour defined like that... > > Nevermind, > Brad |
January 28, 2009 Re: Descent 0.5.4 released | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ary Borenszweig | Ary Borenszweig escribió:
> The Descent plugin for Eclipse provides an IDE for writing, launching and debugging code in D.
>
> Explanations on how to get it from within Eclipse are here:
>
> http://www.dsource.org/projects/descent
>
> New features:
> - Compile-time view (Window -> Show View -> Other -> D -> Compile-time View): allows you to see things from the compiler point of view, which applies some transformations to the source code. For example you can see what happens when you do a foreach, when you invoke an "extension method", when you do operator overloading; know what type has an auto variable; how struct fields are accessed?; compiler optimizations. It also removes conditionals that evaluate to false, and shows the results of mixins in-place. As always, this is far from perfect and a lot of things can be improved. For the lazies, I'll later upload a video about this. :-)
> - Now hovering over a mixin (over the "mixin" keyword) shows it's result in a popup.
> - Now hovering over a function or template instance with ctrl+shift shows it's compile-time result (with shift only: it's source code).
Just a small remark: the probability that these things stop working is bigger if the code is spread in many modules. That's because I did some optimizations and lazy loading of some symbols, and sometimes it doesn't work (I'll fix that, eveeeeeeentualy). So this should work better in a single module. That's why this should be a good aid for prototyping new functionality that heavily uses mixins, templates and compile-time evaluation. :-)
|
January 28, 2009 Re: Descent 0.5.4 released | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ary Borenszweig | Ary Borenszweig wrote: > The Descent plugin for Eclipse provides an IDE for writing, launching and debugging code in D. This build is not compatible with Eclipse3.3 und SuseEnt10(SP2) as well. When I press CTRL+Space, I will see an error message: ---------------------------------------------------------------------------- The 'descent.ui.JavaNoTypeCompletionProposalComputer' proposal computer from the 'descent.ui' plug-in did not complete normally. The extension has thrown a runtime exception. To avoid this message, disable the 'descent.ui' plug-in or disable the 'Other D Proposals' category on the content assist preference page. ---------------------------------------------------------------------------- There is no problem with Windows, but with SuseEnt10. Is it possible to make it work again?? For more information, please another thread of mine in this group. --Qian |
Copyright © 1999-2021 by the D Language Foundation