Re: [Challenge] implementing the ambiguous operator in D

2010-09-02 Thread Peter Alexander

On 2/09/10 7:34 AM, Pelle wrote:

It needs opEquals :-)


Yeah, it needs a lot of things :)

You could easily add unary operators as well (e.g. so that -amb([1, 2]) 
== [-1, -2]. I didn't bother adding more than I did because it would 
make the post too large, and wouldn't really add anything (I thought 
that the binary ops + dispatch covered most of the interesting cases).


Also, I think it would supposed to return amb(map!...) instead of just 
returning map!... (otherwise you couldn't chain them), but that's a 
simple fix.


Please comment on http://d-programming-language.org/

2010-09-02 Thread Andrei Alexandrescu
Time to zero in on the overall design and start working on the content. 
Please give the design one more round of comments.


Thanks,

Andrei


Re: [OT] Dark Star (1974) - the platinum age of movies

2010-09-02 Thread Nick Sabalausky
"Walter Bright"  wrote in message 
news:i5ndnb$1e0...@digitalmars.com...
> Nick Sabalausky wrote:
>> I don't really see that. To me, the original trilogy at least, seemed 
>> like action flicks in sci-fi clothing (Nothing wrong with that!) Now the 
>> Battlestar Galactica remake, the V remake, and Stargate Universe, *those* 
>> are soap operas pretending to be sci-fi. And that goes triple for 
>> Craprica.
>
> So many people like BG that I keep giving it a try, and keep turning it 
> off.
>

I would see a minute or two of BG on TV now and then and turn away because 
of the soap-like tone and the questionable camera-work. But I started to get 
so starved for new science fiction (using the, umm, "spaceship" definition, 
not the technically correct one) that I ended up getting ahold of the 
miniseries and forced myself through the entire thing. The sets were 
*impressive*, and I kinda liked the new Starbuck (except for all her 
soapy-drama), and there was one really cool well-made scene where Starbuck 
saved some other pilot by locking the ships together - which lasted all of 
about a couple minutes. But I hated everything else about it, and I was 
really *forcing* myself though most of it (I was determined to give it a 
fair try).

Then Caprica came around, I started to watch the premiere, and I couldn't 
bring myself to watch any more than the first 10-15 minutes of it. It felt 
like I was watching one of those "The CW" shows like Seventh Heaven or One 
Tree Hill, but with blatantly bad "futurish" props (A pair of black plastic 
sunglasses with LEDs glued to it? That might have passed for cool and 
high-tech thirty years ago - but not in 2010.) I turned it on again an hour 
later, took one minute to see it hadn't gotten any better, and decided the 
show's correct spelling has an extra "r" as the second letter.

I've learned to be wary of popular shows. Lost seemed popular, so I gave the 
pilot a try. And well...let's say I guess I'm just not a JJ Abrams kind of 
guy. (But OTOH, avoiding popular shows left me missing out on a lot of 
Friends, so who can ever tell?)

>> I really miss the sci-fi from around 1990-2005 (approx). I know a lot of 
>> people would probably consider this heresy, but to me, that's the golden 
>> age of science fiction. All of the Berman-era Star Treks (none of this JJ 
>> Abrams nonsense), the Stargate movie, Stargate SG-1 (even Atlantis was at 
>> least ok), Babylon 5 (no spoilers! I still haven't gotten around to the 
>> last season and a half), The Fifth Element, Farscape, Firefly (although 
>> that was really more space western than sci-fi). Lots of great stuff.
>
> Please don't overlook 2001 or Colossus.
>

I have absolutely no good excuse for having never seen 2001 (especially 
since I liked some of Kubrick's other works: Clockwork Orange and Dr. 
Strangelove). I keep meaning to pick up 2001 and never do. Never heared of 
Colossus, I'll have to look it up.

>
> Real sci-fi is based on a "what if X" and then a story is built around it.

Yea, I often use the "spaceship" definition out of habit and convenience. I 
do like both types of "science fiction" though.

> Monster movies are sci-fi, but the genre is so tired (something is killing 
> the crew one by one!) that I really don't want to see another one.
>

I agree those "cast getting picked off one-by-one" plots are very tired and 
cliche'd. But once in awhile I come across one that has so much style and 
"fun" that I don't mind. The Tremors series, Ghosts of Mars, Pitch Black.

Same thing with the "unlikely teacher turning around a group of misfit 
students" movies. So many out there, and it's s tired and corny. But 
then I saw "Only The Strong" (lots of Capoeira) and didn't mind the generic 
plot.

The one plot I am really tired of though is "humans are put in danger by a 
human creation". Matrix, Terminator, 2001, and probably about five billion 
others. Great as some of those were (like the first two Terminators) I am 
really tired of that plot. I do plan to make an exception for 2001 though.

> Is Star Wars sci-fi? I'd say not, because spaceships are the setting, but 
> have nothing to do with the plot which you could transfer wholesale to a 
> western or an eastern. The fact that entire sequences seem to be lifted 
> directly from "633 Squadron" also argues that it is not sci-fi.
>

Yea, it seems more like "action movie in sci-fi clothing" to me. Still liked 
it, though :)

> BTW, watch "Primer". That's some really good sci-fi. No special effects, 
> no budget, just exploring the amazing consequences of a simple idea.

Sounds good. I'll look it up. One "real sci-fi" movie (with special effects, 
though) I remember liking was Dark City, although it's been so long I don't 
remember if it might have been more because of the style than anything else 
(Actually, I don't remember anything about it other than there being a city, 
a lot of blue and black, and a lake or something at the end).

What do you think about Solaris? 

Re: Please comment on http://d-programming-language.org/

2010-09-02 Thread Nick Sabalausky
"Andrei Alexandrescu"  wrote in message 
news:i5ni8j$1nk...@digitalmars.com...
> Time to zero in on the overall design and start working on the content. 
> Please give the design one more round of comments.
>

I think I would try just getting rid of the red flare in the background, and 
maybe just make a slightly reddish solid background color. It was a neat 
idea, but I think getting it to really look right would be a bit difficult.

Everything else seems to look fine though from a quick look-though. Main 
font size is perfect. 




Re: Please comment on http://d-programming-language.org/

2010-09-02 Thread Nick Sabalausky
"Nick Sabalausky"  wrote in message 
news:i5nkrn$1tf...@digitalmars.com...
> "Andrei Alexandrescu"  wrote in message 
> news:i5ni8j$1nk...@digitalmars.com...
>> Time to zero in on the overall design and start working on the content. 
>> Please give the design one more round of comments.
>>
>
> I think I would try just getting rid of the red flare in the background, 
> and maybe just make a slightly reddish solid background color. It was a 
> neat idea, but I think getting it to really look right would be a bit 
> difficult.
>
> Everything else seems to look fine though from a quick look-though. Main 
> font size is perfect.

I do have to say, I'm not a fan of justified text. I think it makes spacing 
look really weird, inconsistent and distracting. But it's not too bad in 
this case, so I can certainly live with it. 




Re: [Slight OT] TDPL in Russia

2010-09-02 Thread Nick Sabalausky
"Brad Roberts"  wrote in message 
news:mailman.61.1283409922.858.digitalmar...@puremagic.com...
> On 9/1/2010 11:28 PM, Nick Sabalausky wrote:
>>
>> I hope it started with "It was a dark and stormy night" :)
>>
>
> Sadly no.. that'd be cliched but not bad enough.  Hopefully this doesn't 
> push
> the bounds of fair use too far.  The first several lines:
>
> Chapter 1
>
>  Pain.
>  Whispering voices.
>  Pain.
>  Pain. Pain. Pain.
>  Need pee -- new pain -- what are they sticking in me? ...
>  Sleep.
>  Pain.
>  Whispering voices.
>  "As you know, Nurse Eastman, the government spooks controlling this 
> hospital
> will not permit me to give this patient the care I think he needs."
>  "Yes, doctor."  The voice was breathy, sweet, so sweet and sexy.
>
> ---
>
> Actually, that part's not THAT bad, by itself.. but it certainly isn't 
> anywhere
> near good.

lol, Oh man, that's great (in a bad way, of course) :) Now you've got me 
*really* wanting to read it. I haven't laughed that hard at, umm, 
"literature" since Hitchhiker's Guide to the Galaxy. I keep laughing harder 
every time I re-read it, He said. His voice breathy, sweet, so sweet and 
sexy. Pain. Need pee

:)





Re: [D.typesystem] Suggestion for improving OO inheritance models

2010-09-02 Thread Jacob Carlborg

On 2010-09-01 23:39, Andrej Mitrovic wrote:

You mean like this?:
module add_virtual_functions;

import std.stdio : writeln;

void main()
{
 test();
}

mixin template Foo()
{
 void func()
 {
 writeln("Foo.func()");
 }
}

class Bar
{
 void func()
 {
 writeln("Bar.func()");
 }
}

class Code : Bar
{
 mixin Foo;
}

void test()
{
 Bar b = new Bar();
 b.func();   // calls Bar.func()

 Code c = new Code();
 c.func();   // calls Code.func()
}



No, that is overriding. Overloading is having several methods with the 
same name taking different number of parameters or parameters of 
different types.


module test;

mixin template Foo ()
{
void bar (int i) {};
}

class Bar
{
void bar () {};
mixin Foo;
}

void main ()
{
auto bar = new Bar;
bar.bar(4); // line 17
bar.bar();
}

The above code results in these errors:

test.d(17): Error: function test.Bar.bar () is not callable using 
argument types (int)
test.d(17): Error: expected 0 arguments, not 1 for non-variadic function 
type void()




On Wed, Sep 1, 2010 at 11:30 PM, Jacob Carlborg  wrote:

On 2010-09-01 22:44, Philippe Sigaud wrote:


On Wed, Sep 1, 2010 at 18:13, retard  wrote:


Have you taken a loot at Scala&  traits already? It would be a great
starting point.


Scala's traits are great! Implicits in Scala are quite interesting too.
Also, Haskell typeclasses

I wonder if D can have part of Scala traits functionality with mixins?


You can't use D template mixins to add methods that will overload existing
methods.


--
/Jacob Carlborg




--
/Jacob Carlborg


Re: Please comment on http://d-programming-language.org/

2010-09-02 Thread Jonathan M Davis
On Thursday 02 September 2010 00:03:33 Andrei Alexandrescu wrote:
> Time to zero in on the overall design and start working on the content.
> Please give the design one more round of comments.
> 
> Thanks,
> 
> Andrei

Overall, it looks good, though I have to agree with Nick that the flare should 
go. Also, the font seems a bit large to me. The code font in particular is 
_way_ 
large. But maybe I just prefer smaller fonts.

- Jonathan M Davis


Re: Please comment on http://d-programming-language.org/

2010-09-02 Thread Jacob Carlborg

On 2010-09-02 09:48, Nick Sabalausky wrote:

"Andrei Alexandrescu"  wrote in message
news:i5ni8j$1nk...@digitalmars.com...

Time to zero in on the overall design and start working on the content.
Please give the design one more round of comments.



I think I would try just getting rid of the red flare in the background, and
maybe just make a slightly reddish solid background color. It was a neat
idea, but I think getting it to really look right would be a bit difficult.

Everything else seems to look fine though from a quick look-though. Main
font size is perfect.


I would agree with that and would like to add:

* I don't like most of the graphics, the images, like these:
* http://d-programming-language.org/images/c1.gif
* http://d-programming-language.org/images/d3.gif
	* the others with similar style found at: 
http://d-programming-language.org/images/


* Maybe try an other style for the links
* The table at: http://d-programming-language.org/comparison.html just 
looks awful. It's mostly the border and the link style doesn't work on 
that lime green background color and not on the red background either.
* BTW I would update all the tables to use a solid border instead of the 
current one.


--
/Jacob Carlborg


Re: [OT] Dark Star (1974) - the platinum age of movies

2010-09-02 Thread Walter Bright

Nick Sabalausky wrote:
What do you think about Solaris? I've heard reviewers praising it for being 
"real" science fiction, so I've been tempted to try it out of sheer 
curiosity, but I've never felt confident enough about it to actually give it 
a try.


