Re: One more update on d-programming-language.org

2010-10-05 Thread Bruno Medeiros

On 10/09/2010 01:07, Andrei Alexandrescu wrote:

http://d-programming-language.org

 From David Gileadi: the annoying Google Translate bar behavior on
browsers with other languages has been fixed, the behavior when
shrinking and growing the window size has been improved, the Reddit
button is gone, and a few styles were changed.

Could have sworn I sent this already, it just disappeared.


Andrei


The Translate gadget looks broken on my machine:
http://oi56.tinypic.com/2r23was.jpg
(latest Firefox, default zoom)

Also, the search section looks fugly, IMO. The text&button itself is not 
bad, but the dropdown is, and not just on aspect, but also 
functionality. I'm surprised no else commented likewise. :(


My suggestion is to remove the drop-down altogether. Let the more 
refined search scope options be available elsewhere, perhaps on the 
search results page itself. Also, we should use Google Custom Search. 
Just linking to raw google looks amateurish. That's because (amongst 
other things) the search page shows up with all the Google personalized 
homepage stuff (if you enable it for google.com). Compare: 
http://oi55.tinypic.com/350mmxc.jpg

to:
http://www.google.com/cse?q=foobar&cx=013598269713424429640%3Ag5orptiw95w&ie=UTF-8&sa=Search

Here's an example of what I'm suggesting for the search functionality, 
try it out:

http://svn.dsource.org/projects/descent/downloads/dwebpage.htm
(obviously the layout and colors are broken, I just want to demo the 
functionality, especially using Google Custom Search)


An alternative is to maintain the current behavior: and have the search 
page be presented on its own, instead of contained the D programming 
language site:

http://www.google.com/cse?cx=016833344392370455076%3Afjy38cei55c&ie=UTF-8&q=foobar&sa=Search
However I don't know how to customize the CSS for this hosted page, 
plus, when you click the scope labels, the search query changes: you get 
an annoying extra "more:library_reference" keyword one it. Meh.


Yet another alternative is to put the search text&button as a section in 
the navigation leftbar, and put the three search scopes as 3 radio 
buttion options, each on their own line... but please, no dropdown on a 
header! :S


--
Bruno Medeiros - Software Engineer


Re: eval() (Was: One more update on d-programming-language.org)

2010-09-17 Thread Nick Sabalausky
"dennis luehring"  wrote in message 
news:i70ibg$1ll...@digitalmars.com...
> Am 17.09.2010 09:51, schrieb Nick Sabalausky:
  One thing that could be used for that is the eval() function I've
  recently
  added to my SemiTwist D Tools library:

 
 http://www.dsource.org/projects/semitwist/browser/trunk/src/semitwist/util/process.d

  Example:
  -
  import semitwist.util.all;
  void main()
  {
   auto x = eval!int(q{ return 21 * 2; }); // String can be
  runtime-generated
   assert(x == 42);

   eval!void( q{ writeln("Hello World"); }, q{ import 
 std.stdio; } );
  }
  -
>>>
>>>  is that something like an "runtime" mixin
>>>
>>>  would be great to have something like that in the standard - then i can
>>>  stop writing my own script interpreter for my at runtime loaded DSLs 
>>> :-)
>>>
>>>  (and my dream is that walter can use something like that internaly for
>>>  CTFEs)
>>
>> Yea, that was kind of my original motivation for it. I was really jealous 
>> of
>> Nemerle's approach to compile-time execution (AIUI, the Nemerle compiler
>> just invokes itself to compile the compile-time code, and then loads the
>> resulting DLL and runs it).
>
> yea the easiest approach - do you got a link to an good nemerle example of 
> this
>

Nemerle does it with their macros:

http://nemerle.org/Macros_tutorial#Compiling_a_simplest_macro

A few things to keep in mind about that:

1. Nemerle macros are functions that run at compile-time and return syntax 
trees which are then "mixed in" automatically.

2. The <[xxx]> syntax basically means (in D-ish psuedo-code): 
(xxx).syntaxTreeOf

3. In Nemerle, like Ruby, putting an expression/value as the last statement 
in a function basically counts as an implicit "return ...;" statement.

4. Apperently I was wrong in my understanding that Nemerle invokes itself 
automatically to compile compile-time code. Apperently *you* have to compile 
it into a DLL first, and *then* you "link" it in (really you "reference" it 
on the command line) when you compile any code that uses it. I like my idea 
better :)

5. Combining <[xxx]> with Nemerle's very, very nice "match" syntax gives 
Nemerle D's fabled "AST macros", and in a more flexible, orthogonal way 
(Nemerle's match is like switch, but match is a Ferarri and switch is a 
Pinto).

I really need to actually download the Nemerle compiler and try this stuff 
out though. I've still never done so yet. So it's possible my 
interpretations of the documentation may be inaccurate.


>>I figured there was nothing stopping a
>> native-compiled langauge from doing essentially the same. To me,
>
> and without the need for generating a DLL (could be an option)
>
> (but i hope D will get its own "dynamic module" as an abstraction over 
> Windows .DLL or Linux .SO that can be maybe used)
>

There was the DDL project awhile ago that looked promising. I don't know 
whether it's still around or not, though.


> > that
>> sounded like "compile-time eval()", so it seemed to make sence to start 
>> with
>> a run-time eval() (already done, more or less, and potentially useful in
>> it's own right) and then toss in whatever compiler hacks/intrinsics would 
>> be
>> needed to make a ctfe-version possible (still "todo").
>
> a ctf-version of eval or using this idea as an evaluation base (combined 
> with an AST which is able to give D informations like pure, static, const 
> ...) so there no extra ctfe "intepreter" needed (which can't sadly not 
> evolve at the speed the language do)
>

Did this get garbled somehow? I don't understand. (But maybe it's just me, I 
barely got any sleep.)





Re: One more update on d-programming-language.org

2010-09-17 Thread retard
Fri, 17 Sep 2010 20:18:47 +, Philippe Sigaud wrote:

> == Quote from retard (r...@tard.com.invalid)'s article
>> Fri, 17 Sep 2010 21:02:56 +0200, Philippe Sigaud wrote:
> 
>> > class="Apple-style-span" >>
>> > color="#88">
(snip that) > (the horror, the horror!) > >> > me.Are my messages always this garbled to >> > you?Philippe > >> Yes :-) > > Sorry for that :( > That seems to be related to this: > > http://www.google.com/support/forum/p/gmail/thread? tid=30e43148bffd7e07&hl=en > > What's strange is this Apple- parts the guy also has in his mails. I > never touched an Apple-related product in my life. I just have no > incentive to do so. My box is dual-boot linux/windows, so I really don't > how these come from. > Maybe it's when I use gmail to reply to someone who posted from an > iPhone? Seems convoluted to me. > > Denis: >> I believe you can disable html output in gmail settings. Although I see >> it perfectly fine, mono-width font is a lot better for perception for >> me. > > I much prefer monospace too, and in fact I'm reading all these mails as > monospace. I also always disable any HTML in my mail clients. Though I > can't find any gmail option related to this right now. > > Oh well, maybe I'll just download a newsreader or something. > > Philippe I think what you're using gets confused when answering to posts with html content. For example this post works just fine. Only some threads are broken. It's probably caused by the original html enabled post from some iPhone. I haven't seen html being used in news before so don't know if my client is too ancient.

Re: eval() (Was: One more update on d-programming-language.org)

2010-09-17 Thread dennis luehring

Am 17.09.2010 09:51, schrieb Nick Sabalausky:

 One thing that could be used for that is the eval() function I've
 recently
 added to my SemiTwist D Tools library:

 
http://www.dsource.org/projects/semitwist/browser/trunk/src/semitwist/util/process.d

 Example:
 -
 import semitwist.util.all;
 void main()
 {
  auto x = eval!int(q{ return 21 * 2; }); // String can be
 runtime-generated
  assert(x == 42);

  eval!void( q{ writeln("Hello World"); }, q{ import std.stdio; } );
 }
 -


 is that something like an "runtime" mixin

 would be great to have something like that in the standard - then i can
 stop writing my own script interpreter for my at runtime loaded DSLs :-)

 (and my dream is that walter can use something like that internaly for
 CTFEs)


Yea, that was kind of my original motivation for it. I was really jealous of
Nemerle's approach to compile-time execution (AIUI, the Nemerle compiler
just invokes itself to compile the compile-time code, and then loads the
resulting DLL and runs it).


yea the easiest approach - do you got a link to an good nemerle example 
of this



I figured there was nothing stopping a
native-compiled langauge from doing essentially the same. To me,


and without the need for generating a DLL (could be an option)

(but i hope D will get its own "dynamic module" as an abstraction over 
Windows .DLL or Linux .SO that can be maybe used)


> that

