January 28, 2009
Ary Borenszweig wrote:
> 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...

Because then it's a static global. And static initializers get run at compile time.
January 28, 2009

Ary Borenszweig wrote:
> [snip]
> 
> Wow! Thanks for the joyful answer, Daniel. :-)
> 
> The attachment you sent doesn't compile, it gives a syntax error in the mixed content for the IsExpression (only a type is allowed, not "this."). Anyway, I'll change the "!descent.core.dom.CompilationUnit@17c858d" message to something like "Module foo has syntax or semantic errors due to mixins".

Cool.  Can I make one other inquiry?  Is it possible to get the CT
window to not scroll back to the top every time the source file changes?
 I've just been using it to debug a mixin (oh God I love this SO MUCH)
and I had to keep scrolling down every time I changed something.

Even if I had to manually pin the window, or specify which part of the code to view the CT for, it'd really improve the feature.

  -- Daniel
January 28, 2009
Daniel Keep wrote:
> 
> I've never been big on IDEs; I never felt that they had enough
> advantages over a plain text editor to make up for the slowness and
> restrictions.
> 

I code in java for a living, and wouldn't change eclipse as my editor for anything. But that's just me. :)

> But this is just so freaking awesome, I'm seriously considering moving
> over to Descent for my D development.  It's just a pity I can't have my
> Vim editing commands, too :P
> 

I haven't used this, but it might be something you'd like.
http://vimplugin.org/

O.
January 28, 2009
Daniel Keep wrote:
> 
> Ary Borenszweig wrote:
>> [snip]
>>
>> Wow! Thanks for the joyful answer, Daniel. :-)
>>
>> The attachment you sent doesn't compile, it gives a syntax error in the
>> mixed content for the IsExpression (only a type is allowed, not
>> "this."). Anyway, I'll change the
>> "!descent.core.dom.CompilationUnit@17c858d" message to something like
>> "Module foo has syntax or semantic errors due to mixins".
> 
> Cool.  Can I make one other inquiry?  Is it possible to get the CT
> window to not scroll back to the top every time the source file changes?
>  I've just been using it to debug a mixin (oh God I love this SO MUCH)
> and I had to keep scrolling down every time I changed something.
> 
> Even if I had to manually pin the window, or specify which part of the
> code to view the CT for, it'd really improve the feature.

Done!

Just update to the newer version (0.5.4.20090128).

(Yeah, it bothered me too. Now it always maintains the scroll, unless you switch to editing another module)

> 
>   -- Daniel
January 29, 2009

Ary Borenszweig wrote:
> [snip]
> 
> Done!
> 
> Just update to the newer version (0.5.4.20090128).
> 
> (Yeah, it bothered me too. Now it always maintains the scroll, unless you switch to editing another module)

Magically delicious updates while-you-sleep!

  -- Daniel
January 29, 2009
Thanks for the updates and fixes, Ary.


This is seriously good stuff!


I'll use dwt source to stress-test it again. :) 


-JJR


January 29, 2009
Ary Borenszweig wrote:

> New features:
>   - Compile-time view

This is a great feature that I've been looking forward to.
When playing around with this, I noticed a few things that seemed odd to me.  They may be normal/expected if I understood the better how the front end/descent works.
1. derr.writefln("foo") is translated as 1("foo")
2. Actual template instances are not shown.
3. I have a template (called factory) that takes a string argument.  The compile time view translates
   alias factory!("libego") gameDef;
into
   alias void gameDef;
January 29, 2009
On Wed, Jan 28, 2009 at 11:37 PM, Jason House <jason.james.house@gmail.com> wrote:
> 1. derr.writefln("foo") is translated as 1("foo")

Haw haw, that's because the DMDFE replaces symbols it doesn't know with 1.  That's why the compiler spits out tons of bizarre "expected function before parens, not '1' of type 'int'" after undefined symbol errors.  Either you're not importing std.cstream, or Descent isn't looking it up right.
January 29, 2009
Jason House escribió:
> Ary Borenszweig wrote:
> 
>> New features:
>>   - Compile-time view
> 
> This is a great feature that I've been looking forward to.
> When playing around with this, I noticed a few things that seemed odd to me.  They may be normal/expected if I understood the better how the front end/descent works.
> 1. derr.writefln("foo") is translated as 1("foo")

Hehehe, Jarret is right here!

I've fixed this so that in this case I'll use the original source code in the output view.

> 2. Actual template instances are not shown.

What do you mean?

I just tried:

---
class Foo(T) {
	
}

void lala() {
	Foo!(int) foo;
}
---

and it was shown like:

---
class Foo(T) {
	
}

void lala() {
	Foo foo;
}
---

(should be Foo!(int))

Is that what you mean?

> 3. I have a template (called factory) that takes a string argument.  The compile time view translates
>    alias factory!("libego") gameDef;
> into
>    alias void gameDef;

Bug. :-)

I've fixed these in a new version, 0.5.4.20090129.

Thanks for the feedback!
January 29, 2009
Ary Borenszweig wrote:
> 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).
>  - Added code templates for operator overloading, so that you don't have to remember all those names. Try them by typing "op" and pressing ctrl+space.
>  - Fixed ticket #160: new completion proposals: "classinfo" and "outer" (when available) are shown for classes. "ptr" and "funcptr" are shown for delegates.
> 
> Please note that most of these features are experimental. (the compile-time view is mostly useful to experiment with small cases to see what the compiler is doing, like for example if you write "auto x = [1, 2, 3];", to see what type the compiler gives to x)
> 
> I also fixed the problem with the last version: I accidentally introduced a dependency with JDT and that was causing the problems most of you had, so in this version this dependency was removed and updating should work as usual.
> 
> Any suggestion, critic or bug report is welcome. You can use:
> - the forums: http://www.dsource.org/forums/viewforum.php?f=107
> - trac: http://www.dsource.org/projects/descent/report?action=new
> - irc: at freenode, #d.descent
> 
> Enjoy!

Since the version 0.5.4.20090129 is available through the update manager  updating fails with:

An error occurred while collecting items to be installed
  Problems downloading artifact: osgi.bundle,descent.ui,0.5.4.20090127.
    Exception connecting to http://downloads.dsource.org/projects/descent/update-site/plugins/descent.ui_0.5.4.20090127.jar.

http://downloads.dsource.org/projects/descent/update-site/plugins/descent.ui_0.5.4.20090127.jar
    Exception connecting to http://downloads.dsource.org/projects/descent/update-site/plugins/descent.ui_0.5.4.20090127.jar.

http://downloads.dsource.org/projects/descent/update-site/plugins/descent.ui_0.5.4.20090127.jar