I watched the original russian one. It's sci-fi, but it's rather long and 
boring. Like there's a long sequence of just the character driving on the 
freeway. Driving, driving, driving, ...


Re: Please comment on http://d-programming-language.org/

2010-09-02 Thread Arth Lloyd Flores
It looks neat :D Much better than the old one IMHO..

On Thu, Sep 2, 2010 at 3:03 PM, Andrei Alexandrescu <
seewebsiteforem...@erdani.org> wrote:

> Time to zero in on the overall design and start working on the content.
> Please give the design one more round of comments.
>
> Thanks,
>
> Andrei
>



-- 
-Arth


do D support something like C# 4.0 co/contra-variance?

2010-09-02 Thread dennis
http://blog.t-l-k.com/dot-net/2009/c-sharp-4-covariance-and-contravariance


Re: do D support something like C# 4.0 co/contra-variance?

2010-09-02 Thread bearophile
dennis:
> http://blog.t-l-k.com/dot-net/2009/c-sharp-4-covariance-and-contravariance

I think D2 doesn't support those things yes. But they are useful and may be 
added to D3.

Bye,
bearophile


Re: Please comment on http://d-programming-language.org/

2010-09-02 Thread bearophile
Andrei Alexandrescu:

> Time to zero in on the overall design and start working on the content. 
> Please give the design one more round of comments.

My opinions:
- The menu on the left is too much wide horizontally
- I don't like the "window" that limits the text of the right, and I don't like 
its border

A small accessibility test:
http://i52.tinypic.com/2jetpqg.jpg

Bye,
bearophile


Re: Please comment on http://d-programming-language.org/

2010-09-02 Thread Michal Minich
On Thu, 02 Sep 2010 02:03:33 -0500, Andrei Alexandrescu wrote:

> Time to zero in on the overall design and start working on the content.
> Please give the design one more round of comments.
> 
> Thanks,
> 
> Andrei

Few opinions and observations:

1. It is common practice that clicking on site logo links to site root. 
In this case it goes to digitalmars.com. This should be fixed and 
separate link to digitalmars.com should be provided in header

2. Flare is good, without it the design would look boring.

3. Many headers have smaller font than the normal text font. Look for 
instance at the overview page (chromium / linux).

4. I like the size of the basic text and code font. 
- chromium / linux
  But I would preffer the code font to be slight larger 
  than text font (now is the slightly smaller) - the browser
  uses curier new or similar for code
- firefox / linux
  text and code font seems to be the same size. - the browser uses
  Monospace font for code

5. The page reacts very well to zooming in and out in browser, which is a 
very good thing



Re: Please comment on http://d-programming-language.org/

2010-09-02 Thread filgood
Andrei Alexandrescu Wrote:

> Time to zero in on the overall design and start working on the content. 
> Please give the design one more round of comments.
> 
> Thanks,
> 
> Andrei


Hi,

I think fonts are slightly too big and the text maybe spaced too much.
Also, I don't feel you should place the google translate tool on the website as 
people that need to translate the content can go to google and type the link 
and get it translated in that way.

Overall the website is ok, but IMHO i think better/cleaner example for a 
programming language website is this one: http://fantom.org/


~ fil


Re: Please comment on http://d-programming-language.org/

2010-09-02 Thread Gareth Charnock

On 02/09/10 09:46, Jacob Carlborg wrote:

On 2010-09-02 09:48, Nick Sabalausky wrote:

"Andrei Alexandrescu" wrote in message
news:i5ni8j$1nk...@digitalmars.com...

Time to zero in on the overall design and start working on the content.
Please give the design one more round of comments.



I think I would try just getting rid of the red flare in the
background, and
maybe just make a slightly reddish solid background color. It was a neat
idea, but I think getting it to really look right would be a bit
difficult.

Everything else seems to look fine though from a quick look-though. Main
font size is perfect.


I would agree with that and would like to add:

* I don't like most of the graphics, the images, like these:
* http://d-programming-language.org/images/c1.gif
* http://d-programming-language.org/images/d3.gif
* the others with similar style found at:
http://d-programming-language.org/images/

* Maybe try an other style for the links
* The table at: http://d-programming-language.org/comparison.html just
looks awful. It's mostly the border and the link style doesn't work on
that lime green background color and not on the red background either.
* BTW I would update all the tables to use a solid border instead of the
current one.

I'm afraid I really like the red flare; it makes the website look more 
visually appealing. A solid background colour would just look blander.


However, I agree with the comments about the c1.gif and d3.gif images. 
They don't really fit with the more professional looking new design.


Re: Please comment on http://d-programming-language.org/

2010-09-02 Thread retard
Thu, 02 Sep 2010 07:36:43 -0400, bearophile wrote:

> Andrei Alexandrescu:
> 
>> Time to zero in on the overall design and start working on the content.
>> Please give the design one more round of comments.
> 
> My opinions:
> - The menu on the left is too much wide horizontally - I don't like the
> "window" that limits the text of the right, and I don't like its border
> 
> A small accessibility test:
> http://i52.tinypic.com/2jetpqg.jpg
> 
> Bye,
> bearophile

The words per row count is also a bit too high on a 2560x1600 screen.. I 
thought there are also Mac users in the crowd.


Re: Please comment on http://d-programming-language.org/

2010-09-02 Thread Gareth Charnock

PS: Google Chrome on a 1680x1050 resolution display.

I'm afraid I really like the red flare; it makes the website look more
visually appealing. A solid background colour would just look blander.

However, I agree with the comments about the c1.gif and d3.gif images.
They don't really fit with the more professional looking new design.




Re: [Slight OT] TDPL in Russia

2010-09-02 Thread retard
Wed, 01 Sep 2010 21:14:20 -0700, Walter Bright wrote:

> BCS wrote:
>> And there are people who will buy $5 a cup coffee when they really do
>> like the $.50 stuff better. They are called snobs.
> 
> I had fun at a wine tasting when I picked the cheapest wine of the lot
> as my favorite. Hilarity ensued.

The price of wine often doesn't correlate with its quality, at least very 
linearly. When I was in Spain, a local wine "expert" could easily find 
good wine and the price was 4..10 euros per bottle. It's the same thing 
in Greece or Bulgaria or other cheaper wine-producing countries. The 
cheapest wine is actually cheaper than bottled water.

In more expensive countries the same quality costs 5..20 times as much.


Re: do D support something like C# 4.0 co/contra-variance?

2010-09-02 Thread Michal Minich
On Thu, 02 Sep 2010 07:38:24 -0400, bearophile wrote:

> dennis:
>> http://blog.t-l-k.com/dot-net/2009/c-sharp-4-covariance-and-
contravariance
> 
> I think D2 doesn't support those things yes. But they are useful and may
> be added to D3.
> 
> Bye,
> bearophile

I did not explored this area much, but it seems thanks to duck typed D 
templates, in some cases template covariance and contravariance is 
achievable implicitly (see the code example). 

It is also worth noting that C# does not support more simple OO feature - 
covariant return types [1], which I really miss when programming in C#.

The variance of D templates may be quite hard to specify and implement, 
given the genericity and complexity of templates. But I'm sure at least 
some effects are implementable right now - like safe contra/variant cast; 
and it should be also possible to add variable to types as variance 
annotations, which are checkable at ct...I might look closer at this some 
time..

[1] http://www.digitalmars.com/d/2.0/function.html

import std.stdio;

class Rect  { 
void draw () { writeln ("Rect"); } }

class RoundedRect : Rect { 
   override void draw () { writeln ("RoundedRect"); } }

class UltraRect : RoundedRect { 
override void draw () { writeln ("UltraRect"); } }

class List (T) {
private T[] items;
void add (T item) { items ~= item; }
T[] getAll () { return items.dup; } 
}

void fill (T) (List!(T) list) {
// list.add (new Rect);  // errors here:
// function List!(RoundedRect).List.add (RoundedRect item) 
   is not callable using argument types (Rect)
// cannot implicitly convert expression (new Rect) of type 
   Rect to RoundedRect
list.add (new RoundedRect);
list.add (new UltraRect);
}

void drawAll (T) (List!(T) items) {
foreach (item; items.getAll())
item.draw();
}

void main () {
auto l = new List!(RoundedRect);
fill (l);
drawAll (l);
}


Re: Please comment on http://d-programming-language.org/

2010-09-02 Thread retard
Thu, 02 Sep 2010 13:31:03 +0100, Gareth Charnock wrote:

> PS: Google Chrome on a 1680x1050 resolution display.
>> I'm afraid I really like the red flare; it makes the website look more
>> visually appealing. A solid background colour would just look blander.
>>
>> However, I agree with the comments about the c1.gif and d3.gif images.
>> They don't really fit with the more professional looking new design.

We need a more professional looking SVG version of the D man then!


Re: [Slight OT] TDPL in Russia

2010-09-02 Thread Steven Schveighoffer

On Thu, 02 Sep 2010 01:53:41 -0400, Nick Sabalausky  wrote:


"Walter Bright"  wrote in message
news:i5nco0$1bp...@digitalmars.com...

Nick Sabalausky wrote:

That's all I can think of. Certainly nothing from Apple since Woz left,
and that's the company most people try to point to as a shining example
of alleged "polish".


All I can say is you need to look at the product before it was polished  
to
see if progress was made during the polishing process. Looking at just  
the

end result doesn't tell much.


The pre-release iterations are completely irrelevant. If the end result  
is

something with nearly-zero tactile feedback, super-ultra-hyperly-modal
interface, and can't be turned off with the "power" button, but only by
holding "Up" for five seconds, or has tiny ui elements that can't be
accessed with a stylus or fingernail but is far too small to do reliably
with a finger, or is a closed-locked-down-platform, or is branded as  
being a
PDA-like device but still doesn't support something as basic as  
copy-paste

that PalmOS devices already had nearly ten years prior even in smartphone
form (Handspring Treo), then yes, the polish is crap no matter how much
crappier the early iterations were. Apple's "polish" exists as nothing  
more

than aesthetic-oriented graphic design, and it fools most people.


Love my iPhone.  Love it.  My last two phones were a Palm Treo and a  
Samsung touch-screen (w/stylus) smartphone with Windows mobile 6.  They  
are absolute garbage compared to this.  Granted, I started with the 3gs,  
and upgraded to iOS4 about a month after I got it, so my phone is the  
result of 3 years of polish, but I feel apple has the right focus for it.


iPhone is hands down the best phone I've ever used.  I thought when I got  
it, I would have a hard time accessing small things like the on-screen  
keyboard keys, but I'm surprised at how accurate I am with it, even after  
only having it for a few months.  I regularly go to webnews on digitalmars  
and can click the minuscule links pretty accurately.


You can not like them if you want, you are entitled to your opinion, but  
it seems like you have a very negative view of almost everything :)  I bet  
your glass is half empty, huh...


-Steve


Re: [D.typesystem] Static (CT) enforce anybody?

2010-09-02 Thread Steven Schveighoffer
On Wed, 01 Sep 2010 17:11:50 -0400, Jonathan M Davis  
 wrote:



On Wednesday, September 01, 2010 13:54:15 Philippe Sigaud wrote:
On Wed, Sep 1, 2010 at 22:37, bearophile   
wrote:

> Philippe Sigaud:
> > Yes, Steve is right. Also, you cannot throw exceptions at CT.
>
> This is a temporary limitation :-)

Really? That means being able to create reference types at CT, that'd be
interesting, to say the least. And what code would catch them? Aren't  
they

caught by the runtime?


Well, according to TDPL, the ultimate goal is to be able to use _all_ of  
SafeD
with CTFE. So, exceptions would be on the list. However, I wouldn't  
expect CTFE

to get that powerful anytime soon.


I think step 1 is to rewrite the compiler in D.  Right now, CTFE is  
interpreting things from a C++-based program.  I think without a garbage  
collector too.


-Steve


Re: Bug 3999 and 4261

2010-09-02 Thread Steven Schveighoffer
On Wed, 01 Sep 2010 17:12:04 -0400, Andrei Alexandrescu  
 wrote:



On 9/1/10 15:35 CDT, bearophile wrote:

so:

Another taste discussion?


Nope.

-