sounded like "compile-time eval()", so it seemed to make sence to start with
a run-time eval() (already done, more or less, and potentially useful in
it's own right) and then toss in whatever compiler hacks/intrinsics would be
needed to make a ctfe-version possible (still "todo").


a ctf-version of eval or using this idea as an evaluation base (combined 
with an AST which is able to give D informations like pure, static, 
const ...) so there no extra ctfe "intepreter" needed (which can't sadly 
not evolve at the speed the language do)




Re: One more update on d-programming-language.org

2010-09-17 Thread piotrek
On Fri, 17 Sep 2010 19:57:44 +, retard wrote:

> Fri, 17 Sep 2010 15:53:41 -0400, Steven Schveighoffer wrote:
> 
>> On Fri, 17 Sep 2010 15:39:19 -0400, retard  wrote:
>> 
>>> Fri, 17 Sep 2010 21:02:56 +0200, Philippe Sigaud wrote:
>>>
 On Fri, Sep 17, 2010 at 02:36, Nick Sabalausky  wrote:

> "retard"  wrote in message
> news:i6ubrl$2dj...@digitalmars.com...
> > Thu, 16 Sep 2010 21:32:16 +0200, Philippe Sigaud wrote:
> >
> >> On Thu, Sep 16, 2010 at 10:07, Lars T. Kyllingstad
> >>  wrote:
> >>
> >>> > As for this particular bug: thanks Walter!
> >>> >
> >>> > Philippe
> >>>
> >>>
> >>> Actually, Johannes deserves your thanks for this one -- he wrote
> >>> the patch. :)
> >>>
> >>>
> >> I heartily thank Johannes.
> >> On Thu, Sep 16, 2010 at 10:07, Lars T.
> >> Kyllingstad  >> dir="ltr">
> >> wrote:  >> class="im">> As for this particular bug: thanks
> >> Walter! > > Philippe
> >> 
> >> 
> >> Actually, Johannes deserves your thanks for this one -- he
> >> wrote the patch. :) >> color="#88">I
> >> heartily thank Johannes. 
> >
> > You should stop using that html mumbo jumbo. Proper news readers
> > can't handle it.
>
> I use Outlook Express with HTML turned off, and it came out fine for
> me. I didn't see any of those tags. What reader are you using?
>>>
>>> I'm using Pan. This has worked just fine so far. Don't know what's
>>> causing this now.
>> 
>> When I first switched over to Linux, I used Pan, but IIRC, the ordering
>> was too difficult to deal with.  There were some other issues, but I
>> can't remember what they were now.
>> 
>> Opera is definitely the best one I've tried on Linux.
>> 
>> -Steve
> 
> Pan is more lightweight. Yes, I have a Core i7 with 24 GB of RAM, but am
> still using the same desktop applications I had 10 years ago. If the
> html garbage doesn't bother anyone else, I might as well shut up. Just
> mentioned - thought there might be a simple fix.

I also use Pan and I see that html garbage as well. Hopefully not too 
many will switch to that combined format.

BTW. Pan is the only option for me on netbook. 

Cheers
Piotrek


Re: One more update on d-programming-language.org

2010-09-17 Thread Philippe Sigaud
== Quote from retard (r...@tard.com.invalid)'s article
> Fri, 17 Sep 2010 21:02:56 +0200, Philippe Sigaud wrote:

> > class="Apple-style-span" >>
> > color="#88">
> me.Are my messages always this garbled to > > you?Philippe > Yes :-) Sorry for that :( That seems to be related to this: http://www.google.com/support/forum/p/gmail/thread?tid=30e43148bffd7e07&hl=en What's strange is this Apple- parts the guy also has in his mails. I never touched an Apple-related product in my life. I just have no incentive to do so. My box is dual-boot linux/windows, so I really don't how these come from. Maybe it's when I use gmail to reply to someone who posted from an iPhone? Seems convoluted to me. Denis: > I believe you can disable html output in gmail settings. > Although I see it perfectly fine, mono-width font is a lot better for > perception for me. I much prefer monospace too, and in fact I'm reading all these mails as monospace. I also always disable any HTML in my mail clients. Though I can't find any gmail option related to this right now. Oh well, maybe I'll just download a newsreader or something. Philippe

Re: One more update on d-programming-language.org

2010-09-17 Thread retard
Fri, 17 Sep 2010 15:53:41 -0400, Steven Schveighoffer wrote:

> On Fri, 17 Sep 2010 15:39:19 -0400, retard  wrote:
> 
>> Fri, 17 Sep 2010 21:02:56 +0200, Philippe Sigaud wrote:
>>
>>> On Fri, Sep 17, 2010 at 02:36, Nick Sabalausky  wrote:
>>>
 "retard"  wrote in message
 news:i6ubrl$2dj...@digitalmars.com...
 > Thu, 16 Sep 2010 21:32:16 +0200, Philippe Sigaud wrote:
 >
 >> On Thu, Sep 16, 2010 at 10:07, Lars T. Kyllingstad
 >>  wrote:
 >>
 >>> > As for this particular bug: thanks Walter!
 >>> >
 >>> > Philippe
 >>>
 >>>
 >>> Actually, Johannes deserves your thanks for this one -- he wrote
 >>> the patch. :)
 >>>
 >>>
 >> I heartily thank Johannes.
 >> On Thu, Sep 16, 2010 at 10:07, Lars T.
 >> Kyllingstad >>> >> dir="ltr">
 >> wrote: >>> >> class="im">> As for this particular bug: thanks
 >> Walter! >
 >> > Philippe
 >> 
 >> 
 >> Actually, Johannes deserves your thanks for this one -- he
 >> wrote the patch. :)>>> >> color="#88">I
 >> heartily thank Johannes. 
 >
 > You should stop using that html mumbo jumbo. Proper news readers
 > can't handle it.

 I use Outlook Express with HTML turned off, and it came out fine for
 me. I didn't see any of those tags. What reader are you using?
>>
>> I'm using Pan. This has worked just fine so far. Don't know what's
>> causing this now.
> 
> When I first switched over to Linux, I used Pan, but IIRC, the ordering
> was too difficult to deal with.  There were some other issues, but I
> can't remember what they were now.
> 
> Opera is definitely the best one I've tried on Linux.
> 
> -Steve

Pan is more lightweight. Yes, I have a Core i7 with 24 GB of RAM, but am 
still using the same desktop applications I had 10 years ago. If the html 
garbage doesn't bother anyone else, I might as well shut up. Just 
mentioned - thought there might be a simple fix.


Re: One more update on d-programming-language.org

2010-09-17 Thread Steven Schveighoffer

On Fri, 17 Sep 2010 15:39:19 -0400, retard  wrote:


Fri, 17 Sep 2010 21:02:56 +0200, Philippe Sigaud wrote:


On Fri, Sep 17, 2010 at 02:36, Nick Sabalausky  wrote:


"retard"  wrote in message
news:i6ubrl$2dj...@digitalmars.com...
> Thu, 16 Sep 2010 21:32:16 +0200, Philippe Sigaud wrote:
>
>> On Thu, Sep 16, 2010 at 10:07, Lars T. Kyllingstad
>>  wrote:
>>
>>> > As for this particular bug: thanks Walter!
>>> >
>>> > Philippe
>>>
>>>
>>> Actually, Johannes deserves your thanks for this one -- he wrote
>>> the patch. :)
>>>
>>>
>> I heartily thank Johannes.
>> On Thu, Sep 16, 2010 at 10:07, Lars T.
>> Kyllingstad > dir="ltr">
>> wrote: > class="im">> As for this particular bug: thanks Walter!> class="im"> >
>> > Philippe
>> 
>> 
>> Actually, Johannes deserves your thanks for this one -- he
>> wrote the patch. :)> color="#88">I
>> heartily thank Johannes. 
>
> You should stop using that html mumbo jumbo. Proper news readers
> can't handle it.

I use Outlook Express with HTML turned off, and it came out fine for
me. I didn't see any of those tags. What reader are you using?


I'm using Pan. This has worked just fine so far. Don't know what's
causing this now.


When I first switched over to Linux, I used Pan, but IIRC, the ordering  
was too difficult to deal with.  There were some other issues, but I can't  
remember what they were now.


Opera is definitely the best one I've tried on Linux.

-Steve


Re: One more update on d-programming-language.org

2010-09-17 Thread retard
Fri, 17 Sep 2010 21:02:56 +0200, Philippe Sigaud wrote:

> On Fri, Sep 17, 2010 at 02:36, Nick Sabalausky  wrote:
> 
>> "retard"  wrote in message
>> news:i6ubrl$2dj...@digitalmars.com...
>> > Thu, 16 Sep 2010 21:32:16 +0200, Philippe Sigaud wrote:
>> >
>> >> On Thu, Sep 16, 2010 at 10:07, Lars T. Kyllingstad
>> >>  wrote:
>> >>
>> >>> > As for this particular bug: thanks Walter!
>> >>> >
>> >>> > Philippe
>> >>>
>> >>>
>> >>> Actually, Johannes deserves your thanks for this one -- he wrote
>> >>> the patch. :)
>> >>>
>> >>>
>> >> I heartily thank Johannes.
>> >> On Thu, Sep 16, 2010 at 10:07, Lars T.
>> >> Kyllingstad > >> dir="ltr">
>> >> wrote: > >> class="im">> As for this particular bug: thanks Walter!> >> class="im"> >
>> >> > Philippe
>> >> 
>> >> 
>> >> Actually, Johannes deserves your thanks for this one -- he
>> >> wrote the patch. :)> >> color="#88">I
>> >> heartily thank Johannes. 
>> >
>> > You should stop using that html mumbo jumbo. Proper news readers
>> > can't handle it.
>>
>> I use Outlook Express with HTML turned off, and it came out fine for
>> me. I didn't see any of those tags. What reader are you using?

I'm using Pan. This has worked just fine so far. Don't know what's 
causing this now.


> And I don't do anything more than hitting "Reply" in gmail. These lists
> are all mail to me.
> Are my messages always this garbled to you?
> 
> Philippe
> On Fri, Sep 17, 2010 at 02:36, Nick Sabalausky
>  wrote: class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc
> solid;padding-left:1ex;"> "retard" 
> wrote in message news:i6ubrl$2dj...@digitalmars.com...
> > Thu, 16 Sep 2010 21:32:16 +0200,
> Philippe Sigaud wrote: >
> >> On Thu, Sep 16, 2010 at 10:07, Lars T. Kyllingstad >>
>  wrote: >>
> >>> > As for this particular bug: thanks Walter!
> >>> >
> >>> > Philippe
> >>>
> >>>
> >>> Actually, Johannes deserves your thanks for this one -- he
> wrote the >>> patch. :)
> >>>
> >>>
> >> I heartily thank Johannes. >> 
class="gmail_quote">On Thu, Sep 16, 2010 at 10:07, Lars > T. >> Kyllingstad dir="ltr"><pub...@kyllingen.nospamnet> > >> wrote:
style="margin:0 0 0 >> .8ex;border-left:1px #ccc > solid;padding-left:1ex;">
class="im">> >> As for this particular > bug: thanks Walter!
> >> >
> >> > Philippe
>>
> >>
> >>
Actually, Johannes deserves your thanks for this > one -- he wrote >> the
patch. :)
class="Apple-style-span" >> > color="#88">

I > heartily >> thank Johannes.
> > > > You should stop using that html mumbo jumbo. Proper news readers > can't > handle it. > > I use Outlook Express with HTML turned off, and it came out > fine for me. I didn't see any of those tags. What reader are you > using? >  And I don't do anything more than > hitting "Reply" in gmail. These lists are all mail to > me.Are my messages always this garbled to > you?Philippe Yes :-)

Re: One more update on d-programming-language.org

2010-09-17 Thread Denis Koroskin
On Fri, 17 Sep 2010 23:02:56 +0400, Philippe Sigaud  
 wrote:



On Fri, Sep 17, 2010 at 02:36, Nick Sabalausky  wrote:


"retard"  wrote in message
news:i6ubrl$2dj...@digitalmars.com...
> Thu, 16 Sep 2010 21:32:16 +0200, Philippe Sigaud wrote:
>
>> On Thu, Sep 16, 2010 at 10:07, Lars T. Kyllingstad
>>  wrote:
>>
>>> > As for this particular bug: thanks Walter!
>>> >
>>> > Philippe
>>>
>>>
>>> Actually, Johannes deserves your thanks for this one -- he wrote the
>>> patch. :)
>>>
>>>
>> I heartily thank Johannes.
>> On Thu, Sep 16, 2010 at 10:07, Lars T.
>> Kyllingstad 
>> wrote: class="im">>

>> As for this particular bug: thanks Walter!
>> >
>> > Philippe
>> 
>> 
>> Actually, Johannes deserves your thanks for this one -- he  
wrote

>> the patch. :)>> color="#88">I  
heartily

>> thank Johannes. 
>
> You should stop using that html mumbo jumbo. Proper news readers can't
> handle it.

I use Outlook Express with HTML turned off, and it came out fine for  
me. I

didn't see any of those tags. What reader are you using?



And I don't do anything more than hitting "Reply" in gmail. These lists  
are

all mail to me.
Are my messages always this garbled to you?

Philippe


I believe you can disable html output in gmail settings. Although I see it  
perfectly fine, mono-width font is a lot better for perception for me.


Re: One more update on d-programming-language.org

2010-09-17 Thread Philippe Sigaud
On Fri, Sep 17, 2010 at 02:36, Nick Sabalausky  wrote:

> "retard"  wrote in message
> news:i6ubrl$2dj...@digitalmars.com...
> > Thu, 16 Sep 2010 21:32:16 +0200, Philippe Sigaud wrote:
> >
> >> On Thu, Sep 16, 2010 at 10:07, Lars T. Kyllingstad
> >>  wrote:
> >>
> >>> > As for this particular bug: thanks Walter!
> >>> >
> >>> > Philippe
> >>>
> >>>
> >>> Actually, Johannes deserves your thanks for this one -- he wrote the
> >>> patch. :)
> >>>
> >>>
> >> I heartily thank Johannes.
> >> On Thu, Sep 16, 2010 at 10:07, Lars T.
> >> Kyllingstad 
> >> wrote: >
> >> As for this particular bug: thanks Walter!
> >> >
> >> > Philippe
> >> 
> >> 
> >> Actually, Johannes deserves your thanks for this one -- he wrote
> >> the patch. :) >> color="#88">I heartily
> >> thank Johannes. 
> >
> > You should stop using that html mumbo jumbo. Proper news readers can't
> > handle it.
>
> I use Outlook Express with HTML turned off, and it came out fine for me. I
> didn't see any of those tags. What reader are you using?
>
>
>
And I don't do anything more than hitting "Reply" in gmail. These lists are
all mail to me.
Are my messages always this garbled to you?

Philippe


Re: eval() (Was: One more update on d-programming-language.org)

2010-09-17 Thread Nick Sabalausky
"dennis luehring"  wrote in message 
news:i6uv32$1ij...@digitalmars.com...
> On 15.09.2010 22:19, Nick Sabalausky wrote:
>> "Philippe Sigaud"  wrote in message
>> news:mailman.214.1284496545.858.digitalmar...@puremagic.com...
>>> On Tue, Sep 14, 2010 at 17:01, Andrei Alexandrescu<
>>> seewebsiteforem...@erdani.org>  wrote:

   I think we'll move forward with that one. I'll start working on the
>>> content. Ideas for good tutorial examples?

>>>
>>> Maybe more examples of what's interesting me right now than tutorials, 
>>> but
>>> who knows?
>>>
>>> * executing command-lines instructions from a D program. Theme: file 
>>> I/O,
>>> OS
>>> interaction.
>>> An interesting example is having a script that loads a D file, modifies
>>> its
>>> source, asks for DMD to compile it and then runs it and get its result. 
>>> It
>>> could be the first brick to get a REPL / idmd (interactive dmd). Maybe
>>> more
>>> a [challenge] subject than a tutorial example?
>>>
>>
>> One thing that could be used for that is the eval() function I've 
>> recently
>> added to my SemiTwist D Tools library:
>>
>> http://www.dsource.org/projects/semitwist/browser/trunk/src/semitwist/util/process.d
>>
>> Example:
>> -
>> import semitwist.util.all;
>> void main()
>> {
>>  auto x = eval!int(q{ return 21 * 2; }); // String can be
>> runtime-generated
>>  assert(x == 42);
>>
>>  eval!void( q{ writeln("Hello World"); }, q{ import std.stdio; } );
>> }
>> -
>
> is that something like an "runtime" mixin
>
> would be great to have something like that in the standard - then i can 
> stop writing my own script interpreter for my at runtime loaded DSLs :-)
>
> (and my dream is that walter can use something like that internaly for 
> CTFEs)