Steven Schveighoffer:
And I think if you have an idea to try and "fix" it, you might as well  
know now, it will never happen.<


There I was explaining something better to Daniel Gibson. The purpose  
of the enhancement request 3999 has nothing to do with a request for a  
different keyword.


-

I think now I have presented my point as well as I can, and people have  
given comments and opinions. I'd like to Walter or/and Andrei to  
express their opinion about the bug 3999 :-)


I think it's a good enhancement. C++'s good old enum has been  
instrumental in finding a few bugs and clarifying a few interfaces in a  
project at work. Based on that experience I'd say that there's a chance  
more restrictive is better. We need to find a principled way to define  
semantics though - if we disable comparison it really means we're  
disabling implicit conversion.


Does this mean no more defining bits as enums?

enum myBits
{
   flag1 = 1;
   flag2 = 2;
   flag3 = 4;
}

void fn(int flags);

fn(myBits.flag1 | myBits.flag2);

That was the one case where I really like the implicit conversion.

-Steve


Re: Please comment on http://d-programming-language.org/

2010-09-02 Thread Alexander Malakhov
Andrei Alexandrescu  писал(а) в своём  
письме Thu, 02 Sep 2010 14:03:33 +0700:


Time to zero in on the overall design and start working on the content.  
Please give the design one more round of comments.


Thanks,

Andrei


1. There should be "Contibute" section on the site with subsections  
{Compiler, Phobos,

   Documentation, This site}
2. On overview page:
  - Absence of C++ code highlighting looks like cheating from  
brainwash TV ads
  - (not sure) maybe functional langs and FP style also should be  
mentioned ?


3. D-lang.org is faster to type and memorize (especially for non-native  
speakers). Is it owned
   by someone from D community ? We should make it to forward to main site  
(the same for

   dlang.org)
4. Agree with Jonathan, code font seems (can I say so) a little too big
5. I would like to be able to view contents of categories like "Language  
Reference" without

   opening first (maybe like "+" on the MSDN site)
6. Why do we need "Digital Mars" to be mentioned ? I think it can mislead  
people to conclusion,

   that D is owned by some corporation.

7. "Documentation"->"Library Reference" link is broken

P.S. I like red flare :)

--
Alexander


Re: Miscellaneous memory management questions

2010-09-02 Thread Simen kjaeraas

Peter Alexander  wrote:


Hi,

I've not been staying up to date on the new/delete discussions and  
related memory management issues, so I have a few questions.


1. How do I disable the GC?


In a way, you don't. You can, however, replace it with a stub GC.

According to http://dsource.org/projects/druntime/wiki/GettingStarted:

"If you want to change the GC implementation used by the druntime, you
have to change the src/dmd-posix.mak (or src/dmd-win32.mak for Windows),
search for DIR_GC variable and change it from basic to whatever you want,
for example, the stub implementation:

DIR_GC=gc/stub

Then, rebuild as shown in the previous section.

Right now there are only 2 implementations: stub and basic, so unless you
will be working on your own implementation, there is no much point on
changing this =)"


in /src/druntime/src/gcstub under your dmd installation, there should be
a file gc.d, containing a simple garbage collector. This may or may not
need customization to fit your exact needs.



2. Can I override new?


Yes. However, this is no longer mentioned on
http://digitalmars.com/d/2.0/class.html, so it might be intended not to
be there anymore.

class foo {
new( uint size ) {
   return malloc( size );
}
}


3. Is the best (only?) way to do manual memory management to use scoped  
and emplace in conjunction with malloc and free?


Yes. Add helper functions, allocators and whatever else you may feel
necessary, as you like.



4. Any plans for allocators?


None of which I know. D should easily support building your own, though.
Of course, such a construct would then only be supported by your own
classes.



5. Does Phobos rely on a GC?


Parts of it, certainly.


--
Simen


Re: Miscellaneous memory management questions

2010-09-02 Thread Steven Schveighoffer
On Thu, 02 Sep 2010 09:31:22 -0400, Simen kjaeraas  
 wrote:



Peter Alexander  wrote:


Hi,

I've not been staying up to date on the new/delete discussions and  
related memory management issues, so I have a few questions.


1. How do I disable the GC?


In a way, you don't. You can, however, replace it with a stub GC.


You can disable it (for most intents and purposes) at runtime:

http://www.dsource.org/projects/druntime/browser/trunk/src/core/memory.d#L77


2. Can I override new?


Yes. However, this is no longer mentioned on
http://digitalmars.com/d/2.0/class.html, so it might be intended not to
be there anymore.

class foo {
 new( uint size ) {
return malloc( size );
 }
}


This is going to be deprecated.  Use emplace instead.

-Steve


Re: do D support something like C# 4.0 co/contra-variance?

2010-09-02 Thread Michal Minich
On Thu, 02 Sep 2010 07:38:24 -0400, bearophile wrote:

> dennis:
>> http://blog.t-l-k.com/dot-net/2009/c-sharp-4-covariance-and-
contravariance
> 
> I think D2 doesn't support those things yes. But they are useful and may
> be added to D3.
> 
> Bye,
> bearophile

I just found...
http://digitalmars.com/d/2.0/phobos/std_traits.html#isCovariantWith


Re: Please comment on http://d-programming-language.org/

2010-09-02 Thread Andrei Alexandrescu

On 09/02/2010 02:50 AM, Nick Sabalausky wrote:

"Nick Sabalausky"  wrote in message
news:i5nkrn$1tf...@digitalmars.com...

"Andrei Alexandrescu"  wrote in message
news:i5ni8j$1nk...@digitalmars.com...

Time to zero in on the overall design and start working on the content.
Please give the design one more round of comments.



I think I would try just getting rid of the red flare in the background,
and maybe just make a slightly reddish solid background color. It was a
neat idea, but I think getting it to really look right would be a bit
difficult.

Everything else seems to look fine though from a quick look-though. Main
font size is perfect.


I do have to say, I'm not a fan of justified text. I think it makes spacing
look really weird, inconsistent and distracting. But it's not too bad in
this case, so I can certainly live with it.


My website (www.erdani.com) uses an automatic hyphenator written in 
Javascript by Mathias Nater. Hyphenation improves the looks of justified 
text a lot. Walter wasn't keen about adding the hyphenator because it 
causes a flicker after loading.


Andrei


Re: [OT] Dark Star (1974) - the platinum age of movies

2010-09-02 Thread Andrei Alexandrescu

On 09/02/2010 04:47 AM, Walter Bright wrote:

Nick Sabalausky wrote:

What do you think about Solaris? I've heard reviewers praising it for
being "real" science fiction, so I've been tempted to try it out of
sheer curiosity, but I've never felt confident enough about it to
actually give it a try.


I watched the original russian one. It's sci-fi, but it's rather long
and boring. Like there's a long sequence of just the character driving
on the freeway. Driving, driving, driving, ...


That was a key scene.

Andrei


Re: Please comment on http://d-programming-language.org/

2010-09-02 Thread Andrej Mitrovic
Is this site going to replace the D2 pages on digitalmars.com? E.g.:
http://www.digitalmars.com/d/2.0/index.html

In any case, I'm fine with the design.. well except that red flare
which I'll never understand. Luckily I can just adblock an image and
the site looks nice then. :p

But we might as well fix up the language documentation while we're at
it. I've reported everything erroneous I've found in the language spec
and there's a list of the links to the bug reports here:

http://d.puremagic.com/issues/show_bug.cgi?id=4777#c1

Some of these are probably a mistake in my interpretation, of course.
I did provide some necessary steps to fix many of these issues. Steven
Schveighoffer was kind enough to fix the arrays page, but there are
many more left.

On Thu, Sep 2, 2010 at 9:03 AM, Andrei Alexandrescu
 wrote:
> Time to zero in on the overall design and start working on the content.
> Please give the design one more round of comments.
>
> Thanks,
>
> Andrei
>


Re: Please comment on http://d-programming-language.org/

2010-09-02 Thread klickverbot
On http://d-programming-language.org/memory-safe-d.html, the menu 
sidebar (which is a bit on the long side for the language reference in 
my mind) extends below the footer, which looks awkward.


Also, I personally think that the logo header in its current state is 
plain ugly – maybe making the font larger and putting the DigitalMars 
logo to the right side of it would be an idea?


Overloading + on points

2010-09-02 Thread Eduardo Cavazos

Eduardo Cavazos  wrote:


Here's a short program which creates a type for points and overloads

'+'

to do element wise addition as well as addition to floats, however it
produces an error:

--
import std.stdio ;

struct Pt
{
   float x , y ;

   Pt opBinary ( string op ) ( Pt a ) if ( op == "+" )
 { return Pt ( x + a.x , y + a.y ) ; }

   Pt opBinary ( string op ) ( float a ) if ( op == "+" )
 { return Pt ( x + a , y + a ) ; }
}

void main () { Pt ( 1.0 , 2.0 ) + Pt ( 3.0 , 4.0 ) ; }
--

The error:

pt_overload_test_a.d(15): Error: template instance opBinary!("+")
matches more than one template declaration,
pt_overload_test_a.d(8):opBinary(string op) if (op == "+") and
pt_overload_test_a.d(11):opBinary(string op) if (op == "+")

So, how should I go about this? :-)


Simen kjaeraas wrote:


That is indeed a perplexing error. It is caused by dmd not knowing
how to overload template functions based on both normal and template
parameters.

As for the solution:

Pt opBinary( string op : "+", T : Pt )( T a ) {...}
Pt opBinary( string op : "+", T : float )( T a ) {...}

should work. More explicitly:

Pt opBinary( string op, T )( T a ) if ( ( op == "+" ) && is( T == Pt ) )
{...}
Pt opBinary( string op, T )( T a ) if ( ( op == "+" ) && is( T == float )
) {...}


Is either one of those solutions preferrable? Or are they equivalent? 
I'd like to get these right now since there are a bunch more like this 
(for all the various operators and combinations).


For this experiment, I was going off of the examples in TDPL and I 
hadn't noticed yet one which covers a case like this; perhaps for 2nd 
edition. ;-)


Ed


Re: [D.typesystem] Static (CT) enforce anybody?

2010-09-02 Thread Don

Steven Schveighoffer wrote:
On Wed, 01 Sep 2010 17:11:50 -0400, Jonathan M Davis 
 wrote:



On Wednesday, September 01, 2010 13:54:15 Philippe Sigaud wrote:
On Wed, Sep 1, 2010 at 22:37, bearophile  
wrote:

> Philippe Sigaud:
> > Yes, Steve is right. Also, you cannot throw exceptions at CT.
>
> This is a temporary limitation :-)

Really? That means being able to create reference types at CT, that'd be
interesting, to say the least. And what code would catch them? Aren't 
they

caught by the runtime?


Well, according to TDPL, the ultimate goal is to be able to use _all_ 
of SafeD
with CTFE. So, exceptions would be on the list. However, I wouldn't 
expect CTFE

to get that powerful anytime soon.


I think step 1 is to rewrite the compiler in D.  Right now, CTFE is 
interpreting things from a C++-based program.  I think without a garbage 
collector too.


-Steve


Writing the compiler in D would be great, but it's a long way off. This 
will happen a lot sooner than that.
Exceptions, like almost all other CTFE features, are blocked by bug 
1330. Fixing this will require a new CTFE memory allocation system. It's 
 not terribly complicated, but won't happen until the high priority 
bugs are taken care of.
Other than memory management, most of the CTFE machinery for classes and 
exceptions is already in place. Note, for example, that reference 
parameters and struct member functions work correctly.


Re: [D.typesystem] Suggestion for improving OO inheritance models

2010-09-02 Thread Andrej Mitrovic
Yeah, my mistake. I missread your post. :)

But, you can use mixin expressions to add overloaded methods. E.g.:

import std.stdio;

class Bar
{
void func()
{
writeln("Bar.func()");
}

mixin("void func(string x) { writeln(x); }");
}

void main()
{
Bar bar = new Bar;
bar.func();
bar.func("test");
}

So I'm wondering if there could be an easy way to use mixin
expressions with mixin templates..

On Thu, Sep 2, 2010 at 10:17 AM, Jacob Carlborg  wrote:
> On 2010-09-01 23:39, Andrej Mitrovic wrote:
>>
>> You mean like this?:
>> module add_virtual_functions;
>>
>> import std.stdio : writeln;
>>
>> void main()
>> {
>>     test();
>> }
>>
>> mixin template Foo()
>> {
>>     void func()
>>     {
>>         writeln("Foo.func()");
>>     }
>> }
>>
>> class Bar
>> {
>>     void func()
>>     {
>>         writeln("Bar.func()");
>>     }
>> }
>>
>> class Code : Bar
>> {
>>     mixin Foo;
>> }
>>
>> void test()
>> {
>>     Bar b = new Bar();
>>     b.func();   // calls Bar.func()
>>
>>     Code c = new Code();
>>     c.func();   // calls Code.func()
>> }
>>
>
> No, that is overriding. Overloading is having several methods with the same
> name taking different number of parameters or parameters of different types.
>
> module test;
>
> mixin template Foo ()
> {
>        void bar (int i) {};
> }
>
> class Bar
> {
>        void bar () {};
>        mixin Foo;
> }
>
> void main ()
> {
>        auto bar = new Bar;
>        bar.bar(4); // line 17
>        bar.bar();
> }
>
> The above code results in these errors:
>
> test.d(17): Error: function test.Bar.bar () is not callable using argument
> types (int)
> test.d(17): Error: expected 0 arguments, not 1 for non-variadic function
> type void()
>
>
>> On Wed, Sep 1, 2010 at 11:30 PM, Jacob Carlborg  wrote:
>>>
>>> On 2010-09-01 22:44, Philippe Sigaud wrote:

 On Wed, Sep 1, 2010 at 18:13, retard  wrote:


    Have you taken a loot at Scala&  traits already? It would be a great
    starting point.


 Scala's traits are great! Implicits in Scala are quite interesting too.
 Also, Haskell typeclasses

 I wonder if D can have part of Scala traits functionality with mixins?
>>>
>>> You can't use D template mixins to add methods that will overload
>>> existing
>>> methods.
>>>
>>>
>>> --
>>> /Jacob Carlborg
>>>
>
>
> --
> /Jacob Carlborg
>


Re: Overloading + on points

2010-09-02 Thread Simen kjaeraas

Eduardo Cavazos  wrote:


Pt opBinary( string op : "+", T : Pt )( T a ) {...}
Pt opBinary( string op : "+", T : float )( T a ) {...}



Pt opBinary( string op, T )( T a ) if ( ( op == "+" ) && is( T == Pt ) )
{...}
Pt opBinary( string op, T )( T a ) if ( ( op == "+" ) && is( T == float  
)

) {...}


Is either one of those solutions preferrable? Or are they equivalent?  
I'd like to get these right now since there are a bunch more like this  
(for all the various operators and combinations).


They are not entirely equivalent. The first two use T : float, which is
a test of implicit castability, while is( T == float ) is a test for
equality. IOW, the second set would barf on receiving a non-float
parameter, like double or int. For some reason I messed that up. If
instead I had written the tests as is( T : Pt ) and is( T : float ),
they would be equivalent.

string op : "+" basically means the same as the template constraint
if ( op == "+" ). The latter is more flexible, as you can compare to more
values than the singular value in the op : "+".

--
Simen


Re: [D.typesystem] Static (CT) enforce anybody?

2010-09-02 Thread bearophile
Don:
> Writing the compiler in D would be great, but it's a long way off. This 
> will happen a lot sooner than that.

Is is possible&good to rewrite in D just the D interpreter used for CTFE?

Bye,
bearophile


Re: [D.typesystem] Static (CT) enforce anybody?

2010-09-02 Thread Denis Koroskin

On Thu, 02 Sep 2010 18:55:14 +0400, Don  wrote:


Steven Schveighoffer wrote:
On Wed, 01 Sep 2010 17:11:50 -0400, Jonathan M Davis  
 wrote:



On Wednesday, September 01, 2010 13:54:15 Philippe Sigaud wrote:
On Wed, Sep 1, 2010 at 22:37, bearophile   
wrote:

> Philippe Sigaud:
> > Yes, Steve is right. Also, you cannot throw exceptions at CT.
>
> This is a temporary limitation :-)

Really? That means being able to create reference types at CT, that'd  
be
interesting, to say the least. And what code would catch them? Aren't  
they

caught by the runtime?


Well, according to TDPL, the ultimate goal is to be able to use _all_  
of SafeD
with CTFE. So, exceptions would be on the list. However, I wouldn't  
expect CTFE

to get that powerful anytime soon.
 I think step 1 is to rewrite the compiler in D.  Right now, CTFE is  
interpreting things from a C++-based program.  I think without a  
garbage collector too.

 -Steve


Writing the compiler in D would be great, but it's a long way off. This  
will happen a lot sooner than that.
Exceptions, like almost all other CTFE features, are blocked by bug  
1330. Fixing this will require a new CTFE memory allocation system. It's  
  not terribly complicated, but won't happen until the high priority  
bugs are taken care of.
Other than memory management, most of the CTFE machinery for classes and  
exceptions is already in place. Note, for example, that reference  
parameters and struct member functions work correctly.


DDMD advances pretty fast, it can already compile druntime, phobos and  
some of the applications. We also started updating it to newer versions,  
so it's catching up (ddmd is at 2.036 atm). GC is disabled atm due to  
memory corruptions inherited from DMD, though. I believe once we resolve  
those and enable GC we could backport the changes to DMD so that it could  
use Boehm's GC. Win-win?


Re: [D.typesystem] Static (CT) enforce anybody?

2010-09-02 Thread dsimcha
== Quote from Denis Koroskin (2kor...@gmail.com)'s article
> DDMD advances pretty fast, it can already compile druntime, phobos and
> some of the applications. We also started updating it to newer versions,
> so it's catching up (ddmd is at 2.036 atm). GC is disabled atm due to
> memory corruptions inherited from DMD, though. I believe once we resolve
> those and enable GC we could backport the changes to DMD so that it could
> use Boehm's GC. Win-win?

Awesome work!  The only unfortunate thing about DDMD, as you point out on the
wiki, is that it's far from idiomatic D.  For example, I doubt you'd find 
anything
like:

import std.algorithm

in there.  BTW, is DDMD targeting D1 or D2?


Re: [D.typesystem] Static (CT) enforce anybody?

2010-09-02 Thread dsimcha
== Quote from dsimcha (dsim...@yahoo.com)'s article
> BTW, is DDMD targeting D1 or D2?

Clarification of an ambiguous question:  I know DDMD is supposed to compile D2.
Is the code to DDMD itself written in D1 or D2?



Re: [D.typesystem] Static (CT) enforce anybody?

2010-09-02 Thread Andrej Mitrovic
According to this it's DMD2:
http://www.dsource.org/projects/ddmd/wiki/BuildInstructions/Windows

2010/9/2 dsimcha :
> == Quote from dsimcha (dsim...@yahoo.com)'s article
>> BTW, is DDMD targeting D1 or D2?
>
> Clarification of an ambiguous question:  I know DDMD is supposed to compile 
> D2.
> Is the code to DDMD itself written in D1 or D2?
>
>


Re: Please comment on http://d-programming-language.org/

2010-09-02 Thread Kevin Watters
I definitely agree--the Digital Mars logo shouldn't be so prominent. 
Also that clicking it takes you to digitalmars.com is weird--a user will 
definitely expect to be taken back to / instead.


As for thoughts on a logo itself, just something simple with a unique 
font like the one at http://python.org/ would be fine.


klickverbot wrote:
On http://d-programming-language.org/memory-safe-d.html, the menu 
sidebar (which is a bit on the long side for the language reference in 
my mind) extends below the footer, which looks awkward.


Also, I personally think that the logo header in its current state is 
plain ugly – maybe making the font larger and putting the DigitalMars 
logo to the right side of it would be an idea?


Re: do D support something like C# 4.0 co/contra-variance?

2010-09-02 Thread Olivier Pisano

Le 02/09/2010 13:38, bearophile a écrit :

dennis:

http://blog.t-l-k.com/dot-net/2009/c-sharp-4-covariance-and-contravariance


I think D2 doesn't support those things yes. But they are useful and may be 
added to D3.

Bye,
bearophile


I was sure D did support covariance for the return types of overriden 
methods.


Cheers,

Olivier


Re: Please comment on http://d-programming-language.org/

2010-09-02 Thread Nick Sabalausky
"Nick Sabalausky"  wrote in message 
news:i5nkrn$1tf...@digitalmars.com...
> "Andrei Alexandrescu"  wrote in message 
> news:i5ni8j$1nk...@digitalmars.com...
>> Time to zero in on the overall design and start working on the content. 
>> Please give the design one more round of comments.
>>
>
> I think I would try just getting rid of the red flare in the background, 
> and maybe just make a slightly reddish solid background color. It was a 
> neat idea, but I think getting it to really look right would be a bit 
> difficult.
>
> Everything else seems to look fine though from a quick look-though. Main 
> font size is perfect.

One other nagging little issue: There's a little bit too much space between 
the lines of text within a paragraph. It'd be easier to read if that was 
tightned up a little. 




Re: [OT] Dark Star (1974) - the platinum age of movies

2010-09-02 Thread Walter Bright

Andrei Alexandrescu wrote:

On 09/02/2010 04:47 AM, Walter Bright wrote:

Nick Sabalausky wrote:

What do you think about Solaris? I've heard reviewers praising it for
being "real" science fiction, so I've been tempted to try it out of
sheer curiosity, but I've never felt confident enough about it to
actually give it a try.


I watched the original russian one. It's sci-fi, but it's rather long
and boring. Like there's a long sequence of just the character driving
on the freeway. Driving, driving, driving, ...


That was a key scene.


Whoosh. That's either your joke going way over my head, or the scene!


Re: [Slight OT] TDPL in Russia

2010-09-02 Thread Walter Bright

retard wrote:

In more expensive countries the same quality costs 5..20 times as much.


Import duties and liquor taxes may play a role in that.


Re: [Slight OT] TDPL in Russia

2010-09-02 Thread Walter Bright

Steven Schveighoffer wrote:
iPhone is hands down the best phone I've ever used.  I thought when I 
got it, I would have a hard time accessing small things like the 
on-screen keyboard keys, but I'm surprised at how accurate I am with it, 
even after only having it for a few months.  I regularly go to webnews 
on digitalmars and can click the minuscule links pretty accurately.


There's a special style sheet on digitalmars.com for printing which redoes the 
layout to make it print nicer. I looked in to doing a special style sheet for 
the iPod, but couldn't find a consistent way to make it work. I want such a 
style sheet to reorganize it as the 3-pane style is not the best for the tiny 
screen.


Re: [D.typesystem] Static (CT) enforce anybody?

2010-09-02 Thread Don

Denis Koroskin wrote:

On Thu, 02 Sep 2010 18:55:14 +0400, Don  wrote:


Steven Schveighoffer wrote:
On Wed, 01 Sep 2010 17:11:50 -0400, Jonathan M Davis 
 wrote:



On Wednesday, September 01, 2010 13:54:15 Philippe Sigaud wrote:
On Wed, Sep 1, 2010 at 22:37, bearophile  
wrote:

> Philippe Sigaud:
> > Yes, Steve is right. Also, you cannot throw exceptions at CT.
>
> This is a temporary limitation :-)

Really? That means being able to create reference types at CT, 
that'd be
interesting, to say the least. And what code would catch them? 
Aren't they

caught by the runtime?


Well, according to TDPL, the ultimate goal is to be able to use 
_all_ of SafeD
with CTFE. So, exceptions would be on the list. However, I wouldn't 
expect CTFE

to get that powerful anytime soon.
 I think step 1 is to rewrite the compiler in D.  Right now, CTFE is 
interpreting things from a C++-based program.  I think without a 
garbage collector too.

 -Steve


Writing the compiler in D would be great, but it's a long way off. 
This will happen a lot sooner than that.
Exceptions, like almost all other CTFE features, are blocked by bug 
1330. Fixing this will require a new CTFE memory allocation system. 
It's   not terribly complicated, but won't happen until the high 
priority bugs are taken care of.
Other than memory management, most of the CTFE machinery for classes 
and exceptions is already in place. Note, for example, that reference 
parameters and struct member functions work correctly.