Yea, that was kind of my original motivation for it. I was really jealous of 
Nemerle's approach to compile-time execution (AIUI, the Nemerle compiler 
just invokes itself to compile the compile-time code, and then loads the 
resulting DLL and runs it). I figured there was nothing stopping a 
native-compiled langauge from doing essentially the same. To me, that 
sounded like "compile-time eval()", so it seemed to make sence to start with 
a run-time eval() (already done, more or less, and potentially useful in 
it's own right) and then toss in whatever compiler hacks/intrinsics would be 
needed to make a ctfe-version possible (still "todo").




Re: eval() (Was: One more update on d-programming-language.org)

2010-09-16 Thread dennis luehring

On 15.09.2010 22:19, Nick Sabalausky wrote:

"Philippe Sigaud"  wrote in message
news:mailman.214.1284496545.858.digitalmar...@puremagic.com...

On Tue, Sep 14, 2010 at 17:01, Andrei Alexandrescu<
seewebsiteforem...@erdani.org>  wrote:


  I think we'll move forward with that one. I'll start working on the

content. Ideas for good tutorial examples?




Maybe more examples of what's interesting me right now than tutorials, but
who knows?

* executing command-lines instructions from a D program. Theme: file I/O,
OS
interaction.
An interesting example is having a script that loads a D file, modifies
its
source, asks for DMD to compile it and then runs it and get its result. It
could be the first brick to get a REPL / idmd (interactive dmd). Maybe
more
a [challenge] subject than a tutorial example?



One thing that could be used for that is the eval() function I've recently
added to my SemiTwist D Tools library:

http://www.dsource.org/projects/semitwist/browser/trunk/src/semitwist/util/process.d

Example:
-
import semitwist.util.all;
void main()
{
 auto x = eval!int(q{ return 21 * 2; }); // String can be
runtime-generated
 assert(x == 42);

 eval!void( q{ writeln("Hello World"); }, q{ import std.stdio; } );
}
-


is that something like an "runtime" mixin

would be great to have something like that in the standard - then i can 
stop writing my own script interpreter for my at runtime loaded DSLs :-)


(and my dream is that walter can use something like that internaly for 
CTFEs)


Re: One more update on d-programming-language.org

2010-09-16 Thread Nick Sabalausky
"retard"  wrote in message 
news:i6ubrl$2dj...@digitalmars.com...
> Thu, 16 Sep 2010 21:32:16 +0200, Philippe Sigaud wrote:
>
>> On Thu, Sep 16, 2010 at 10:07, Lars T. Kyllingstad
>>  wrote:
>>
>>> > As for this particular bug: thanks Walter!
>>> >
>>> > Philippe
>>>
>>>
>>> Actually, Johannes deserves your thanks for this one -- he wrote the
>>> patch. :)
>>>
>>>
>> I heartily thank Johannes.
>> On Thu, Sep 16, 2010 at 10:07, Lars T.
>> Kyllingstad 
>> wrote: >
>> As for this particular bug: thanks Walter!
>> >
>> > Philippe
>> 
>> 
>> Actually, Johannes deserves your thanks for this one -- he wrote
>> the patch. :)> color="#88">I heartily
>> thank Johannes. 
>
> You should stop using that html mumbo jumbo. Proper news readers can't
> handle it.

I use Outlook Express with HTML turned off, and it came out fine for me. I 
didn't see any of those tags. What reader are you using?




Re: eval() (Was: One more update on d-programming-language.org)

2010-09-16 Thread Nick Sabalausky
"Philippe Sigaud"  wrote in message 
news:mailman.232.1284670065.858.digitalmar...@puremagic.com...
> On Wed, Sep 15, 2010 at 22:19, Nick Sabalausky  wrote:
>
>> One thing that could be used for that is the eval() function I've 
>> recently
>> added to my SemiTwist D Tools library:
>>
>>
>> http://www.dsource.org/projects/semitwist/browser/trunk/src/semitwist/util/process.d
>>
>> Example:
>> -
>> import semitwist.util.all;
>> void main()
>> {
>>auto x = eval!int(q{ return 21 * 2; }); // String can be
>> runtime-generated
>>assert(x == 42);
>>
>>eval!void( q{ writeln("Hello World"); }, q{ import std.stdio; } );
>> }
>>
>
> Oh, interesting!
> I had a look at your code. I like this part:
>
> code = boilerplate.format(imports, TRet.stringof, code);
>

Yea, I love format :). It has all sorts of nifty applications. Although, 
what I'd really like is a utility more like this:

"Hello $(name), the answer is $(answer)".populate(["name":"Mr. Prefect", 
"answer":"42"])

Which really wouldn't be hard to do. And maybe beef it up by having it take 
a Variant[string] instead of string[string]. And maybe make the template 
string optionally a template parameter so it can pre-parse it at 
compile-time.

But format's a very nice next-best-thing.

> Inside boilerplate, I wonder if it's possible to test for auto ret = 
> _main()
> inside a static if(is(typeof(  )))? That way, if _main() 'returns' a void,
> the static if won't check and you know you have a void return value.
>

Not sure I get what you mean or what benefit you're going for here...?




Re: One more update on d-programming-language.org

2010-09-16 Thread retard
Thu, 16 Sep 2010 21:32:16 +0200, Philippe Sigaud wrote:

> On Thu, Sep 16, 2010 at 10:07, Lars T. Kyllingstad
>  wrote:
> 
>> > As for this particular bug: thanks Walter!
>> >
>> > Philippe
>>
>>
>> Actually, Johannes deserves your thanks for this one -- he wrote the
>> patch. :)
>>
>>
> I heartily thank Johannes.
> On Thu, Sep 16, 2010 at 10:07, Lars T.
> Kyllingstad 
> wrote: >
> As for this particular bug: thanks Walter!
> >
> > Philippe
> 
> 
> Actually, Johannes deserves your thanks for this one -- he wrote
> the patch. :) color="#88">I heartily
> thank Johannes. 

You should stop using that html mumbo jumbo. Proper news readers can't 
handle it. 


Re: eval() (Was: One more update on d-programming-language.org)

2010-09-16 Thread Philippe Sigaud
On Wed, Sep 15, 2010 at 22:19, Nick Sabalausky  wrote:

> One thing that could be used for that is the eval() function I've recently
> added to my SemiTwist D Tools library:
>
>
> http://www.dsource.org/projects/semitwist/browser/trunk/src/semitwist/util/process.d
>
> Example:
> -
> import semitwist.util.all;
> void main()
> {
>auto x = eval!int(q{ return 21 * 2; }); // String can be
> runtime-generated
>assert(x == 42);
>
>eval!void( q{ writeln("Hello World"); }, q{ import std.stdio; } );
> }
>

Oh, interesting!
I had a look at your code. I like this part:

code = boilerplate.format(imports, TRet.stringof, code);

Inside boilerplate, I wonder if it's possible to test for auto ret = _main()
inside a static if(is(typeof(  )))? That way, if _main() 'returns' a void,
the static if won't check and you know you have a void return value.







> -
>
> It does require dmd and rdmd to be on the path.
>
> I hadn't posted anything about it before because it's still
> rough-around-the-edges and needs polish. For instance, most of the useful
> phobos modules aren't imported by default, and it doesn't yet support
> returning string/wstring/dstring - you have to return
> char[]/wchar[]/dchar[]
> instead and then convert back to string/wstring/dstring (but that shouldn't
> be too hard to fix). Also, on Windows it requires a patched version of
> rdmd,
> which is included with the library (
> http://www.dsource.org/projects/semitwist/browser/trunk/rdmdAlt.d ) but
> eval
> doesn't yet compile it if it isn't already compiled, and it assumes it's on
> the path (I've already solved both of these in the included stbuild
> program,
> I just need to move the solution over into the general library). My
> ultimate
> goal with this is to hack up DMD just enough to make it work at
> compile-time
> (so that *any* arbitrary code can be run at compile-time, albiet more
> awkwardly and with much more overhead than ordinary CTFE).
>
>
>
>


Re: One more update on d-programming-language.org

2010-09-16 Thread Philippe Sigaud
On Thu, Sep 16, 2010 at 10:07, Lars T. Kyllingstad
 wrote:

> > As for this particular bug: thanks Walter!
> >
> > Philippe
>
>
> Actually, Johannes deserves your thanks for this one -- he wrote the
> patch. :)
>
>
I heartily thank Johannes.


Re: One more update on d-programming-language.org

2010-09-16 Thread Robert Jacques

On Thu, 16 Sep 2010 03:59:03 -0400, Nick Sabalausky  wrote:


"Robert Jacques"  wrote in message
news:op.vi31l1jl26s...@sandford.myhome.westell.com...

On Thu, 09 Sep 2010 20:07:20 -0400, Andrei Alexandrescu
 wrote:


http://d-programming-language.org

 From David Gileadi: the annoying Google Translate bar behavior on
browsers with other languages has been fixed, the behavior when
shrinking and growing the window size has been improved, the Reddit
button is gone, and a few styles were changed.

Could have sworn I sent this already, it just disappeared.


Andrei


Hi Andrei,
The site still has major issues rendering with Opera (10.62). I've  
linked