DDMD advances pretty fast, it can already compile druntime, phobos and 
some of the applications. 


Cool! Have you tried the DMD test suite?

We also started updating it to newer versions, 
so it's catching up (ddmd is at 2.036 atm). GC is disabled atm due to 
memory corruptions inherited from DMD, though. I believe once we resolve 
those and enable GC we could backport the changes to DMD so that it 
could use Boehm's GC. Win-win?


Yes, although the absence of GC is not the problem with the CTFE 
implementation.


Re: Please comment on http://d-programming-language.org/

2010-09-02 Thread Nick Sabalausky
"Nick Sabalausky"  wrote in message 
news:i5nkrn$1tf...@digitalmars.com...
> "Andrei Alexandrescu"  wrote in message 
> news:i5ni8j$1nk...@digitalmars.com...
>> Time to zero in on the overall design and start working on the content. 
>> Please give the design one more round of comments.
>>
>
> I think I would try just getting rid of the red flare in the background, 
> and maybe just make a slightly reddish solid background color. It was a 
> neat idea, but I think getting it to really look right would be a bit 
> difficult.
>
> Everything else seems to look fine though from a quick look-though. Main 
> font size is perfect.

Another thing: At the bottom of the left-nav column it says "Translate this 
page:", but then there's nothing there. Kinda weird. 




Re: do D support something like C# 4.0 co/contra-variance?

2010-09-02 Thread Nick Sabalausky
"Olivier Pisano"  wrote in message 
news:i5oq50$1i0...@digitalmars.com...
> Le 02/09/2010 13:38, bearophile a écrit :
>> dennis:
>>> http://blog.t-l-k.com/dot-net/2009/c-sharp-4-covariance-and-contravariance
>>
>> I think D2 doesn't support those things yes. But they are useful and may 
>> be added to D3.
>>
>> Bye,
>> bearophile
>
> I was sure D did support covariance for the return types of overriden 
> methods.
>

The OP was talking about this:

class TemplClass(T) {}
class Base {}
class Derived : Base {}

And then having some way to have TemplClass!Derived considered to be derived 
from TemplClass!Base, or the other way around. 




D Compiler for .NET

2010-09-02 Thread William Irwin

Hi All

I downloaded and had a play with this. It's a good start.
It seems the last commit at http://dnet.codeplex.com/
was this time last year.

There also have been no updates at http://the-free-meme.blogspot.com/
for the last year.

It seems a little bit abandoned, I think maybe we need to rescue
it before it gets lost to the mists of time. Maybe a good first step
is to update it to the latest dmd front end.

I'm just checking, is anyone else looking at this? is Cristian Vlasceanu 
still around? His last post here was last year.


Cheers
William


Re: [OT] Dark Star (1974) - the platinum age of movies

2010-09-02 Thread BLS

On 02/09/2010 09:28, Nick Sabalausky wrote:

What do you think about Solaris? I've heard reviewers praising it for being
"real" science fiction, so I've been tempted to try it out of sheer
curiosity, but I've never felt confident enough about it to actually give it
a try.

The movies both the Russian original as well as the new one are boring. 
But if you like SF, buy the book from Stanislaw Lem. IMO the best SF 
author and philosopher ever.

bjoern


Re: [Challenge] implementing the ambiguous operator in D

2010-09-02 Thread Philippe Sigaud
On Thu, Sep 2, 2010 at 09:06, Peter Alexander
wrote:

> On 2/09/10 7:34 AM, Pelle wrote:
>
>> It needs opEquals :-)
>>
>
> Yeah, it needs a lot of things :)
>
> You could easily add unary operators as well (e.g. so that -amb([1, 2]) ==
> [-1, -2]. I didn't bother adding more than I did because it would make the
> post too large, and wouldn't really add anything (I thought that the binary
> ops + dispatch covered most of the interesting cases).
>
> Also, I think it would supposed to return amb(map!...) instead of just
> returning map!... (otherwise you couldn't chain them), but that's a simple
> fix.
>

Yes, like Haskell monads: get into, transform, return a wrapped result.


Does your code compile for you? I tried it when you posted it on SO and the
.length, .replace("a","u") didn't work.
I had to change opDispatch from

auto opDispatch(string f)()
{
mixin("return map!((E e) { return e."~f~"; })(r);");
}

to:

auto opDispatch(string f)()
{
return map!(unaryFun!("a."~f))(r);
}

I tried to do the same for the dispatch with arguments, but got very strange
errors. DMD told me it couldn't get the args at CT.

Oh, but you changed your code on SO. It can know do the first example too.
That's good, and was in fact my main subject of interest. Amb seems to be
like the product of two ranges (with an operator), which is then flattened.

What I don't get is the link with the ruby article and its use of if.


Philippe


Re: [OT] Dark Star (1974) - the platinum age of movies

2010-09-02 Thread Andrei Alexandrescu

On 9/2/10 14:01 CDT, Walter Bright wrote:

Andrei Alexandrescu wrote:

On 09/02/2010 04:47 AM, Walter Bright wrote:

Nick Sabalausky wrote:

What do you think about Solaris? I've heard reviewers praising it for
being "real" science fiction, so I've been tempted to try it out of
sheer curiosity, but I've never felt confident enough about it to
actually give it a try.


I watched the original russian one. It's sci-fi, but it's rather long
and boring. Like there's a long sequence of just the character driving
on the freeway. Driving, driving, driving, ...


That was a key scene.


Whoosh. That's either your joke going way over my head, or the scene!


The scene was of the main character driving on a busy highway into a 
crowded metropolis. The meaning was to question the veracity and meaning 
of perception, existence, and human interaction - all of which are 
central themes in the movie.


Andrei


Re: [Slight OT] TDPL in Russia

2010-09-02 Thread Nick Sabalausky
"Steven Schveighoffer"  wrote in message 
news:op.vieozxaleav...@localhost.localdomain...
> On Thu, 02 Sep 2010 01:53:41 -0400, Nick Sabalausky  wrote:
>
>>
>> The pre-release iterations are completely irrelevant. If the end result 
>> is
>> something with nearly-zero tactile feedback, super-ultra-hyperly-modal
>> interface, and can't be turned off with the "power" button, but only by
>> holding "Up" for five seconds, or has tiny ui elements that can't be
>> accessed with a stylus or fingernail but is far too small to do reliably
>> with a finger, or is a closed-locked-down-platform, or is branded as 
>> being a
>> PDA-like device but still doesn't support something as basic as 
>> copy-paste
>> that PalmOS devices already had nearly ten years prior even in smartphone
>> form (Handspring Treo), then yes, the polish is crap no matter how much
>> crappier the early iterations were. Apple's "polish" exists as nothing 
>> more
>> than aesthetic-oriented graphic design, and it fools most people.
>
> Love my iPhone.  Love it.  My last two phones were a Palm Treo and a 
> Samsung touch-screen (w/stylus) smartphone with Windows mobile 6.  They 
> are absolute garbage compared to this.  Granted, I started with the 3gs, 
> and upgraded to iOS4 about a month after I got it, so my phone is the 
> result of 3 years of polish, but I feel apple has the right focus for it.
>
> iPhone is hands down the best phone I've ever used.  I thought when I got 
> it, I would have a hard time accessing small things like the on-screen 
> keyboard keys, but I'm surprised at how accurate I am with it, even after 
> only having it for a few months.  I regularly go to webnews on digitalmars 
> and can click the minuscule links pretty accurately.
>
> You can not like them if you want, you are entitled to your opinion, but 
> it seems like you have a very negative view of almost everything :)  I bet 
> your glass is half empty, huh...
>

I'm a "technical-ist": The glass is half-empty and half-full at the same 
time. Problem is, most glasses I've seen are only a quarter full and with 
overly-sweetened content (or three-quarters empty if you prefer ;) ).

I just have standards.

A. Search "you're holding it wrong".

B. Closed platforms are evil (not to be confused with closed source).

C. Gatekeeping is evil. See also http://www.paulgraham.com/apple.html

D. Service provider lock-in is evil. My phone works with *any* service 
provider (and didn't become uselessly obsolete after a year or two): 
http://www.uniden.com/products/productdetail.cfm?product=EXAI398  And I 
really do like this phone a lot.

E. A die-hard Apple fan I know recently showed me his beloved iPad. 
Accurately setting the text-cursor was nearly impossible. But that would 
have been an incredibly simple fix: Use a screen that worked with a stylus 
or fingernail. There's millions of them out there. Even if that would have 
prevented multi-touch (and I don't know that it would or would not have), 
after using the multi-touch, I felt it added no real value other than a 
"gee-whiz" gimmick factor. Stylus/fingernail support would have added at 
least some real value.

F. Like all Apple software, the software on the iPad/iPhone are appallingly 
slim on settings/options.

G. A *phone* without tactile dial buttons is just plain wrong. What is it 
with Apple's long-standing war against tactile feedback? It detracts from 
usability and the only thing it adds is high-tech-gee-whiz-gimmick.

H. What's there to protect the highly-prominent screen?

I. I don't give a crap how thin they can make it. But Apple seems to think I 
should care. Heck, I don't want to spend hundreds of dollars on something 
that I'll constantly feel I'm about to accidentally snap in half. But that's 
exactly how I felt with the iPad.

That's a lot of issues for something that's supposedly well-polished.




Re: [OT] Dark Star (1974) - the platinum age of movies

2010-09-02 Thread Nick Sabalausky
"Andrei Alexandrescu"  wrote in message 
news:i5ov2v$2c0...@digitalmars.com...
> On 9/2/10 14:01 CDT, Walter Bright wrote:
>> Andrei Alexandrescu wrote:
>>> On 09/02/2010 04:47 AM, Walter Bright wrote:
 Nick Sabalausky wrote:
> What do you think about Solaris? I've heard reviewers praising it for
> being "real" science fiction, so I've been tempted to try it out of
> sheer curiosity, but I've never felt confident enough about it to
> actually give it a try.

 I watched the original russian one. It's sci-fi, but it's rather long
 and boring. Like there's a long sequence of just the character driving
 on the freeway. Driving, driving, driving, ...
>>>
>>> That was a key scene.
>>
>> Whoosh. That's either your joke going way over my head, or the scene!
>
> The scene was of the main character driving on a busy highway into a 
> crowded metropolis. The meaning was to question the veracity and meaning 
> of perception, existence, and human interaction - all of which are central 
> themes in the movie.
>

Sounds like one of those ultra-artsy movies I would probably hate :/

Kinda reminds me of that Robin Williams movie where he was a robot, and the 
David Bowie movie "The Man Who Fell To Earth". Both seemed to be trying for 
some sort of artsy profound "meaning", but ultimately came across as 
pretentious snore-fests.




Re: [Slight OT] TDPL in Russia

2010-09-02 Thread Nick Sabalausky
"Nick Sabalausky"  wrote in message 
news:i5ov60$2c5...@digitalmars.com...
> "Steven Schveighoffer"  wrote in message 
> news:op.vieozxaleav...@localhost.localdomain...
>>
>> Love my iPhone.  Love it.  My last two phones were a Palm Treo and a 
>> Samsung touch-screen (w/stylus) smartphone with Windows mobile 6.  They 
>> are absolute garbage compared to this.  Granted, I started with the 3gs, 
>> and upgraded to iOS4 about a month after I got it, so my phone is the 
>> result of 3 years of polish, but I feel apple has the right focus for it.
>>
>> iPhone is hands down the best phone I've ever used.  I thought when I got 
>> it, I would have a hard time accessing small things like the on-screen 
>> keyboard keys, but I'm surprised at how accurate I am with it, even after 
>> only having it for a few months.  I regularly go to webnews on 
>> digitalmars and can click the minuscule links pretty accurately.
>>
>> You can not like them if you want, you are entitled to your opinion, but 
>> it seems like you have a very negative view of almost everything :)  I 
>> bet your glass is half empty, huh...
>>
>
> I'm a "technical-ist": The glass is half-empty and half-full at the same 
> time. Problem is, most glasses I've seen are only a quarter full and with 
> overly-sweetened content (or three-quarters empty if you prefer ;) ).
>
> I just have standards.
>
> A. Search "you're holding it wrong".
>
> B. Closed platforms are evil (not to be confused with closed source).
>
> C. Gatekeeping is evil. See also http://www.paulgraham.com/apple.html
>
> D. Service provider lock-in is evil. My phone works with *any* service 
> provider (and didn't become uselessly obsolete after a year or two): 
> http://www.uniden.com/products/productdetail.cfm?product=EXAI398  And I 
> really do like this phone a lot.
>
> E. A die-hard Apple fan I know recently showed me his beloved iPad. 
> Accurately setting the text-cursor was nearly impossible. But that would 
> have been an incredibly simple fix: Use a screen that worked with a stylus 
> or fingernail. There's millions of them out there. Even if that would have 
> prevented multi-touch (and I don't know that it would or would not have), 
> after using the multi-touch, I felt it added no real value other than a 
> "gee-whiz" gimmick factor. Stylus/fingernail support would have added at 
> least some real value.
>
> F. Like all Apple software, the software on the iPad/iPhone are 
> appallingly slim on settings/options.
>
> G. A *phone* without tactile dial buttons is just plain wrong. What is it 
> with Apple's long-standing war against tactile feedback? It detracts from 
> usability and the only thing it adds is high-tech-gee-whiz-gimmick.
>
> H. What's there to protect the highly-prominent screen?
>
> I. I don't give a crap how thin they can make it. But Apple seems to think 
> I should care. Heck, I don't want to spend hundreds of dollars on 
> something that I'll constantly feel I'm about to accidentally snap in 
> half. But that's exactly how I felt with the iPad.
>
> That's a lot of issues for something that's supposedly well-polished.
>

J. What happens when the battery gets old and won't hold a charge?




Re: [OT] Dark Star (1974) - the platinum age of movies

2010-09-02 Thread Andrei Alexandrescu

On 9/2/10 14:55 CDT, Nick Sabalausky wrote:

"Andrei Alexandrescu"  wrote in message
news:i5ov2v$2c0...@digitalmars.com...

On 9/2/10 14:01 CDT, Walter Bright wrote:

Andrei Alexandrescu wrote:

On 09/02/2010 04:47 AM, Walter Bright wrote:

Nick Sabalausky wrote:

What do you think about Solaris? I've heard reviewers praising it for
being "real" science fiction, so I've been tempted to try it out of
sheer curiosity, but I've never felt confident enough about it to
actually give it a try.


I watched the original russian one. It's sci-fi, but it's rather long
and boring. Like there's a long sequence of just the character driving
on the freeway. Driving, driving, driving, ...


That was a key scene.


Whoosh. That's either your joke going way over my head, or the scene!


The scene was of the main character driving on a busy highway into a
crowded metropolis. The meaning was to question the veracity and meaning
of perception, existence, and human interaction - all of which are central
themes in the movie.



Sounds like one of those ultra-artsy movies I would probably hate :/

Kinda reminds me of that Robin Williams movie where he was a robot, and the
David Bowie movie "The Man Who Fell To Earth". Both seemed to be trying for
some sort of artsy profound "meaning", but ultimately came across as
pretentious snore-fests.


Difference is, The Bicentennial Man and The Man Who Fell To Earth don't 
hold a candle to Solaris.


Andrei


Re: [OT] Dark Star (1974) - the platinum age of movies

2010-09-02 Thread bearophile
BLS:
> But if you like SF, buy the book from Stanislaw Lem. IMO the best SF 
> author and philosopher ever.

The SF author I like most is Greg Egan.
Any group of ten of his short stories contain more ideas than the whole career 
of an average SF author :-)

Bye,
bearophile


Re: [OT] Dark Star (1974) - the platinum age of movies

2010-09-02 Thread Nick Sabalausky
"Andrei Alexandrescu"  wrote in message 
news:i5p06p$2dq...@digitalmars.com...
> On 9/2/10 14:55 CDT, Nick Sabalausky wrote:
>> "Andrei Alexandrescu"  wrote in message
>> news:i5ov2v$2c0...@digitalmars.com...
>>>
>>> The scene was of the main character driving on a busy highway into a
>>> crowded metropolis. The meaning was to question the veracity and meaning
>>> of perception, existence, and human interaction - all of which are 
>>> central
>>> themes in the movie.
>>>
>>
>> Sounds like one of those ultra-artsy movies I would probably hate :/
>>
>> Kinda reminds me of that Robin Williams movie where he was a robot, and 
>> the
>> David Bowie movie "The Man Who Fell To Earth". Both seemed to be trying 
>> for
>> some sort of artsy profound "meaning", but ultimately came across as
>> pretentious snore-fests.
>
> Difference is, The Bicentennial Man and The Man Who Fell To Earth don't 
> hold a candle to Solaris.
>

Well that's good to hear then. Although in the case of The Man Who Fell To 
Earth, I got the impression that even really artsy-film fans probably 
wouldn't have liked it either. Even for what it was trying to be, it didn't 
seem very well done. 




Re: [OT] Dark Star (1974) - the platinum age of movies

2010-09-02 Thread Max Samukha

On 09/02/2010 11:07 PM, Andrei Alexandrescu wrote:



Difference is, The Bicentennial Man and The Man Who Fell To Earth don't
hold a candle to Solaris.



Interestingly, Lem didn't like the movie at all: 
http://en.wikipedia.org/wiki/Solaris_%281972_film%29#Reception_and_legacy




Re: [OT] Dark Star (1974) - the platinum age of movies

2010-09-02 Thread Andrei Alexandrescu

On 9/2/10 15:31 CDT, Max Samukha wrote:

On 09/02/2010 11:07 PM, Andrei Alexandrescu wrote:



Difference is, The Bicentennial Man and The Man Who Fell To Earth don't
hold a candle to Solaris.



Interestingly, Lem didn't like the movie at all:
http://en.wikipedia.org/wiki/Solaris_%281972_film%29#Reception_and_legacy


Yah, and Tarkovsky didn't care much for the book either!

Andrei


Re: Bug 3999 and 4261

2010-09-02 Thread so

Does this mean no more defining bits as enums?


Now that would be brutal, it is one of the best use cases of enum if not  
the best...


--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/


Re: [OT] Dark Star (1974) - the platinum age of movies

2010-09-02 Thread so
On Thu, 02 Sep 2010 12:47:01 +0300, Walter Bright  
 wrote:



Nick Sabalausky wrote:
What do you think about Solaris? I've heard reviewers praising it for  
being "real" science fiction, so I've been tempted to try it out of  
sheer curiosity, but I've never felt confident enough about it to  
actually give it a try.


I watched the original russian one. It's sci-fi, but it's rather long  
and boring. Like there's a long sequence of just the character driving  
on the freeway. Driving, driving, driving, ...


All the movies of him i have seen is like that, but he knows well how to  
strike, deadly.
You should give Nostalghia a try, especially one scene that involves  
(don't want to spoil it but) a candle.


--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/


Re: Bug 3999 and 4261

2010-09-02 Thread bearophile
Steven Schveighoffer:

> enum myBits
> {
> flag1 = 1;
> flag2 = 2;
> flag3 = 4;
> }
> 
> void fn(int flags);
> 
> fn(myBits.flag1 | myBits.flag2);
> 
> That was the one case where I really like the implicit conversion.

Thank you for that important use case. enum is used for three different things: 
compile-time constants, a sequence of separated symbols, and a group of flags 
that may be grouped.

In C# there is the [Flags] attribute that helps a bit in the creation of such 
flags, and documents that an enum is indeed a flags set.

Recently I have proposed to add to Phobos something similar to a 
std.bitmanip.bitfields that builds a flag set (the powers of two are set 
automatically, you just give the flag names. It may also add a first dummy flag 
with value zero). Probably it's not too much hard to do.

The problem is that such (hypotetically named) std.bitmanip.flagset defines 
what the language/compiler sees as a normal enum, so it has to share its 
features with normal enums. In C++0x you don't have this problem, because you 
use "enum" to define flags and "enum class" to define the strongly typed 
sequence of symbols.

Your fn() function doesn't truly accept any int, it accepts only a bitwise 
combination of members of myBits. A more strict type system may enforce this. 
This is feasible in D if std.bitmanip.flagset returns a struct instead of an 
enum. This struct contains just an int and methods to perform bitwise 
operations that return a struct of the same type. So the signature becomes void 
fn(MyBits flags).


This is an idea:


struct MyBits {
private alias size_t T;
static assert(is(T == ubyte) || is(T == ushort) || is(T == uint) ||
  is(T == ulong) || is(T == size_t));

private T _bits;
public enum nothing = MyBits(0);

private enum uint nflags = 3; // flag1, flag2, flag3
static assert(nflags <= T.sizeof * 8);

static if (nflags == (T.sizeof * 8))
private enum T full = T.max; // because ((1UL << 64) - 1) != ulong.max
else
private enum T full = ((cast(T)1) << nflags) - 1;

public enum flag1 = MyBits((cast(T)1) << 0);
public enum flag2 = MyBits((cast(T)1) << 1);
public enum flag3 = MyBits((cast(T)1) << 2);

this(MyBits other) { this._bits = other._bits; }

this(T value) { this._bits = value; }

invariant() {
assert(!(this._bits & ~full));
}

MyBits opUnary(string Op="~")() {
return MyBits(~this._bits & full);
}

MyBits opBinary(string op)(MyBits other) if (op == "|" || op == "&") {
mixin("return MyBits(this._bits " ~ op ~" other._bits);");
}
}

//--
import std.stdio: writeln;

void fn(MyBits flags) {
writeln(flags._bits);
}

void main() {
fn(MyBits.flag1 | MyBits.flag2);
fn(MyBits.flag1 & MyBits.flag2);
auto f = MyBits.flag1;
assert(f == MyBits.flag1);
writeln((1UL << 64) - 1);
}



Given the names "flag1", "flag2", "flag3" (and the optional type T), 
std.bitmanip.flagset generates a struct like MyBits (plus few more missing 
parts).

-

Don:

> OTOH if each member has an explicitly defined value, it's reasonable to
> perform logical operations on it.

Thank you for your usually wise point of view.

Bye,
bearophile


Re: Bug 3999 and 4261

2010-09-02 Thread Don

so wrote:

Does this mean no more defining bits as enums?


Now that would be brutal, it is one of the best use cases of enum if not 
the best...


Yes.
I reckon, if an enum doesn't explicitly define the value of each member, 
it shouldn't implicitly convert to int -- and it should not be possible 
to treat it as bits.


OTOH if each member has an explicitly defined value, it's reasonable to 
perform logical operations on it.





Re: Please comment on http://d-programming-language.org/

2010-09-02 Thread Kagamin
Andrei Alexandrescu Wrote:

> Time to zero in on the overall design and start working on the content. 
> Please give the design one more round of comments.

Doesn't scale well when I increase font size.


Re: Bug 3999 and 4261

2010-09-02 Thread bearophile
Don:
> OTOH if each member has an explicitly defined value, it's reasonable to 
> perform logical operations on it.

See my recent answer to Schveighoffer. I think that's not a fully good idea 
because when you define an enum like that and you use its values as 
powers-of-two flags, the type system doesn't help you enforce it is a true 
combination of the flags instead of a generic number (and you may put bugs when 
you define the values to assign to the flags), so I think something like a 
std.bitmanip.flagset that produces a struct is better when you need to define a 
flag set.

Bye,
bearophile


Re: [Challenge] implementing the ambiguous operator in D

2010-09-02 Thread Nick Sabalausky
"Philippe Sigaud"  wrote in message 
news:mailman.42.1283371696.858.digitalmar...@puremagic.com...
> Hey, this question on SO makes for a good challenge:
>
> http://stackoverflow.com/questions/3608834/is-it-possible-to-generically-implement-the-amb-operator-in-d
>
> The amb operator does this:
>
> amb([1, 2]) * amb([3, 4, 5]) == amb([3, 4, 5, 6, 8, 10])
> amb(["hello", "world"]) ~ amb(["qwerty"]) == amb(["helloqwerty", 
> "worldqwerty"])
> amb(["hello", "world"]) ~ "qwerty" == amb(["helloqwerty", "worldqwerty"])
> amb(["hello", "very long string"]).length = amb([5, 16])
>

Interesting thing, but devil's advocate: What would be the uses/benefits of 
that versus just having "for each element" versions of the operators?

Also, "ambiguous" seems like a rather odd name for what it does. I don't see 
how ambiguity has anything to do with it. That disconnect made it difficult 
at first for me to understand what it was. It's more like an "elementwise" 
or something.

Certainly useful, I had reason to make a similar function once:

/// ctfe_subMapJoin("Hi WHO. ", "WHO", ["Joey", "Q", "Sue"])
/// --> "Hi Joey. Hi Q. Hi Sue. "
T ctfe_subMapJoin(T)(T str, T match, T[] replacements) if(isSomeString!T)
{
T value = "";
foreach(T replace; replacements)
value ~= ctfe_substitute(str, match, replace);

return value;
}

Though I'll grant that's a questionable name for it. I wasn't sure what else 
to call it though.




Re: Bug 3999 and 4261

2010-09-02 Thread Nick Sabalausky
"bearophile"  wrote in message 
news:i5p63u$2pl...@digitalmars.com...
> Don:
>> OTOH if each member has an explicitly defined value, it's reasonable to
>> perform logical operations on it.
>
> See my recent answer to Schveighoffer. I think that's not a fully good 
> idea because when you define an enum like that and you use its values as 
> powers-of-two flags, the type system doesn't help you enforce it is a true 
> combination of the flags instead of a generic number (and you may put bugs 
> when you define the values to assign to the flags), so I think something 
> like a std.bitmanip.flagset that produces a struct is better when you need 
> to define a flag set.
>

I think all the discussions we've had about enum make it clear that enum 
suffers from a bit of an identity crisis. It doesn't know what it is and 
ends up being mediocre at everything it dabbles in.




Re: Bug 3999 and 4261

2010-09-02 Thread bearophile
>  the type system doesn't help you enforce it is a true combination of the 
> flags instead of a generic number

I have used std.bitmanip.bitfields some time, and in my opinion its best 
quality is its overflow tests. They have caught few of my bugs (it's easy to 
overflow such little numbers). It's also another good example why having 
runtime integer overflow tests is a Good Thing.

Bye,
bearophile


Re: [OT] Dark Star (1974) - the platinum age of movies

2010-09-02 Thread Walter Bright

Nick Sabalausky wrote:
Well that's good to hear then. Although in the case of The Man Who Fell To 
Earth, I got the impression that even really artsy-film fans probably 
wouldn't have liked it either. Even for what it was trying to be, it didn't 
seem very well done. 



Zardoz can never be topped!  
http://craptastictv.com/wp-content/uploads/zardoz.jpg


Re: [OT] Dark Star (1974) - the platinum age of movies

2010-09-02 Thread Walter Bright

Andrei Alexandrescu wrote:
The scene was of the main character driving on a busy highway into a 
crowded metropolis. The meaning was to question the veracity and meaning 
of perception, existence, and human interaction - all of which are 
central themes in the movie.


This sounds more like an after the fact rationalization!


Re: [OT] Dark Star (1974) - the platinum age of movies

2010-09-02 Thread bearophile
Walter Bright:
> Zardoz can never be topped!  
> http://craptastictv.com/wp-content/uploads/zardoz.jpg

I think Sean Connery is having nightmares still about that carnivalesque look 
:-)

Bye,
bearophile


Re: [OT] Dark Star (1974) - the platinum age of movies

2010-09-02 Thread Nick Sabalausky
"Walter Bright"  wrote in message 
news:i5p72r$2r7...@digitalmars.com...
> Nick Sabalausky wrote:
>> Well that's good to hear then. Although in the case of The Man Who Fell 
>> To Earth, I got the impression that even really artsy-film fans probably 
>> wouldn't have liked it either. Even for what it was trying to be, it 
>> didn't seem very well done.
>
>
> Zardoz can never be topped! 
> http://craptastictv.com/wp-content/uploads/zardoz.jpg

Ha! That's hilarious! Disturbing...But hilarious :) 




Re: Please comment on http://d-programming-language.org/

2010-09-02 Thread Michel Fortin
On 2010-09-02 03:03:33 -0400, Andrei Alexandrescu 
 said:


Time to zero in on the overall design and start working on the content. 
Please give the design one more round of comments.


Andrei, if your system language (or browser language) is set to 
something other than English, there's a big blue bar at the top that 
appears about 1 second after loading the page offering your a 
translation. It's quite annoying... it really needs to go. There's 
already a translate widget in the left menu so so the top bar is 
certainly not needed.


And the only way to get rid of it is by disabling JavaScript, by using 
Google Chrome (it seems the bar doesn't appear in Chrome), or by 
changing the preferred language to English in the system settings or 
the browser settings.


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



Re: Please comment on http://d-programming-language.org/

2010-09-02 Thread Michel Fortin

On 2010-09-02 15:10:52 -0400, "Nick Sabalausky"  said:


"Nick Sabalausky"  wrote in message
news:i5nkrn$1tf...@digitalmars.com...

"Andrei Alexandrescu"  wrote in message
news:i5ni8j$1nk...@digitalmars.com...

Time to zero in on the overall design and start working on the content.
Please give the design one more round of comments.



I think I would try just getting rid of the red flare in the background,
and maybe just make a slightly reddish solid background color. It was a
neat idea, but I think getting it to really look right would be a bit
difficult.

Everything else seems to look fine though from a quick look-though. Main
font size is perfect.


Another thing: At the bottom of the left-nav column it says "Translate this
page:", but then there's nothing there. Kinda weird.


That's because you have Javascript disabled.

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



Re: [OT] Dark Star (1974) - the platinum age of movies

2010-09-02 Thread Walter Bright

Andrei Alexandrescu wrote:
The scene was of the main character driving on a busy highway into a 
crowded metropolis. The meaning was to question the veracity and meaning 
of perception, existence, and human interaction - all of which are 
central themes in the movie.


But if I showed you 15 minutes of me driving around on the freeway, you'd think 
I was torturing you.


It's like that unauthenticated Pollock painting. If it is authenticated, it's a 
masterpiece. If not, it's just paint dribbled on canvas. The painting is the 
same in either case.


Re: [Challenge] implementing the ambiguous operator in D

2010-09-02 Thread Nick Sabalausky
"Nick Sabalausky"  wrote in message 
news:i5p68t$2pt...@digitalmars.com...
> "Philippe Sigaud"  wrote in message 
> news:mailman.42.1283371696.858.digitalmar...@puremagic.com...
>> Hey, this question on SO makes for a good challenge:
>>
>> http://stackoverflow.com/questions/3608834/is-it-possible-to-generically-implement-the-amb-operator-in-d
>>
>> The amb operator does this:
>>
>> amb([1, 2]) * amb([3, 4, 5]) == amb([3, 4, 5, 6, 8, 10])
>> amb(["hello", "world"]) ~ amb(["qwerty"]) == amb(["helloqwerty", 
>> "worldqwerty"])
>> amb(["hello", "world"]) ~ "qwerty" == amb(["helloqwerty", "worldqwerty"])
>> amb(["hello", "very long string"]).length = amb([5, 16])
>>
>
> Interesting thing, but devil's advocate: What would be the uses/benefits 
> of that versus just having "for each element" versions of the operators?
>
> Also, "ambiguous" seems like a rather odd name for what it does. I don't 
> see how ambiguity has anything to do with it. That disconnect made it 
> difficult at first for me to understand what it was. It's more like an 
> "elementwise" or something.
>

I've been starting at the Ruby page, and I think I'm starting to understand 
it a little more:

Suppose you have two "mostly" unknown values: x and y. Neither you, nor the 
computer at runtime, know what either of their values actually are. But, you 
*do* know a finite set of values that they *might* be:

auto x = amb([1, 2]); // x is either 1 or 2, but I don't know which
auto y = amb([3, 4, 5]); // y is either 3, 4 or 5, but I don't know which
assert(x != 2); // Not guaranteed to be == 2 at this point
assert(y != 4);

// x*y must be one of these values, but I don't know which, it could be any 
of them:
assert(x*y == amb([3, 4, 5, 6, 8, 10]);

// Here's the *real* magic (psuedo-syntax):
// For some bizarre reason, this means
// that x*y must be == 8 (despite the !=)
amb(if x*y != 8);

// Since x*y has been determined to be 8,
// the real values of x and y are now known and
// completely unambiguous:
assert(x == 2);
assert(y == 4);




Re: [OT] Dark Star (1974) - the platinum age of movies

2010-09-02 Thread Nick Sabalausky
"Walter Bright"  wrote in message 
news:i5pa6s$316...@digitalmars.com...
> Andrei Alexandrescu wrote:
>> The scene was of the main character driving on a busy highway into a 
>> crowded metropolis. The meaning was to question the veracity and meaning 
>> of perception, existence, and human interaction - all of which are 
>> central themes in the movie.
>
> But if I showed you 15 minutes of me driving around on the freeway, you'd 
> think I was torturing you.
>
> It's like that unauthenticated Pollock painting. If it is authenticated, 
> it's a masterpiece. If not, it's just paint dribbled on canvas. The 
> painting is the same in either case.

Context does change things - sometimes for good reasons, sometimes for 
questionable reasons.

Someone recently brought up the book Atlanta Nights ( 
http://en.wikipedia.org/wiki/Atlanta_Nights ). If I had come across that in 
a library a week ago, I likely would have thought "What a horrid book! 
Terrible waste of paper." But now that I know the story behind it (it was 
*deliberately* bad), I find it hilarious.

Another example: Back when the "Jerry Maguire" movie came out sometime in 
the 90's, one song on its soundtrack started getting played everywhere: "I 
would walk 10,000 miles" or something like that. I *hated* that song. So 
irritating. A few years later I found out that song was originally released 
in the 80's (not the 90's), made it big in Europe, but got ignored in the US 
until Jerry Maguire popularized it. But see, I'm a huge 80's nut. I swear, 
the very next time I heard the song, it didn't bother me anymore, and I 
actually started to like it. All that even though I knew perfectly well it 
was the exact same song I had hated and that the *only* thing that had 
changed was my knowledge of what decade it was made.

It *is* an incredibly stupid phenomenon, no doubt. But it is a normal human 
thing, for better or worse.




Re: Please comment on http://d-programming-language.org/

2010-09-02 Thread Nick Sabalausky
"Michel Fortin"  wrote in message 
news:i5pa3l$318...@digitalmars.com...
> On 2010-09-02 15:10:52 -0400, "Nick Sabalausky"  said:
>
>> "Nick Sabalausky"  wrote in message
>> news:i5nkrn$1tf...@digitalmars.com...
>>> "Andrei Alexandrescu"  wrote in message
>>> news:i5ni8j$1nk...@digitalmars.com...
 Time to zero in on the overall design and start working on the content.
 Please give the design one more round of comments.

>>>
>>> I think I would try just getting rid of the red flare in the background,
>>> and maybe just make a slightly reddish solid background color. It was a
>>> neat idea, but I think getting it to really look right would be a bit
>>> difficult.
>>>
>>> Everything else seems to look fine though from a quick look-though. Main
>>> font size is perfect.
>>
>> Another thing: At the bottom of the left-nav column it says "Translate 
>> this
>> page:", but then there's nothing there. Kinda weird.
>
> That's because you have Javascript disabled.
>

Ok, that at least explains it. However:

If that translate tool only works with JS on, then the "Translate this 
page:" text should only be inserted into the page via JS, not baked into the 
raw HTML.




Re: [Slight OT] TDPL in Russia

2010-09-02 Thread retard
Thu, 02 Sep 2010 16:03:59 -0400, Nick Sabalausky wrote:

> J. What happens when the battery gets old and won't hold a charge?

You buy a new one, of course. Why this will never happen is that once a 
new model of the iShit comes out, as a die hard Apple fan you simply MUST 
buy it and get rid of the old one. I heard they don't even replace the 
batteries in Apple's repair services. They just hand you a new phone.


Re: [Slight OT] TDPL in Russia

2010-09-02 Thread Nick Sabalausky
"retard"  wrote in message 
news:i5pc2e$2l...@digitalmars.com...
> Thu, 02 Sep 2010 16:03:59 -0400, Nick Sabalausky wrote:
>
>> J. What happens when the battery gets old and won't hold a charge?
>
> You buy a new one, of course. Why this will never happen is that once a
> new model of the iShit comes out, as a die hard Apple fan you simply MUST
> buy it and get rid of the old one. I heard they don't even replace the
> batteries in Apple's repair services. They just hand you a new phone.

Yup. Exactly my point.

---
Not sent from an iPhone.




Re: [OT] Dark Star (1974) - the platinum age of movies

2010-09-02 Thread Andrei Alexandrescu

On 9/2/10 17:03 CDT, Walter Bright wrote:

Andrei Alexandrescu wrote:

The scene was of the main character driving on a busy highway into a
crowded metropolis. The meaning was to question the veracity and
meaning of perception, existence, and human interaction - all of which
are central themes in the movie.


This sounds more like an after the fact rationalization!


That's the thing with art - a relational value.

Andrei


Re: [OT] Dark Star (1974) - the platinum age of movies

2010-09-02 Thread Andrei Alexandrescu

On 9/2/10 17:58 CDT, Walter Bright wrote:

Andrei Alexandrescu wrote:

The scene was of the main character driving on a busy highway into a
crowded metropolis. The meaning was to question the veracity and
meaning of perception, existence, and human interaction - all of which
are central themes in the movie.


But if I showed you 15 minutes of me driving around on the freeway,
you'd think I was torturing you.


Well yah but that's because it'd be /you/. :o)


It's like that unauthenticated Pollock painting. If it is authenticated,
it's a masterpiece. If not, it's just paint dribbled on canvas. The
painting is the same in either case.


Not at all. The comparison doesn't make sense. I and others I discussed 
it with found the scene was very powerful, and when I first watched the 
movie I had no opinion about the director etc. That you didn't find 
anything in it doesn't automatically make it crappy.



Andrei


Re: [Slight OT] TDPL in Russia

2010-09-02 Thread Michel Fortin

On 2010-09-02 15:05:26 -0400, Walter Bright  said:


Steven Schveighoffer wrote:
iPhone is hands down the best phone I've ever used.  I thought when I 
got it, I would have a hard time accessing small things like the 
on-screen keyboard keys, but I'm surprised at how accurate I am with 
it, even after only having it for a few months.  I regularly go to 
webnews on digitalmars and can click the minuscule links pretty 
accurately.


There's a special style sheet on digitalmars.com for printing which 
redoes the layout to make it print nicer. I looked in to doing a 
special style sheet for the iPod, but couldn't find a consistent way to 
make it work. I want such a style sheet to reorganize it as the 3-pane 
style is not the best for the tiny screen.


Basically, you wanted to do what I did with my website. What was the 
problem exactly? Creating a style sheet that displays the contents well 
when read linearly? Or was it about how to trigger this particular 
style sheet for iPhone and iPods? The later's quite simple, just use 
this media attribute:


media="handheld, only screen and (max-device-width: 480px)"

The "handheld, " part isn't really relevant for iOS devices, but it'll 
trigger the stylesheet with Opera-based handheld browsers.


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



Re: Please comment on http://d-programming-language.org/

2010-09-02 Thread Michel Fortin

On 2010-09-02 19:24:41 -0400, "Nick Sabalausky"  said:


"Michel Fortin"  wrote in message
news:i5pa3l$318...@digitalmars.com...

On 2010-09-02 15:10:52 -0400, "Nick Sabalausky"  said:


Another thing: At the bottom of the left-nav column it says "Translate
this
page:", but then there's nothing there. Kinda weird.


That's because you have Javascript disabled.


Ok, that at least explains it. However:

If that translate tool only works with JS on, then the "Translate this
page:" text should only be inserted into the page via JS, not baked into the
raw HTML.


Very true. A small document.write("

Translate this page:

") should do the trick. -- Michel Fortin michel.for...@michelf.com http://michelf.com/

Re: Please comment on http://d-programming-language.org/


On 02/09/2010 23:56, Michel Fortin wrote:

On 2010-09-02 15:10:52 -0400, "Nick Sabalausky"  said:


"Nick Sabalausky"  wrote in message
news:i5nkrn$1tf...@digitalmars.com...

"Andrei Alexandrescu"  wrote in message
news:i5ni8j$1nk...@digitalmars.com...

Time to zero in on the overall design and start working on the content.
Please give the design one more round of comments.



I think I would try just getting rid of the red flare in the background,
and maybe just make a slightly reddish solid background color. It was a
neat idea, but I think getting it to really look right would be a bit
difficult.

Everything else seems to look fine though from a quick look-though. Main
font size is perfect.


Another thing: At the bottom of the left-nav column it says "Translate
this
page:", but then there's nothing there. Kinda weird.


That's because you have Javascript disabled.


It isn't.  I have it enabled, and I'm getting the same.  And the page is 
throwing errors.  As reported by FF 3.6.8:


Warning: Expected declaration but found '*'.  Skipped to next declaration.
Source File: 
http://translate.googleapis.com/translate_static/css/translateelement.css

Line: 2

Warning: Error in parsing value for 'display'.  Declaration dropped.
Source File: 
http://translate.googleapis.com/translate_static/css/translateelement.css

Line: 2

Security Error: Content at http://googleads.g.doubleclick.net/ may not 
load data from http://d-programming-language.org/wc.html.


Error: uncaught exception: [Exception... "'[JavaScript Error: "b.value 
is null" {file: "chrome://google-toolbar-lib/content/toolbar.js" line: 
2515}]' when calling method: [nsIFactory::createInstance]"  nsresult: 
"0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)"  location: "JS 
frame :: chrome://google-toolbar/content/gtb.js :: anonymous :: line 81" 
 data: yes]