to a screen-shot (http://i56.tinypic.com/wakrw5.png) This is simply not
usable. Given that I don't have any html experience, is there still
something I can do to help fix this? (because otherwise the new site  
looks

good.)


I've very little experience with Opera, but that looks like some sort of
internal redraw problem. And the HTML is very basic-looking to me.

Some things that might help narrow it down:

- Try turning off JS and reloading. (Maybe the translate widget is  
screwing

things up?)


Disabling plugins or disabling JS both seemed to fix the issue.


Re: One more update on d-programming-language.org

2010-09-16 Thread Andrei Alexandrescu

On 9/16/10 0:31 CDT, Robert Jacques wrote:

On Thu, 09 Sep 2010 20:07:20 -0400, Andrei Alexandrescu
 wrote:


http://d-programming-language.org

From David Gileadi: the annoying Google Translate bar behavior on
browsers with other languages has been fixed, the behavior when
shrinking and growing the window size has been improved, the Reddit
button is gone, and a few styles were changed.

Could have sworn I sent this already, it just disappeared.


Andrei


Hi Andrei,
The site still has major issues rendering with Opera (10.62). I've
linked to a screen-shot (http://i56.tinypic.com/wakrw5.png) This is
simply not usable. Given that I don't have any html experience, is there
still something I can do to help fix this? (because otherwise the new
site looks good.)


Thanks, Robert. I think we need to make sure we work with Opera at our best.

Andrei


Re: One more update on d-programming-language.org

2010-09-16 Thread David Gileadi

On 9/16/10 12:59 AM, Nick Sabalausky wrote:

"Robert Jacques"  wrote in message
news:op.vi31l1jl26s...@sandford.myhome.westell.com...

On Thu, 09 Sep 2010 20:07:20 -0400, Andrei Alexandrescu
  wrote:


http://d-programming-language.org

  From David Gileadi: the annoying Google Translate bar behavior on
browsers with other languages has been fixed, the behavior when
shrinking and growing the window size has been improved, the Reddit
button is gone, and a few styles were changed.

Could have sworn I sent this already, it just disappeared.


Andrei


Hi Andrei,
The site still has major issues rendering with Opera (10.62). I've linked
to a screen-shot (http://i56.tinypic.com/wakrw5.png) This is simply not
usable. Given that I don't have any html experience, is there still
something I can do to help fix this? (because otherwise the new site looks
good.)


I've very little experience with Opera, but that looks like some sort of
internal redraw problem. And the HTML is very basic-looking to me.

Some things that might help narrow it down:

- Try turning off JS and reloading. (Maybe the translate widget is screwing
things up?)

- See if Opera has a way to choose the stylesheet to use and/or a way to
disable style-sheets. If so, try switching to the embedded "print"
stylesheet, and try disabling it. If opera doesn't have that ability, do
this:

1. Save the HTML page source.

2. Save http://www.d-programming-language.org/css/print.css to the same
directory.

3. Edit the HTML page, and on this line near the top:
   
   ...change "css/style.css" to just "print.css", and open the HTML page
in Opera. See how that looks.

4. Edit the HTML page again and remove these two lines:
   
   
...and open it again and see how that looks.




Good suggestions.  May I also suggest sending that screenshot to the 
Opera developers? http://www.opera.com/support/bugs/


Re: One more update on d-programming-language.org

2010-09-16 Thread Yao G.

On Thu, 16 Sep 2010 03:48:07 -0500, retard  wrote:


Have you considered using the community driven doc gen? Was it 'dil' or
something?


Kandil. I know about it but I haven't tried it. I'll check if it supports  
D2.


Thanks.

--
Yao G.


Re: One more update on d-programming-language.org

2010-09-16 Thread retard
Thu, 16 Sep 2010 03:15:54 -0500, Yao G. wrote:

> On Thu, 16 Sep 2010 02:32:59 -0500, Lutger
>  wrote:
> 
>> Just for reference, this is the easy way to start fixing sites if you
>> don't know
>> where to begin:
>>
>> http://validator.w3.org/check?verbose=1&uri=http://d-programming-
language.org/
>>
>> The css validates 100%: http://jigsaw.w3.org/css-
>> validator/validator?profile=css3&warning=2&uri=http://d-programming-
>> language.org/
> 
> I had a hell of a time trying to make DDOC generate valid documentation.
> It has a lot of inconsistencies or just plain weird and non-uniform ways
> to treat some standard macros. I had to resort to define macros with
> invalid markup, and those, assembled together would end up creating
> valid HTML 4.01 Strict documents. Ironic, I know. Maybe is that I just
> don't understand well how DDOC works. Go figure.
> 
> Not to mention few weeks ago when I tried to generate valid XML/DocBook
> files. I just gave up after a couple of hours. It's impossible.  :(

Have you considered using the community driven doc gen? Was it 'dil' or 
something?


Re: One more update on d-programming-language.org

2010-09-16 Thread Yao G.
On Thu, 16 Sep 2010 02:32:59 -0500, Lutger   
wrote:


Just for reference, this is the easy way to start fixing sites if you  
don't know

where to begin:

http://validator.w3.org/check?verbose=1&uri=http://d-programming-language.org/

The css validates 100%: http://jigsaw.w3.org/css-
validator/validator?profile=css3&warning=2&uri=http://d-programming-
language.org/


I had a hell of a time trying to make DDOC generate valid documentation.  
It has a lot of inconsistencies or just plain weird and non-uniform ways  
to treat some standard macros. I had to resort to define macros with  
invalid markup, and those, assembled together would end up creating valid  
HTML 4.01 Strict documents. Ironic, I know. Maybe is that I just don't  
understand well how DDOC works. Go figure.


Not to mention few weeks ago when I tried to generate valid XML/DocBook  
files. I just gave up after a couple of hours. It's impossible.  :(



--
Yao G.


Re: One more update on d-programming-language.org

2010-09-16 Thread Lars T. Kyllingstad
On Wed, 15 Sep 2010 18:25:50 +0200, Philippe Sigaud wrote:

> On Wed, Sep 15, 2010 at 17:50, Johannes Pfau  wrote:
> 
>> On 14.09.2010 22:35, Philippe Sigaud wrote:
>> > * a small script that find ddocs comments from D code and find any
>> > frig missing parenthesis, telling the user were in the file she
>> > should look (and range of line spanning the comment). Finding ddocs
>> > comments and counting open/closed parenthesis is a simple example of
>> > parsing/finite state automata.
>> >
>> >
>> That has been fixed in dmd:
>> http://d.puremagic.com/issues/show_bug.cgi?id=3554
>> http://www.dsource.org/projects/dmd/changeset/620
>>
>>
> Wow, I didn't know this (obviously). There has been a steady stream of
> small and not-so-small improvements over the past few months that makes
> D even more attractive to me. After Don squashing bugs/limitations in
> CTFE, David went into a killing spree on algorithm/range bugs that's
> impressive to behold.
> As for this particular bug: thanks Walter!
> 
> Philippe


Actually, Johannes deserves your thanks for this one -- he wrote the 
patch. :)

-Lars


Re: One more update on d-programming-language.org

2010-09-16 Thread Nick Sabalausky
"Robert Jacques"  wrote in message 
news:op.vi31l1jl26s...@sandford.myhome.westell.com...
> On Thu, 09 Sep 2010 20:07:20 -0400, Andrei Alexandrescu
>  wrote:
>
>> http://d-programming-language.org
>>
>>  From David Gileadi: the annoying Google Translate bar behavior on 
>> browsers with other languages has been fixed, the behavior when 
>> shrinking and growing the window size has been improved, the Reddit 
>> button is gone, and a few styles were changed.
>>
>> Could have sworn I sent this already, it just disappeared.
>>
>>
>> Andrei
>
> Hi Andrei,
> The site still has major issues rendering with Opera (10.62). I've linked 
> to a screen-shot (http://i56.tinypic.com/wakrw5.png) This is simply not 
> usable. Given that I don't have any html experience, is there still 
> something I can do to help fix this? (because otherwise the new site looks 
> good.)

I've very little experience with Opera, but that looks like some sort of 
internal redraw problem. And the HTML is very basic-looking to me.

Some things that might help narrow it down:

- Try turning off JS and reloading. (Maybe the translate widget is screwing 
things up?)

- See if Opera has a way to choose the stylesheet to use and/or a way to 
disable style-sheets. If so, try switching to the embedded "print" 
stylesheet, and try disabling it. If opera doesn't have that ability, do 
this:

   1. Save the HTML page source.

   2. Save http://www.d-programming-language.org/css/print.css to the same 
directory.

   3. Edit the HTML page, and on this line near the top:
  
  ...change "css/style.css" to just "print.css", and open the HTML page 
in Opera. See how that looks.

   4. Edit the HTML page again and remove these two lines:
  
  
   ...and open it again and see how that looks.




Re: One more update on d-programming-language.org

2010-09-16 Thread Lutger
Robert Jacques wrote:

> On Thu, 09 Sep 2010 20:07:20 -0400, Andrei Alexandrescu
>  wrote:
> 
>> http://d-programming-language.org
>>
>>  From David Gileadi: the annoying Google Translate bar behavior on
>> browsers with other languages has been fixed, the behavior when
>> shrinking and growing the window size has been improved, the Reddit
>> button is gone, and a few styles were changed.
>>
>> Could have sworn I sent this already, it just disappeared.
>>
>>
>> Andrei
> 
> Hi Andrei,
> The site still has major issues rendering with Opera (10.62). I've linked
> to a screen-shot (http://i56.tinypic.com/wakrw5.png) This is simply not
> usable. Given that I don't have any html experience, is there still
> something I can do to help fix this? (because otherwise the new site looks
> good.)

Just for reference, this is the easy way to start fixing sites if you don't 
know 
where to begin:

http://validator.w3.org/check?verbose=1&uri=http://d-programming-language.org/

The css validates 100%: http://jigsaw.w3.org/css-
validator/validator?profile=css3&warning=2&uri=http://d-programming-
language.org/




Re: One more update on d-programming-language.org

2010-09-15 Thread Robert Jacques

On Thu, 09 Sep 2010 20:07:20 -0400, Andrei Alexandrescu
 wrote:


http://d-programming-language.org

 From David Gileadi: the annoying Google Translate bar behavior on  
browsers with other languages has been fixed, the behavior when  
shrinking and growing the window size has been improved, the Reddit  
button is gone, and a few styles were changed.


Could have sworn I sent this already, it just disappeared.


Andrei


Hi Andrei,
The site still has major issues rendering with Opera (10.62). I've linked  
to a screen-shot (http://i56.tinypic.com/wakrw5.png) This is simply not  
usable. Given that I don't have any html experience, is there still  
something I can do to help fix this? (because otherwise the new site looks  
good.)


eval() (Was: One more update on d-programming-language.org)

2010-09-15 Thread Nick Sabalausky
"Philippe Sigaud"  wrote in message 
news:mailman.214.1284496545.858.digitalmar...@puremagic.com...
> On Tue, Sep 14, 2010 at 17:01, Andrei Alexandrescu <
> seewebsiteforem...@erdani.org> wrote:
>>
>>  I think we'll move forward with that one. I'll start working on the
> content. Ideas for good tutorial examples?
>>
>
> Maybe more examples of what's interesting me right now than tutorials, but
> who knows?
>
> * executing command-lines instructions from a D program. Theme: file I/O, 
> OS
> interaction.
> An interesting example is having a script that loads a D file, modifies 
> its
> source, asks for DMD to compile it and then runs it and get its result. It
> could be the first brick to get a REPL / idmd (interactive dmd). Maybe 
> more
> a [challenge] subject than a tutorial example?
>

One thing that could be used for that is the eval() function I've recently 
added to my SemiTwist D Tools library:

http://www.dsource.org/projects/semitwist/browser/trunk/src/semitwist/util/process.d

Example:
-
import semitwist.util.all;
void main()
{
auto x = eval!int(q{ return 21 * 2; }); // String can be 
runtime-generated
assert(x == 42);

eval!void( q{ writeln("Hello World"); }, q{ import std.stdio; } );
}
-

It does require dmd and rdmd to be on the path.

I hadn't posted anything about it before because it's still 
rough-around-the-edges and needs polish. For instance, most of the useful 
phobos modules aren't imported by default, and it doesn't yet support 
returning string/wstring/dstring - you have to return char[]/wchar[]/dchar[] 
instead and then convert back to string/wstring/dstring (but that shouldn't 
be too hard to fix). Also, on Windows it requires a patched version of rdmd, 
which is included with the library ( 
http://www.dsource.org/projects/semitwist/browser/trunk/rdmdAlt.d ) but eval 
doesn't yet compile it if it isn't already compiled, and it assumes it's on 
the path (I've already solved both of these in the included stbuild program, 
I just need to move the solution over into the general library). My ultimate 
goal with this is to hack up DMD just enough to make it work at compile-time 
(so that *any* arbitrary code can be run at compile-time, albiet more 
awkwardly and with much more overhead than ordinary CTFE).





Re: One more update on d-programming-language.org

2010-09-15 Thread Philippe Sigaud
On Wed, Sep 15, 2010 at 17:50, Johannes Pfau  wrote:

> On 14.09.2010 22:35, Philippe Sigaud wrote:
> > * a small script that find ddocs comments from D code and find any
> > frig missing parenthesis, telling the user were in the file she
> > should look (and range of line spanning the comment). Finding ddocs
> > comments and counting open/closed parenthesis is a simple example of
> > parsing/finite state automata.
> >
>
> That has been fixed in dmd:
> http://d.puremagic.com/issues/show_bug.cgi?id=3554
> http://www.dsource.org/projects/dmd/changeset/620
>
>
Wow, I didn't know this (obviously). There has been a steady stream of small
and not-so-small improvements over the past few months that makes D even
more attractive to me. After Don squashing bugs/limitations in CTFE, David
went into a killing spree on algorithm/range bugs that's impressive to
behold.
As for this particular bug: thanks Walter!

Philippe


Re: One more update on d-programming-language.org

2010-09-15 Thread Johannes Pfau
On 14.09.2010 22:35, Philippe Sigaud wrote:
> * a small script that find ddocs comments from D code and find any
> frig missing parenthesis, telling the user were in the file she
> should look (and range of line spanning the comment). Finding ddocs
> comments and counting open/closed parenthesis is a simple example of
> parsing/finite state automata.
> 

That has been fixed in dmd:
http://d.puremagic.com/issues/show_bug.cgi?id=3554
http://www.dsource.org/projects/dmd/changeset/620

(It can't give the exact line of the missing parenthesis though, only
the line of the documented symbol)
-- 
Johannes Pfau


Re: One more update on d-programming-language.org

2010-09-15 Thread bearophile
Mafi:
> Maybe it's a silly question but what's wrong with
> s[($+i)%$] //Wow, looks like Perl

Python built-in collections indexes aren't modular, they are allowed only in 
the range [-length, length[

Bye,
bearophile


Re: One more update on d-programming-language.org

2010-09-15 Thread bearophile
Seth Hoenig:
> [1] http://live.gnome.org/Vala/ValaForJavaProgrammers

It seems Vala is shaping up into a comprehensive D-like language. Few of the 
interesting features:

---

Vala supports string templates: @"...". String templates may contain 
expressions, prefixed by a $ sign.

string name = "John";
stdout.printf (@"Welcome, $name!");
stdout.printf (@"3 + 2 = $(3 + 2)");

---

Vala: rectangular multi-dimensional arrays [,], [,,], etc. (allocated as one 
contiguous memory block), jagged array support planned

int[,] matrix = new int[3,4];

---

Vala: no implicit inheritance from Object (GLib.Object)

public class Foo : Object {
// ...
}

What happens if you don't inherit from Object? Nothing terrible. These classes 
will be slightly more lightweight, however, they will lack some features such 
as property change notifications, and your objects won't have a common base 
class. Usually inheriting from Object is what you want.

---

Vala: attributes, built into the compiler. Syntax: [AttributeName (param1 = 
value, param2 = value)]. Mostly used for bindings or D-Bus interfaces. The most 
prominent attribute for bindings is [CCode (...)]

---

Properties

Vala: language support for properties, get {} and set {} blocks, can be 
accessed like fields

public class Person : Object {
private int _age = 32;

public int age {
get { return _age; }
set { _age = value; }
}
}

void main () {
var p = new Person ();
p.age++;
}

Or even shorter for the standard implementation:

public class Person : Object {
public int age { get; set; default = 32 }
}

---

Vala: signals (signal keyword, .connect() and .disconnect())

public class MyButton : Object {

public signal void clicked ();

public void test () {
clicked ();  // emit signal
}
}

void handler_c (MyButton source) }
stdout.printf ("handler C\n")
}

void main () {
var b = new MyButton ();
b.clicked.connect ((s) => stdout.printf ("handler A\n"));
b.clicked.connect ((s) => {
stdout.printf ("handler B\n")
});
b.clicked.connect (handler_c);
b.test ();
b.clicked.disconnect (handler_c);
}

---

Property Change Notification

Vala: Subclasses of Object have a notify signal

public class Demo : Object {
public string title { get; set; }
}

void main () {
var demo = new Demo ();
demo.notify.connect ((s, p) => stdout.printf ("Property %s changed\n", 
p.name));
demo.title = "hello";
demo.title = "world";
}

However, you can't get the old value.

If you're only interested in change notifications of a single property you can 
use this syntax:

demo.notify["title"].connect ((s, p) => stdout.printf ("title changed\n"));

Change notifications can be disabled with a CCode attribute tag immedietely 
before the declaration of the property:

class MyObject : Object {

// notify signal is NOT emitted upon changes in the property
[CCode (notify = false)]
public int without_notification { get; set; }

// notify signal is emitted upon changes in the property
public int with_notification { get; set; }
}

---

Nullability

In Vala you must mark reference type parameters of methods as nullable with a 
question mark (?) if it should be allowed to pass null, e.g.

void my_method (Object? a, Object b) { }

void main () {
my_method (null, new Object());  // allowed (first argument may be null)
my_method (null, null);  // not allowed (second argument must not 
be null)
}

This is checked both at run-time and partially at compile time and helps 
preventing null pointer dereferencing.

You can enable (experimental) strict nullability checking with 
--enable-experimental-non-null. Then Vala will check all reference type 
variables at compile time, not only method arguments. For example, this example 
won't compile with strict nullability checking enabled:

void main () {
string? a = "hello";
string b = a;// Error: 'a' could be null and 'b' is not nullable
}

However, if you cast the nullable variable into a non-nullable variable with 
(!) it will compile:

void main () {
string? a = "hello";
string b = (!) a;
}

---

Additionally a Vala class can have a class construct { } block. This block will 
be executed once at the first use of its class, and once at the first use of 
each subclass of this class.

---

Bye,
bearophile


Re: One more update on d-programming-language.org

2010-09-15 Thread Mafi

Am 15.09.2010 12:33, schrieb bearophile:

Seth Hoenig:

[1] http://live.gnome.org/Vala/ValaForJavaProgrammers
http://live.gnome.org/Vala/ValaForCSharpProgrammers


I will read those pages.
On the D site there are pages about D1 for C/C++ programmers. I will eventually 
write a page about D2 for Python programmers.
In the meantime:
http://tinyurl.com/2d44sx7

Bye,
bearophile


I don't know python very well, but I think the article is interesting 
anyways but what I don't get is this:


>Python indexes can be negative, to wrap around:
>
>s = "abcdefg"
>assert s[-2] == 'f'
>
>
>But D doesn't allow that, you need to use $:
>
>auto s = "abcdefg";
>assert(s[$-2] == 'f');
>
>
>Here the -2 is a constant known at compile-time. If it's a run-time 
>variable then you need more complex code, like:

>
>void main() {
>auto s = "abcdefg";
>
>int index = -2;
>char c = (index < 0) ? s[$+index] : s[index];
>assert(c == 'f');
>
>index = 3;
>c = (index < 0) ? s[$+index] : s[index];
>assert(c == 'd');
>}
>
>
>And you need to be careful to use a signed value for the index.

Maybe it's a silly question but what's wrong with
s[($+i)%$] //Wow, looks like Perl

Look
for i=(-1) and $=5 it's (5+(-1))%5 = 4 % 5 = 4
for i=2and $=5 it's (5+2)   %5 = 7 % 5 = 2

Mafi


Re: One more update on d-programming-language.org

2010-09-15 Thread Justin Johansson

On 15/09/2010 6:05 AM, Philippe Sigaud wrote:

An interesting example is having a script that loads a D file, modifies
its source, asks for DMD to compile it and then runs it and get its
result. It could be the first brick to get a REPL / idmd (interactive
dmd). Maybe more a [challenge] subject than a tutorial example?


May I suggest you repost this idea as a [challenge].  The more people
that post with subject annotation such as [challenge] (or [trick] as
suggested by others,) the higher the probability that idea of
[yyy] subject annotations take off on this ng, esp. since there is no
other forum/subnewsgroup on D to promote vertical discussions.

Cheers
Justin Johansson


Re: One more update on d-programming-language.org

2010-09-15 Thread bearophile
Seth Hoenig:

> Another idea: The vala team made nice, very comprehensive side-by-side
> comparisons[1] between vala-java, and vala-c#, which makes the transition
> into vala very smooth and easy,

There is also the rosettacode, where every day we add D implementations of the 
tasks, D is among the first ten most represented languages there. You may 
compare D implementations with the same for other languages, and eventually you 
may add more implementations:
http://rosettacode.org/wiki/Main_Page

The tasks not yet implemented in D:
http://rosettacode.org/wiki/Reports:Tasks_not_implemented_in_D

Bye,
bearophile


Re: One more update on d-programming-language.org

2010-09-15 Thread bearophile
Seth Hoenig:
> [1] http://live.gnome.org/Vala/ValaForJavaProgrammers
> http://live.gnome.org/Vala/ValaForCSharpProgrammers

I will read those pages.
On the D site there are pages about D1 for C/C++ programmers. I will eventually 
write a page about D2 for Python programmers.
In the meantime:
http://tinyurl.com/2d44sx7

Bye,
bearophile


Re: One more update on d-programming-language.org

2010-09-14 Thread Seth Hoenig
Some tutorials/ nicely documented example programs on using the phobos
library would be greatly appreciated. Reading through
digitalmars.com/d/2.0/phobos/ requires too much filling-in-the-blanks on the
reader's part.

Another idea: The vala team made nice, very comprehensive side-by-side
comparisons[1] between vala-java, and vala-c#, which makes the transition
into vala very smooth and easy, wheras learning D is a bit like dumping a
jigsaw puzzle on a table and not having the final picture to look at while
you solve it.


[1] http://live.gnome.org/Vala/ValaForJavaProgrammers
http://live.gnome.org/Vala/ValaForCSharpProgrammers




On Tue, Sep 14, 2010 at 10:01 AM, Andrei Alexandrescu <
seewebsiteforem...@erdani.org> wrote:
>
>
> I think we'll move forward with that one. I'll start working on the
> content. Ideas for good tutorial examples?
>
> Andrei
>
>


Re: One more update on d-programming-language.org

2010-09-14 Thread Philippe Sigaud
On Tue, Sep 14, 2010 at 17:01, Andrei Alexandrescu <
seewebsiteforem...@erdani.org> wrote:
>
>  I think we'll move forward with that one. I'll start working on the
content. Ideas for good tutorial examples?
>

Maybe more examples of what's interesting me right now than tutorials, but
who knows?

* executing command-lines instructions from a D program. Theme: file I/O, OS
interaction.
An interesting example is having a script that loads a D file, modifies its
source, asks for DMD to compile it and then runs it and get its result. It
could be the first brick to get a REPL / idmd (interactive dmd). Maybe more
a [challenge] subject than a tutorial example?

* fun with types and operator overload:

auto g = gobble ~1 ~ "a" ~ 2.34 ~ (int i) { return i*i;} ~ [1,2,3];

struct Gobbler(T...) is just a tuple-like type overloading opBinary!("~",
U)(U u) to return Gobbler!(T, U)(this.payload, u). gobble() is just a helper
function returning Gobbler!()
The type is evolving along with the expression consumption. I find this
fascinating. Statically typed variadic expressions: how many language offer
this? How many lines of C++?
Now, if only alias this worked for typetuples, we could even do g[3] to get
the function literal back.

* related to this: expressions templates in D.
cpp-next has a nice article introducing Boost.Proto and such.
http://cpp-next.com/archive/2010/08/expressive-c-introduction/
I'm reading the Boost.Proto docs right now and find them quite interesting.

Variable!double _1, _2;
auto expr = (_1 + _2)*_1 + 1; // expr encodes the entire expression in its
type and is a callable struct.
In D, it could be a BinOp!("+", BinOp!("*", BinOp!("+",
Variable!double,Variable!double),Variable!double),int)

* a small script that find ddocs comments from D code and find any frig
missing parenthesis, telling the user were in the file she should look (and
range of line spanning the comment). Finding ddocs comments and counting
open/closed parenthesis is a simple example of parsing/finite state
automata.

* some interesting examples of templates or string mixins could help
alleviate the sentiment they are unknowable black magic. I admit it, I have
no interesting/new example in mind right now. Some example where a custom
struct is created according to CT parameters could be interesting.


Philippe


Re: One more update on d-programming-language.org

2010-09-14 Thread Andrei Alexandrescu

On 09/14/2010 02:50 AM, Lars T. Kyllingstad wrote:

On Thu, 09 Sep 2010 19:07:20 -0500, Andrei Alexandrescu wrote:


http://d-programming-language.org

  From David Gileadi: the annoying Google Translate bar behavior on
browsers with other languages has been fixed, the behavior when
shrinking and growing the window size has been improved, the Reddit
button is gone, and a few styles were changed.

Could have sworn I sent this already, it just disappeared.



It looks good!


I think we'll move forward with that one. I'll start working on the 
content. Ideas for good tutorial examples?


Andrei



Re: One more update on d-programming-language.org

2010-09-14 Thread Lars T. Kyllingstad
On Thu, 09 Sep 2010 19:07:20 -0500, Andrei Alexandrescu wrote:

> http://d-programming-language.org
> 
>  From David Gileadi: the annoying Google Translate bar behavior on
> browsers with other languages has been fixed, the behavior when
> shrinking and growing the window size has been improved, the Reddit
> button is gone, and a few styles were changed.
> 
> Could have sworn I sent this already, it just disappeared.


It looks good!

-Lars


Re: One more update on d-programming-language.org

2010-09-10 Thread Jérôme M. Berger
David Gileadi wrote:
> On 9/10/10 10:20 AM, "Jérôme M. Berger" wrote:
>> Great, now the only issue that remains is that the text is still
>> too small...
>>
>> Jerome
> 
> Text sizes are likely not changing.  Some folks say the text is too big,
> some say it's too small.  The text size is based on your browser
> settings, so check your browser and its default text sizes.  If that
> doesn't help, please adjust your preferences to match the text :)

Yes, the text size is *based* on my browser setting in that it is
set relatively to it. The issue is that it is set *smaller* than my
browser setting (around 15% smaller which is very noticeable). I
won't change my setting (and wind up with every properly designed
site being too large) just to accommodate one web site...

Jerome
-- 
mailto:jeber...@free.fr
http://jeberger.free.fr
Jabber: jeber...@jabber.fr



signature.asc
Description: OpenPGP digital signature


Re: One more update on d-programming-language.org

2010-09-10 Thread David Gileadi

On 9/10/10 10:20 AM, Stewart Gordon wrote:

I see the spacing around code blocks seems to have been reduced.  Either
that or it just doesn't seem too big now. But are you going to do
anything about the other issues I raised on 3 Sep?


Reposting those suggestions, responses inline:


Nice design on the whole.  A few issues:

1. Too much space above and below code and BNF blocks.

2. In a few places, the bullet points look a little too spaced out.
I decreased the list spacing a bit, but don't want to decrease it 
further.  Some lists like those on 
http://d-programming-language.org/overview.html have wrapped text, and I 
prefer the spacing between the bulleted paragraphs.  If there is a 
strong consensus against my preference I'll change it :)



3. No consistency in whether indentation in BNF is with a tab character, four 
spaces or eight spaces.

4. Tab characters in pre blocks ought to be avoided, as they aren't guaranteed 
to display the same for everybody, and it also encourages bad practice if you 
use half-tabs like that.
I have mostly been avoiding changing the content, and I consider 
tabs/spaces in BNF blocks to be content, not styling.



5. It would be nice if you ran it through a validator.

http://validator.w3.org/

or if you want to check the whole site

http://www.htmlhelp.com/tools/validator/
I made a couple of changes based on validation but there are obviously 
lots to do.  It's honestly not very high on my priority list.


Re: One more update on d-programming-language.org

2010-09-10 Thread David Gileadi

On 9/10/10 10:20 AM, "Jérôme M. Berger" wrote:

Great, now the only issue that remains is that the text is still
too small...

Jerome


Text sizes are likely not changing.  Some folks say the text is too big, 
some say it's too small.  The text size is based on your browser 
settings, so check your browser and its default text sizes.  If that 
doesn't help, please adjust your preferences to match the text :)


Re: One more update on d-programming-language.org

2010-09-10 Thread Jérôme M. Berger
Andrei Alexandrescu wrote:
> http://d-programming-language.org
> 
> From David Gileadi: the annoying Google Translate bar behavior on
> browsers with other languages has been fixed, the behavior when
> shrinking and growing the window size has been improved, the Reddit
> button is gone, and a few styles were changed.
> 
Great, now the only issue that remains is that the text is still
too small...

Jerome
-- 
mailto:jeber...@free.fr
http://jeberger.free.fr
Jabber: jeber...@jabber.fr



signature.asc
Description: OpenPGP digital signature


Re: One more update on d-programming-language.org

2010-09-10 Thread Stewart Gordon
I see the spacing around code blocks seems to have been reduced.  Either 
that or it just doesn't seem too big now.  But are you going to do 
anything about the other issues I raised on 3 Sep?


Stewart.


Re: One more update on d-programming-language.org

2010-09-10 Thread Andrej Mitrovic
There are adverts on the page? Lol, didn't notice. Thanks again, AdblockPlus!

On Fri, Sep 10, 2010 at 8:06 AM, Russel Winder  wrote:
> The Google adverts at the foot of each page need to have some font
> sizing/scaling applied, currently they look seriously ugly which has the
> effect of ensuring that anything advertised is something I shall avoid
> -- i.e. it is anti-advertising. See attached
> d-programming-language.org_bottom.png.


Re: One more update on d-programming-language.org

2010-09-10 Thread Bane
Dedicated Website!
Coool!
Me like it!


Re: One more update on d-programming-language.org

2010-09-10 Thread JimBob

"Andrei Alexandrescu"  wrote in message 
news:i6bssf$25i...@digitalmars.com...
> http://d-programming-language.org
>
> From David Gileadi: the annoying Google Translate bar behavior on browsers 
> with other languages has been fixed, the behavior when shrinking and 
> growing the window size has been improved, the Reddit button is gone, and 
> a few styles were changed.
>
> Could have sworn I sent this already, it just disappeared.

I think the color scheme is better than the original.

The blue/grey is much better than the sandy biege of the original. And there 
seems a better contrast on the sidebar for sure, and the main text is easier 
on the eye too.

Thumbs up from me!

note: Clicking on "Library reference" ==>

"The requested URL /phobos/phobos.html was not found on this server." 




Re: One more update on d-programming-language.org

2010-09-09 Thread bearophile
Nick Sabalausky:

Maybe a screenshot would help? I don't really know what you mean. (Maybe the
others do though?)

I have shown a screenshoot last time:
http://i52.tinypic.com/2jetpqg.jpg
The situation is now worse, the code is cut on the right.

---

Vladimir Panteleev:
> There seems to be a "max-width" property somewhere OSLT. Maybe it's a good  
> idea, because reading very wide pages can be straining (you can easily  
> lose track which line you're reading).

It's a good idea if and when it's done well. It's not a good idea when the 
there is not enough space for the source code, and you have to scroll 
horizontally to see it, and you are wasting some space on the right.

Bye,
bearophile


Re: One more update on d-programming-language.org

2010-09-09 Thread Vladimir Panteleev

On Fri, 10 Sep 2010 04:45:17 +0300, Nick Sabalausky  wrote:


"bearophile"  wrote in message
news:i6c1u7$2f1...@digitalmars.com...

Andrei:

http://d-programming-language.org


The designer of those pages has taken the wrong choice of wasting some
part of the screen on the right. I will need to use "no style" often  
with

Firefox to use those pages and be able to read the non-proportional text
present in those pages.



Maybe a screenshot would help? I don't really know what you mean. (Maybe  
the

others do though?)


Screenshot:  
http://dump.thecybershadow.net/8302412a7f0c2b557401c31e3ed7d5ff/0650.png


There seems to be a "max-width" property somewhere OSLT. Maybe it's a good  
idea, because reading very wide pages can be straining (you can easily  
lose track which line you're reading).


--
Best regards,
 Vladimirmailto:vladi...@thecybershadow.net


Re: One more update on d-programming-language.org

2010-09-09 Thread Nick Sabalausky
"bearophile"  wrote in message 
news:i6c1u7$2f1...@digitalmars.com...
> Andrei:
>> http://d-programming-language.org
>
> The designer of those pages has taken the wrong choice of wasting some 
> part of the screen on the right. I will need to use "no style" often with 
> Firefox to use those pages and be able to read the non-proportional text 
> present in those pages.
>

Maybe a screenshot would help? I don't really know what you mean. (Maybe the 
others do though?)




Re: One more update on d-programming-language.org

2010-09-09 Thread bearophile
Andrei:
> http://d-programming-language.org

The designer of those pages has taken the wrong choice of wasting some part of 
the screen on the right. I will need to use "no style" often with Firefox to 
use those pages and be able to read the non-proportional text present in those 
pages.

Bye,
bearophile


Re: One more update on d-programming-language.org

2010-09-09 Thread Michel Fortin
On 2010-09-09 20:07:20 -0400, Andrei Alexandrescu 
 said:



http://d-programming-language.org

 From David Gileadi: the annoying Google Translate bar behavior on 
browsers with other languages has been fixed, the behavior when 
shrinking and growing the window size has been improved, the Reddit 
button is gone, and a few styles were changed.


I just happened to take a look at the FAQ / Rationale page, and found a 
lot of outdated answers about operator overloading (most of that 
section is due for a rewrite).



This one is quite funny to read because it basically says that the new 
operator overloading regime is something that will lead to ugly hacks! 
:-)


"""
Why not have binary operator overloads be static members, so both 
arguments are specified, and there no longer is any issue with the 
reverse operations?


This means that the operator overload cannot be virtual, and so likely 
would be implemented as a shell around another virtual function to do 
the real work. This will wind up looking like an ugly hack. Secondly, 
the opCmp() function is already an operator overload in Object, it 
needs to be virtual for several reasons, and making it asymmetric with 
the way other operator overloads are done is unnecessary confusion.

"""

--
Michel Fortin
michel.for...@michelf.com
http://michelf.com/



One more update on d-programming-language.org

2010-09-09 Thread Andrei Alexandrescu

http://d-programming-language.org

From David Gileadi: the annoying Google Translate bar behavior on 
browsers with other languages has been fixed, the behavior when 
shrinking and growing the window size has been improved, the Reddit 
button is gone, and a few styles were changed.


Could have sworn I sent this already, it just disappeared.


Andrei