Error: uncaught exception: [Exception... "'[JavaScript Error: "b.value 
is null" {file: "chrome://google-toolbar-lib/content/toolbar.js" line: 
2515}]' when calling method: [nsIFactory::createInstance]"  nsresult: 
"0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)"  location: "JS 
frame :: 
http://translate.googleapis.com/translate_static/js/element/main.js :: 
Vi :: line 184"  data: yes]



Stewart.


Re: [OT] Dark Star (1974) - the platinum age of movies


Andrei Alexandrescu wrote:
That you didn't find 
anything in it doesn't automatically make it crappy.


Yes it does!


Re: [Slight OT] TDPL in Russia


Michel Fortin wrote:
Basically, you wanted to do what I did with my website. What was the 
problem exactly? Creating a style sheet that displays the contents well 
when read linearly? Or was it about how to trigger this particular style 
sheet for iPhone and iPods? The later's quite simple, just use this 
media attribute:


media="handheld, only screen and (max-device-width: 480px)"

The "handheld, " part isn't really relevant for iOS devices, but it'll 
trigger the stylesheet with Opera-based handheld browsers.



The problem was that I googled it and every hit used a radically different 
method and they'd refer to it as "seems" to work. I'm not comfortable using such 
hacks. I'd like one that officially works and is standards compliant.


Re: Please comment on http://d-programming-language.org/


On 02/09/2010 08:03, Andrei Alexandrescu wrote:

Time to zero in on the overall design and start working on the content.
Please give the design one more round of comments.


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.

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.


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/

Stewart.


Re: [Slight OT] TDPL in Russia


retard wrote:

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


J. What happens when the battery gets old and won't hold a charge?


You buy a new one, of course. Why this will never happen is that once a 
new model of the iShit comes out, as a die hard Apple fan you simply MUST 
buy it and get rid of the old one. I heard they don't even replace the 
batteries in Apple's repair services. They just hand you a new phone.


It's the subscription model for hardware. It also effectively kills the market 
for used iPods.


Re: [OT] Dark Star (1974) - the platinum age of movies


On 9/2/10 21:01 CDT, Walter Bright wrote:

Andrei Alexandrescu wrote:

That you didn't find anything in it doesn't automatically make it crappy.


Yes it does!


H, that's a good argument. I thought of it for a while and I agree 
with you.


Andrei


Re: [Slight OT] TDPL in Russia


Hello Walter,


Nick Sabalausky wrote:


"Walter Bright"  wrote in message
news:i5n87k$14u...@digitalmars.com...


Jonathan M Davis wrote:


I hear that this sort of thing tends to happen with Indie artists
as well. There are fans who like them until they get popular. I
guess that there are people who _like_ it when the stuff that they
like is niche.


I bet that deep down they know that they don't actually like it,
they just like being in the in crowd where they all smugly
congratulate each other about how they get it and nobody else does
:-)


I hope not. If that's so, what would that mean about those of us who
have been here in the D crowd for the last few years? ;)


If you leave when D goes mainstream, then you're here for all the
wrong reasons!



s/when/because/ ???

--
... <





Re: [Slight OT] TDPL in Russia

Walter Bright Wrote:

> retard wrote:
> > Thu, 02 Sep 2010 16:03:59 -0400, Nick Sabalausky wrote:
> > 
> >> J. What happens when the battery gets old and won't hold a charge?
> > 
> > You buy a new one, of course. Why this will never happen is that once a 
> > new model of the iShit comes out, as a die hard Apple fan you simply MUST 
> > buy it and get rid of the old one. I heard they don't even replace the 
> > batteries in Apple's repair services. They just hand you a new phone.
> 
> It's the subscription model for hardware. It also effectively kills the 
> market 
> for used iPods.

Then the model is broken somewhere, because Apple hardware has an incredibly 
high resale value.


Re: Please comment on http://d-programming-language.org/

I think AA just laid emphasis on the proprietor of d language



2010/9/3 Kevin Watters 

> I definitely agree--the Digital Mars logo shouldn't be so prominent. Also
> that clicking it takes you to digitalmars.com is weird--a user will
> definitely expect to be taken back to / instead.
>
> As for thoughts on a logo itself, just something simple with a unique font
> like the one at http://python.org/ would be fine.
>
>
> klickverbot wrote:
>
>> On http://d-programming-language.org/memory-safe-d.html, the menu sidebar
>> (which is a bit on the long side for the language reference in my mind)
>> extends below the footer, which looks awkward.
>>
>> Also, I personally think that the logo header in its current state is
>> plain ugly – maybe making the font larger and putting the DigitalMars logo
>> to the right side of it would be an idea?
>>
>


Re: Please comment on http://d-programming-language.org/

remove google translate, it sucks


Re: Bug 3999 and 4261


bearophile wrote:

Don:
OTOH if each member has an explicitly defined value, it's reasonable to 
perform logical operations on it.


See my recent answer to Schveighoffer. I think that's not a fully good idea 
because when you define an enum like that and you use its values as 
powers-of-two flags, the type system doesn't help you enforce it is a true 
combination of the flags instead of a generic number (and you may put bugs when 
you define the values to assign to the flags), so I think something like a 
std.bitmanip.flagset that produces a struct is better when you need to define a 
flag set.

Bye,
bearophile


That's impossible. That would make interfacing to C a nightmare.
By the way, enums which consist of flags frequently have values which 
have more than one bit set. The case { A=1, B=2, C=4, D=8 } is only a 
special case.
In the general case, it's not realistic to hope that the compiler could 
determine which values are valid, and which are not.
But, with my suggestion, simple enums (a list of mutually exclusive 
values) would become strong enums.


Re: [Slight OT] TDPL in Russia


Sean Kelly wrote:

Walter Bright Wrote:


retard wrote:

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


J. What happens when the battery gets old and won't hold a charge?
You buy a new one, of course. Why this will never happen is that once a 
new model of the iShit comes out, as a die hard Apple fan you simply MUST 
buy it and get rid of the old one. I heard they don't even replace the 
batteries in Apple's repair services. They just hand you a new phone.
It's the subscription model for hardware. It also effectively kills the market 
for used iPods.


Then the model is broken somewhere, because Apple hardware has an incredibly 
high resale value.


I wouldn't buy a used ipod because of the non-replaceable battery. One has no 
idea how much life is left in it. I've had a number of gadgets become useless 
once the battery would no longer take a charge.


  1   2   >