Re: Programming in D book is about 62% translated

2012-09-19 Thread MattCoder

On Sunday, 16 September 2012 at 06:39:44 UTC, Ali Çehreli wrote:
I have continued with the translation of the book. At this 
point there are 439 pages in English of total 703 pages in 
Turkish.


In addition to many corrections and additions throughout the 
book, there are two more chapters translated:


* Constructor and Other Special Functions
* Operator Overloading

As a reminder, the book is available as PDF, downloadable from 
the header of each chapter:


  http://ddili.org/ders/d.en/index.html

No Kindle or Lulu versions yet.

Ali


Awesome, thank you!


Re: Programming in D book is about 62% translated

2012-09-19 Thread MattCoder

On Sunday, 16 September 2012 at 06:39:44 UTC, Ali Çehreli wrote:
I have continued with the translation of the book. At this 
point there are 439 pages in English of total 703 pages in 
Turkish.


In addition to many corrections and additions throughout the 
book, there are two more chapters translated:


* Constructor and Other Special Functions
* Operator Overloading

As a reminder, the book is available as PDF, downloadable from 
the header of each chapter:


  http://ddili.org/ders/d.en/index.html

No Kindle or Lulu versions yet.

Ali


Awesome, thanks!


Re: Programming in D book is about 62% translated

2012-09-19 Thread deed

Great!


Re: [OT] Was: totally satisfied :D

2012-09-19 Thread Walter Bright

On 9/18/2012 8:36 AM, Sean Kelly wrote:

On Sep 18, 2012, at 12:48 AM, Walter Bright newshou...@digitalmars.com
wrote:


The most common failure I've had are the power supplies, they're still as
bad today as in the 80's.


There are good power supplies, they just don't come in pre-built computers
because they're expensive.  I think the same could be said of products from
any era.




Well, you guys have convinced me. Next time I buy a PS, I'm going to spend more 
money on it.


Re: Review of Andrei's std.benchmark

2012-09-19 Thread Jacob Carlborg

On 2012-09-17 23:13, Jens Mueller wrote:


Post all feedback to this thread. Constructive feedback is very much
appreciated.

To conclude in more Andrei like words: Happy destruction!


* Why is scheduleForBenchmarking a string? Can't it be a template mixin?

* What's the most appropriate way of just timing a block of code? 
Something like this:


auto time = benchmark!({ /* some code */ })(1);

If that's the case then I suggest setting a default value of 1 for the 
n parameter.


* If I want to format the printed result differently, say in HTML, how 
would I do that? Should I use the benchmark function and iterate the 
BenchmarkResult array?


* BTW why doesn't benchmark return the BenchmarkResult array?

* Is this module so important to keep it as a top level module? I'm 
thinking something like a utility package or a time/date package. How 
about std.util.benchmark?


--
/Jacob Carlborg


Re: reference to 'self' inside a function

2012-09-19 Thread Jacob Carlborg

On 2012-09-18 23:21, Rob T wrote:


Obviously the above solution is not reasonable, esp for a language that
attempts to provide good reflection abilities.


I would not call the reflection abilities in D good. D has reflection 
abilities but they are far from good. Most are different hacks bolt 
together.


--
/Jacob Carlborg


Re: reference to 'self' inside a function

2012-09-19 Thread Jacob Carlborg

On 2012-09-19 01:21, Rob T wrote:

Actually I find the __traits system a bit convoluted and inconsistent
with other similar features. There seems to be a real need to unify the
different methods of reflection in D.

For example, I can do this without using __traits

int i;
writeln( i.stringof );

and I can do this

void function x() {};
writeln( x.stringof );

but it won't work for the main function

int main(char[][] args)
{
   writeln( main.stringof ); // compile error (bug?)
}


I think the reason for this is that the compiler will resolve main as 
a function call, but it will fail because no arguments are given. This 
is a typical feature where it seems no one really know how it should 
behave. .stringof is very poorly documented. It says nothing about what 
the returned string might look like.



but this works

writeln(__traits( identifier, main ));

It seems that __traits(itentifier, ) and .stringof are two ways of
getting access to the same information.

So why do we have __traits and the built in properties that overlap in
functionality? Why is it inconsistently applied as seen with function
main (although that could simply be a bug)? The situation is rather
confusing.


.stringof was available long before D2 was created, __traits is only 
available in D2. I think __traits was create to try to improve the 
compile time reflection abilities in D.


--
/Jacob Carlborg


Re: [OT] Was: totally satisfied :D

2012-09-19 Thread Jacob Carlborg

On 2012-09-18 09:37, Nick Sabalausky wrote:


- Oracle (Even if it's not a terrible DBMS, it's certainly overpriced)


You need a SAP system to keep track of the cost of your Oracle system :)

--
/Jacob Carlborg


Re: [OT] Was: totally satisfied :D

2012-09-19 Thread Jacob Carlborg

On 2012-09-18 17:12, H. S. Teoh wrote:


Reformatting and reinstalling, though, is a matter of course on any
Windows installation that I've ever seen. I've heard of such things as
stable Windows installations, but as far as my experience goes those are
mythical beasts. Things just fail the moment you start doing something
non-trivial, like anything besides read email, watch youtube, and browse
the 'Net. I've been spared this pain for the most part 'cos I swore off
Windows and have been running Linux as my main OS for at least 10 years,
but I do still get requests for help to fix broken Windows
installations. Most of the time, the thing's either unfixable (hood is
welded shut) or not worth the effort to fix 'cos reformat + reinstall is
faster (shudder).


I had a Windows machine running as an HTPC that I had no problems with. 
Although the only thing I used it for was to watch movies.



That's not to say that Linux doesn't have its own problems, of course.
The libc5 - libc6 transition is one of the memorable nightmares in its
history. There have been others. X11 failures can get really ugly (back
in the days before KVM, a crashed or wedged X server meant your graphics
card is stuck in graphics mode and the console shows up as random dot
patterns -- good luck trying to fix the system when you can't see what
you type). Once I accidentally broke the dynamic linker, and EVERYTHING
broke, because everything depended on it. The only thing left was a
single bash shell over SSH (this was on a remote server with no easy
physical access), and the only commands that didn't fail were built-in
bash commands like echo. So I had to transfer busybox over by converting
it into a series of echo commands that reconstituted the binary and
copy-n-paste it. It's one of those moments where you get so much
satisfaction from having rescued a dying system singlehandedly with echo
commands, but it's also one of those things that puts Linux on some
people's no-way, no-how list.


That's also the beauty of Linux, you could do it. Try doing that on a 
Windows machine.


--
/Jacob Carlborg


Re: [OT] Was: totally satisfied :D

2012-09-19 Thread Jacob Carlborg

On 2012-09-18 17:36, Sean Kelly wrote:

On Sep 18, 2012, at 12:48 AM, Walter Bright newshou...@digitalmars.com wrote:


The most common failure I've had are the power supplies, they're still as bad 
today as in the 80's.


There are good power supplies, they just don't come in pre-built computers 
because they're expensive.  I think the same could be said of products from any 
era.


What kind of computers are you guys using. I have never owned a 
pre-built computer (except for laptops). I always buy my own components 
and assembles the computer. Then I know what I get.


--
/Jacob Carlborg


Re: [OT] Was: totally satisfied :D

2012-09-19 Thread Jacob Carlborg

On 2012-09-18 21:58, Jonathan M Davis wrote:


I have an rsync cronjob back up my home partition nightly so that the chances
of losing that data are slim (though I don't back up all the rest of my data
from my many hard drives unfortunately - it would take up too much space).
It's saved me on a number of occasions from corrupted or lost data even
_without_ hard drive failures. Regular backups are a must IMHO, though I think
that most people consider it too much of a hassle to bother with
unfortunately.


It's dead easy on Mac OS X with the built in TimeMachine. Just select 
the backup disk and you're done. By default it backups all HFS+ disks, 
if you want you can choose to exclude some.


--
/Jacob Carlborg


Re: Review of Andrei's std.benchmark

2012-09-19 Thread Jonathan M Davis
On Wednesday, September 19, 2012 09:13:40 Jacob Carlborg wrote:
 * Is this module so important to keep it as a top level module? I'm
 thinking something like a utility package or a time/date package. How
 about std.util.benchmark?

util is one of the worst package names ever, because it means basically 
nothing. Any function could go in there.

As for a time/date package, we already have std.datetime (which will hopefully 
be split into the package std.datetime at some point, but we need something 
like DIP 15 or 16 before we can do that), and we're moving the benchmarking 
_out_ of there. If std.datetime were already a package, then maybe putting it 
in there would make some sense, but benchmarking is arguably fundamentally 
different from what the rest of std.datetime does. I really so no problem with 
benchmarking being its own thing, and std.benchmark works just fine for that.

- Jonathan M Davis


Re: Review of Andrei's std.benchmark

2012-09-19 Thread Peter Alexander
I don't see why `benchmark` takes (almost) all of its parameters 
as template parameters. It looks quite odd, seems unnecessary, 
and (if I'm not mistaken) makes certain use cases quite difficult.


For example, suppose I want to benchmark a function several times 
with different parameters and names, how would I do that?


foreach (i; 0..10)
{
printBenchmark!( format(Test %d, i), { someFunc(i); } )();
}

This won't work because i isn't known at compile time, and for 
some use cases it can't be known at compile time.


I wouldn't mind if there was some real benefit to taking these as 
template arguments, but there doesn't seem to be any value at all 
-- it just limits usage.


Re: Review of Andrei's std.benchmark

2012-09-19 Thread Thiez
On Tuesday, 18 September 2012 at 22:01:30 UTC, Andrei 
Alexandrescu wrote:
After extensive tests with a variety of aggregate functions, I 
can say firmly that taking the minimum time is by far the best 
when it comes to assessing the speed of a function.


What if one tries to benchmark a nondeterministic function? In 
such a case one might well be interested in the best run, worst 
run, and the average.


Re: Review of Andrei's std.benchmark

2012-09-19 Thread Manu
On 19 September 2012 01:02, Andrei Alexandrescu 
seewebsiteforem...@erdani.org wrote:

 On 9/18/12 5:07 PM, Øivind wrote:

 * For all tests, the best run is selected, but would it not be

 reasonable in some cases to get the average value? Maybe excluding the
 runs that are more than a couple std. deviations away from the mean
 value..


 After extensive tests with a variety of aggregate functions, I can say
 firmly that taking the minimum time is by far the best when it comes to
 assessing the speed of a function.


The fastest execution time is rarely useful to me, I'm almost always much
more interested in the slowest execution time.
In realtime software, the slowest time is often the only important factor,
everything must be designed to tolerate this possibility.
I can also imagine other situations where multiple workloads are competing
for time, the average time may be more useful in that case.

Side question:
Running a test over and over pre-populates the cache with all associated
data after the first cycle... The cache needs to be randomised between each
cycle to get realistic results.


Re: [OT] Was: totally satisfied :D

2012-09-19 Thread Mehrdad
On Wednesday, 19 September 2012 at 06:11:00 UTC, Walter Bright 
wrote:

On 9/18/2012 8:36 AM, Sean Kelly wrote:
On Sep 18, 2012, at 12:48 AM, Walter Bright 
newshou...@digitalmars.com

wrote:


The most common failure I've had are the power supplies, 
they're still as

bad today as in the 80's.


There are good power supplies, they just don't come in 
pre-built computers
because they're expensive.  I think the same could be said of 
products from

any era.



Well, you guys have convinced me. Next time I buy a PS, I'm 
going to spend more money on it.



What exactly do you guys _do_ with your computer that suddenly 
breaks the power supplies?! Maybe I'm just too young to know, but 
I've never seen a power supply break...


Re: [OT] Was: totally satisfied :D

2012-09-19 Thread Simen Kjaeraas

On Wed, 19 Sep 2012 10:37:44 +0200, Mehrdad wfunct...@hotmail.com wrote:


On Wednesday, 19 September 2012 at 06:11:00 UTC, Walter Bright wrote:

On 9/18/2012 8:36 AM, Sean Kelly wrote:
On Sep 18, 2012, at 12:48 AM, Walter Bright  
newshou...@digitalmars.com

wrote:


The most common failure I've had are the power supplies, they're  
still as

bad today as in the 80's.


There are good power supplies, they just don't come in pre-built  
computers
because they're expensive.  I think the same could be said of products  
from

any era.



Well, you guys have convinced me. Next time I buy a PS, I'm going to  
spend more money on it.



What exactly do you guys _do_ with your computer that suddenly breaks  
the power supplies?! Maybe I'm just too young to know, but I've never  
seen a power supply break...


Use them every day for a regular computer? While I've had no spectacular
failures (yet), this has been sufficient to break a PSU or two.

Then I decided to spend money getting a quality PSU, and it hasn't had
a single problem in 7 years.

--
Simen


Re: [OT] Was: totally satisfied :D

2012-09-19 Thread monarch_dodra

On Wednesday, 19 September 2012 at 08:36:46 UTC, Mehrdad wrote:



What exactly do you guys _do_ with your computer that suddenly 
breaks the power supplies?! Maybe I'm just too young to know, 
but I've never seen a power supply break...


I once tried to do some GPU calculations. After several hours, 
the PSU failed, frying my components. The graphics card was 
literally ON FIRE (!). Nothing was salvageable.


Anyways, that is what *THAT* is how to kill a PSU, and *THAT* is 
what happens when they fail...


Re: Would like to see ref and out required for function calls

2012-09-19 Thread Timon Gehr

On 09/18/2012 11:26 PM, Ziad Hatahet wrote:

On Mon, Sep 10, 2012 at 1:36 PM, Timon Gehr timon.g...@gmx.ch
mailto:timon.g...@gmx.ch wrote:


Yes, Go uses explicit pointer types.
Regarding Rust, you are wrong.
I have built the latest Rust compiler.

import io;

fn modify(a:int){
 a = 2;
}
fn swapT(a:T,b:T){
let tmp-a;
a-b;
b-tmp;
}


The `fn foo(a: T)` syntax is being deprecated in favor of `fn foo(a:
mut T)`.

So your modify function becomes: `fn modify(a: mut int)`, and gets
called as `modify(mut a)`.

Your swap function becomes `fn swapT(a: mut T, b: mut T)` and gets
called as `swap(mut a, mut b)`.

So effectively, Rust also opted for explicit ref at the call site.

--
Ziad


I see. Thank you for the clarification.


Re: [OT] Was: totally satisfied :D

2012-09-19 Thread Mehrdad
On Wednesday, 19 September 2012 at 08:53:33 UTC, monarch_dodra 
wrote:

On Wednesday, 19 September 2012 at 08:36:46 UTC, Mehrdad wrote:



What exactly do you guys _do_ with your computer that suddenly 
breaks the power supplies?! Maybe I'm just too young to know, 
but I've never seen a power supply break...


I once tried to do some GPU calculations. After several hours, 
the PSU failed, frying my components. The graphics card was 
literally ON FIRE (!). Nothing was salvageable.


Anyways, that is what *THAT* is how to kill a PSU, and *THAT* 
is what happens when they fail...


Dang that's... intense. o.o

Are laptop power supplies more durable or something?
None of my laptops (or anyone's laptop I know) have had 
problematic power supplies...


Re: Review of Andrei's std.benchmark

2012-09-19 Thread Peter Alexander
The fastest execution time is rarely useful to me, I'm almost 
always much

more interested in the slowest execution time.
In realtime software, the slowest time is often the only 
important factor,

everything must be designed to tolerate this possibility.
I can also imagine other situations where multiple workloads 
are competing

for time, the average time may be more useful in that case.


The problem with slowest is that you end up with the occasional 
OS hiccup or GC collection which throws the entire benchmark off. 
I see your point, but unless you can prevent the OS from 
interrupting, the time would be meaningless.


Re: [OT] Was: totally satisfied :D

2012-09-19 Thread monarch_dodra

On Wednesday, 19 September 2012 at 09:19:13 UTC, Mehrdad wrote:
On Wednesday, 19 September 2012 at 08:53:33 UTC, monarch_dodra 
wrote:

On Wednesday, 19 September 2012 at 08:36:46 UTC, Mehrdad wrote:



What exactly do you guys _do_ with your computer that 
suddenly breaks the power supplies?! Maybe I'm just too young 
to know, but I've never seen a power supply break...


I once tried to do some GPU calculations. After several hours, 
the PSU failed, frying my components. The graphics card was 
literally ON FIRE (!). Nothing was salvageable.


Anyways, that is what *THAT* is how to kill a PSU, and *THAT* 
is what happens when they fail...


Dang that's... intense. o.o

Are laptop power supplies more durable or something?
None of my laptops (or anyone's laptop I know) have had 
problematic power supplies...


The difference is that a laptop's wattage is nowhere near the 
wattage of a desktop. This is even truer of modern computer, 
where desktops consume even more power, whereas laptops are 
consuming much less. I've never had a problem with a laptop PSU 
block itself... Not that I can say the same about the batteries.


I have about 2 laptops at home, whose batteries are left with, 
literally, 0 charge. Even a simple split second power cut, and 
they fill turn off :(


Re: [OT] Was: totally satisfied :D

2012-09-19 Thread Paulo Pinto

On Tuesday, 18 September 2012 at 05:26:33 UTC, H. S. Teoh wrote:

On Tue, Sep 18, 2012 at 12:35:45AM -0400, Nick Sabalausky wrote:
[...]
Yet for whatever reason corporate types just love WebEx. Every 
meeting
and cow-orker's son's birthday party is on WebEx. Ugh. Nowadays 
I just
resort to looking over the cow-orker's shoulders when reviewing 
WebEx

videos instead of defiling my PC with that crap.



I am a corporate guy that loves WebEx.

If you ever went through the amount of failed attempts in the 
corporate world starting with NetMeeting, Sametime and a couple 
of others I already forgot, in the last decade, you can only love 
how easy and stable it is to use WebEx conferences.



--
Paulo


Re: [OT] Was: totally satisfied :D

2012-09-19 Thread Mehrdad
On Tuesday, 18 September 2012 at 21:19:13 UTC, Nick Sabalausky 
wrote:

On Tue, 18 Sep 2012 08:12:50 -0700
H. S. Teoh hst...@quickfur.ath.cx wrote:


Reformatting and reinstalling, though, is a matter of course 
on any Windows installation that I've ever seen. I've heard of 
such things as stable Windows installations, but as far as my 
experience goes those are mythical beasts.


My desktop's XP installation (SP2 even) has been aces for 
years. And years ago, when I did have to reinstall, it was just 
because of something stupid I'd done.


I've seen plenty of screwed up Win boxes (even Win7), but it's 
always owned by someone who doesn't even know what a web 
browser is, so I figure chances are it's due to one of two 
things:


A. The user doing something stupid.

B. The user not using the web the way I do: with Adblock Plus 
installed, and JS and Flash disabled by default.



I vote +1 for (A). :)

It's not a mythical beast, it's sitting right in front of me!

My situation with Windows 7 has been quite stable too.

FYI, my Windows is run:
- Without any antimalware software of any kind (I hate them)
- Always with admin privileges (UAC turned off)
- In Test Mode (security risk in terms of digital signatures)
- I currently boot 5 OSes:
  - Windows 7 x64, the original which the laptop came with, which 
I use 99% of the time

  - Windows 8 I installed a few weeks ago for trying it out
  - Windows XP 32-bit and 64-bit for testing stuff
  - Linux (Ubuntu) x64 for when I need it
- I mess with partitions every few weeks
- I hack around with Windows internals quite a bit ;)

Guess which OS is the one that I've reinstalled a bazillion 
times? Ubuntu.


And it _still_ doesn't boot automatically!
I tell it to install Grub, and it says OK.
It even _force_ it to reinstall Grub, and it says OK, I 
reinstalled myself.
Then I reboot and it goes onto the screen and just... doesn't 
boot.

I have to type in the boot sequence commands myself.
Why? Because a random, unrelated partition on the disk changed 
and Ubuntu freaked out.


At least when Windows has the occasional boot problem which I 
stupidly caused, it's _fixable_ and doesn't lie to you about 
having fixed it!!






Re: [OT] Was: totally satisfied :D

2012-09-19 Thread Mehrdad

On Tuesday, 18 September 2012 at 21:19:13 UTC, Nick Sabalausky
wrote:

On Tue, 18 Sep 2012 08:12:50 -0700
H. S. Teoh hst...@quickfur.ath.cx wrote:


Reformatting and reinstalling, though, is a matter of course 
on any Windows installation that I've ever seen. I've heard of 
such things as stable Windows installations, but as far as my 
experience goes those are mythical beasts.


My desktop's XP installation (SP2 even) has been aces for 
years. And years ago, when I did have to reinstall, it was just 
because of something stupid I'd done.


I've seen plenty of screwed up Win boxes (even Win7), but it's 
always owned by someone who doesn't even know what a web 
browser is, so I figure chances are it's due to one of two 
things:


A. The user doing something stupid.

B. The user not using the web the way I do: with Adblock Plus 
installed, and JS and Flash disabled by default.



I vote +1 for (A). :)

It's not a mythical beast, it's sitting right in front of me!

My situation with Windows 7 has been quite stable too.

FYI, my Windows is run:
- Without any antimalware software of any kind (I hate them)
- Always with admin privileges (UAC turned off)
- In Test Mode (security risk in terms of digital signatures)
- I currently boot 5 OSes:
   - Windows 7 x64, the original which the laptop came with, which
I use 99% of the time
   - Windows 8 I installed a few weeks ago for trying it out
   - Windows XP 32-bit and 64-bit for testing stuff
   - Linux (Ubuntu) x64 for when I need it
- I mess with partitions every few weeks
- I hack around with Windows internals quite a bit ;)

Guess which OS is the one that I've reinstalled a bazillion
times? Ubuntu.

And it _still_ doesn't boot automatically!
I tell it to install Grub, and it says OK.
It even _force_ it to reinstall Grub, and it says OK, I
reinstalled myself.
Then I reboot and it goes onto the screen and just... doesn't
boot.
I have to type in the boot sequence commands myself.
Why? Because a random, unrelated partition on the disk changed
and Ubuntu freaked out.

At least when Windows has the occasional boot problem which I
stupidly caused, it's _fixable_ and doesn't lie to you about
having fixed it!!





Re: [OT] Was: totally satisfied :D

2012-09-19 Thread Timon Gehr

On 09/19/2012 11:54 AM, Mehrdad wrote:

...

At least when Windows has the occasional boot problem which I stupidly
caused, it's _fixable_ and doesn't lie to you about having fixed it!!



The issue is that in one case you know how to fix it and in the other 
one you do not (and you care less about it because you prefer to think

Windows is superior as it is what you use '99% of the time'), not that
the problems are inherently (un)fixable.



Re: [OT] Was: totally satisfied :D

2012-09-19 Thread monarch_dodra

On Wednesday, 19 September 2012 at 09:19:13 UTC, Mehrdad wrote:
On Wednesday, 19 September 2012 at 08:53:33 UTC, monarch_dodra 
wrote:

On Wednesday, 19 September 2012 at 08:36:46 UTC, Mehrdad wrote:



What exactly do you guys _do_ with your computer that 
suddenly breaks the power supplies?! Maybe I'm just too young 
to know, but I've never seen a power supply break...


I once tried to do some GPU calculations. After several hours, 
the PSU failed, frying my components. The graphics card was 
literally ON FIRE (!). Nothing was salvageable.


Anyways, that is what *THAT* is how to kill a PSU, and *THAT* 
is what happens when they fail...


Dang that's... intense. o.o

Are laptop power supplies more durable or something?
None of my laptops (or anyone's laptop I know) have had 
problematic power supplies...


The difference is that a laptop's wattage is nowhere near the 
wattage of a desktop. This is even truer of modern computer, 
where desktops consume even more power, whereas laptops are 
consuming much less. I've never had a problem with a laptop PSU 
block itself... Not that I can say the same about the batteries.


I have about 2 laptops at home, whose batteries are left with, 
literally, 0 charge. Even a simple split second power cut, and 
they fill turn off :(


Re: [OT] Was: totally satisfied :D

2012-09-19 Thread Jonathan M Davis
On Wednesday, September 19, 2012 11:45:42 Paulo Pinto wrote:
 On Tuesday, 18 September 2012 at 05:26:33 UTC, H. S. Teoh wrote:
  On Tue, Sep 18, 2012 at 12:35:45AM -0400, Nick Sabalausky wrote:
  [...]
  Yet for whatever reason corporate types just love WebEx. Every
  meeting
  and cow-orker's son's birthday party is on WebEx. Ugh. Nowadays
  I just
  resort to looking over the cow-orker's shoulders when reviewing
  WebEx
  videos instead of defiling my PC with that crap.
 
 I am a corporate guy that loves WebEx.
 
 If you ever went through the amount of failed attempts in the
 corporate world starting with NetMeeting, Sametime and a couple
 of others I already forgot, in the last decade, you can only love
 how easy and stable it is to use WebEx conferences.

We've taken to using google hangout where I work. It's by no means perfect, 
but it's far easier to setup and deal with than WebEx. There may be worse 
things than WebEx, but I'd just as soon never have to deal with it again. To 
each their own though, I suppose.

- Jonathan M Davis


Re: [OT] Was: totally satisfied :D

2012-09-19 Thread Paulo Pinto
On Wednesday, 19 September 2012 at 10:53:40 UTC, Jonathan M Davis 
wrote:

On Wednesday, September 19, 2012 11:45:42 Paulo Pinto wrote:
On Tuesday, 18 September 2012 at 05:26:33 UTC, H. S. Teoh 
wrote:
 On Tue, Sep 18, 2012 at 12:35:45AM -0400, Nick Sabalausky 
 wrote:

 [...]
 Yet for whatever reason corporate types just love WebEx. 
 Every

 meeting
 and cow-orker's son's birthday party is on WebEx. Ugh. 
 Nowadays

 I just
 resort to looking over the cow-orker's shoulders when 
 reviewing

 WebEx
 videos instead of defiling my PC with that crap.

I am a corporate guy that loves WebEx.

If you ever went through the amount of failed attempts in the
corporate world starting with NetMeeting, Sametime and a couple
of others I already forgot, in the last decade, you can only 
love

how easy and stable it is to use WebEx conferences.


We've taken to using google hangout where I work. It's by no 
means perfect,
but it's far easier to setup and deal with than WebEx. There 
may be worse
things than WebEx, but I'd just as soon never have to deal with 
it again. To

each their own though, I suppose.

- Jonathan M Davis



I have yet not tried.

In most places where I worked, they only allow such type of tools 
when you can have some control over the servers where it is 
hosted.


You know the typical bureaucratic from multi-national companies 
in the corporate world. :(


--
Paulo



no-arg constructor for structs (again)

2012-09-19 Thread monarch_dodra
About two month ago, I started a thread about the possibility of 
having a no-arg constructor (not to be confused with a 
default constructor). The thread was: 
http://forum.dlang.org/thread/icjwbtlxsaekksyol...@forum.dlang.org


Back then, the language was still new to me (I have a better grip 
on it now), and I got extra information during the thread, which 
threw me off course. One of the better arguments throw at me from 
another thread (by Andrei), was that a no-arg constructor with 
interfere with the auto a = S(); syntax. I had no rebuke at the 
time.


I'd like to restart this conversation. First, by showing a no-arg 
constructor is needed, and then, by showing how we should be able 
to plug it into the language.



The biggest issue with not having a no-arg constructor can 
easilly be seen if you have ever worked with a Reference 
Semantic semantic struct: A struct that has a pointer to a 
payload. Basically, a class, but without the inherited Object 
polymorphism. These are hard to work with, both for the user and 
the implementer: They either use auto-intialization, making EVERY 
CALL start with ensure initialied (costly for ranges). Either 
that, or they need to be explicitly initialized. Or a mix of 
both, and a source of bugs and frustration in phobos.


Anyways, let's start with an example. For the sake of simplicity, 
I defined two structs to avoid the structs with a constructor 
can't be default newed bug;


struct S
{
int* p;
}
struct S2
{
int* p;
this(int){};
}

void main()
{
S a;
S* pa;
//auto b  = S;
auto pb = new S;
auto c  = S.init;
//auto pc = ???
auto d  = S();
auto pd = new S();
auto e  = S2(5);
auto pe = new S2(5);
}

In the above code, a-c/pa-pc are not initialized, as expected.
e/pe are initialized, as expected.

HOWEVER, and in contrast to classes, it is surprising that auto 
d = S(); and auto pd = new S(); does not create an initialized 
reference semantic struct. It is a bare minimum to give a user 
the ability to allocate  initialize in a single call...


This is a problem for both user *and* implementer: The user will 
have trouble initializing his struct, whereas the implementer 
will have trouble on his end properlly implementing his struct.


I was trying to develop one such struct. One solution was to use 
the opCall hack. Andrei suggested I migrate to a class. On one 
end, I think his suggestion is the better approach here. On the 
other hand I also think that if a developer is forced into 
migrating from a struct to a class because of implementation 
detail, or using a hack, it is a tell-tale sign of something 
stinky.



What is very interesting to note above (IMO), is that the 
language provides no less than THREE syntaxes to allocate a 
non-constructed S, two of which can be used with auto:

*Explicit typing (a)
*For stack: S.init (c),   parenthesis (d)
*for new:   without parenthesis (pb), with parenthesis (pd)

If we have such extra ways, then surely, one of the two can be 
used to call the no arg constructor, while the other is just an 
S.init memcopy, right? Here is my proposal:



struct S
{
int* p;
this(){};//no arg constructor
this(int){}; //arg constructor
}

void main()
{
S a;//Not initialized
S* pa;  //Not initialized

auto b1  = S;   //Not initialized (new semantic)
auto b2  = S.init;  //Not initialized (verbose semantic)
auto pb = new S;//Not initialized

auto e  = S2(5); //Initialized, calls this(int)
auto pe = new S2(5); //Initialized, calls this(int)

auto d  = S();   //Initialized, calls this() (migrating 
semantic)
auto pd = new S();   //Initialized, calls this() (migrating 
semantic)

}

As is shown in this example, the language semantics should be 
perfectly capable of handling this.


The issues we may encounter are more due to the ambiguities 
with the old semantics:
*Regarding the migrating semantic: This form is currently 
available in D. I propose it remains useable for now, but later 
becomes deprecated if the struct does not have a no-arg 
constructor.


*Regarding b1: I propose this semantic become legal. It is 
legal with auto pb = bew S;, so auto b = S; should also be 
accepted. The alternative would be to use S.init, but this is 
more verbose, and more explicit.



I realize this would be a big change to the *core* language, yet 
the no no-arg constructor has felt like a (breaking) limitation 
from day one, and it would be really nice if we could support it.


I realize *why* the default constructor had to go, but no-arg 
didn't have to go with it. I think it was an accident to let it 
go, and we should be trying to fix this.


Could I get some feedback so I could make a formal and thorough 
enhancement request?


Re: no-arg constructor for structs (again)

2012-09-19 Thread Maxim Fomin
On Wednesday, 19 September 2012 at 11:51:13 UTC, monarch_dodra 
wrote:
The biggest issue with not having a no-arg constructor can 
easilly be seen if you have ever worked with a Reference 
Semantic semantic struct: A struct that has a pointer to a 
payload. Basically, a class, but without the inherited Object 
polymorphism.


This means that you still have a class object. What is design 
behind inserting class into the structure for the sake of 
escaping from classes?


These are hard to work with, both for the user and the 
implementer: They either use auto-intialization, making EVERY 
CALL start with ensure initialied (costly for ranges). Either 
that, or they need to be explicitly initialized. Or a mix of 
both, and a source of bugs and frustration in phobos.


If you know initialize values at compile time, you can use them. 
If not, you can overload opCall to make custom initialization at 
runtime. Yes, it doesn't help to initialize structures which are 
created like S s; - but that how structures work: they are 
lightweight objects in some matter of speaking and if somebody 
wants to call some functions even in such cases, he probably 
needs to rethink the design.


HOWEVER, and in contrast to classes, it is surprising that 
auto d = S(); and auto pd = new S(); does not create an 
initialized reference semantic struct. It is a bare minimum to 
give a user the ability to allocate  initialize in a single 
call...




Indeed, they are initialized.

What is very interesting to note above (IMO), is that the 
language provides no less than THREE syntaxes to allocate a 
non-constructed S, two of which can be used with auto:

*Explicit typing (a)
*For stack: S.init (c),   parenthesis (d)
*for new:   without parenthesis (pb), with parenthesis (pd)



Which construction do you refer?




Re: no-arg constructor for structs (again)

2012-09-19 Thread Timon Gehr

I don't think making the use of optional parens affect semantics is an
idea worth following.


Re: no-arg constructor for structs (again)

2012-09-19 Thread deadalnix

Le 19/09/2012 15:24, Timon Gehr a écrit :

I don't think making the use of optional parens affect semantics is an
idea worth following.


I have to agree with that.

However, argument-less constructor is something required for struct. The 
problem is raised on a regular basis on this newsgroup, and some 
solution already have been proposed.


As discussed earlier in the reference thread, the compiler will have to 
track down initialization at some point. A struct with an argument-less 
constructor which isn't initialized must be an error. This will avoid 
the () semantic dichotomy while solving that problem.


Re: [OT] Was: totally satisfied :D

2012-09-19 Thread Steven Schveighoffer
On Wed, 19 Sep 2012 01:34:12 -0400, Nick Sabalausky  
seewebsitetocontac...@semitwist.com wrote:



On Tue, 18 Sep 2012 23:46:35 -0400
Steven Schveighoffer schvei...@yahoo.com wrote:

The keyboard click sound (which you can disable BTW,
settings-sounds-keyboard clicks) obeys the ringer volume.


Ehh? How unintuitive.


I cannot argue that Apple's audio volume isn't too simplistic for its own  
good.  AIUI, they have two volumes, one for the ringer, and one for  
playing audio, games, videos, etc.


I feel like the volume should be app-specific, and you should be able to  
allocate new volume categories.  Putting keyboard clicks under the ringer  
volume seems like a kludge.


However, it *does* do a good job of remembering volume settings for  
different audio outputs.  For example, it keeps track of your headphone  
ringer and audio volume separate from your speaker ringer and audio volume.



I think the main problem is that the volume rules are just far too
convoluted. They took something trivial and hacked it up beyond
recognition, and all in the supposed name of simplicity, go figure.


I think if they simply made the volume buttons control the ringer while  
locked and not playing music, it would solve the problem.


BTW, a cool feature I didn't know for a long time is if you double tap the  
home button, your audio controls appear on the lock screen (play/pause,  
next previous song, and audio volume).  But I think you have to unlock to  
access ringer volume.



Well, I guess you fidget more about ringer volume than I do.  I
usually like the ringer to be on 100%, because I frequently leave it
on my desk or somewhere other than my pocket.  When I want it to be
quiet, it goes into silent mode.



Well, I *would* fidget with it a lot, but frankly no matter what I do
it's always playing something either too loud or two quiet, and I've
got better things to do than mess with a screwy interface every time I
walk into a different environment. So really it just encourages me to
avoid even using it or even bringing the thing anywhere unless I really
need it. A stiff, recessed master volume dial that I could reach into my
pocket to adjust would pretty much solve the issue, but I guess that
just isn't high tech enough. Make it holographic so you can't even
feel it at all, *then* Apple would probably toss it in. :/


It's more moving parts to break.  I wouldn't like it.  Just my opinion.


 And that's *just* volume issues alone. God, I *HATE* the fucking
 thing. Any time I use it, I just want to hurl the damn thing into
 the nearest concrete wall as hard as I can. But I can't, because
 it's not even mine, it's a loaner, and I unfortunately need it for
 development/testing (or at least *will* need it for such once we pay
 Apple their Developer Ransom).

Hehe, yeah, that sucks.  But it's definitely worth it if you are
going to do *any* development, even if you aren't publishing.



If it were my own personal device, I'd just jailbreak it and be done
with it. (And then pay the ransom to publish, of course, because what
else can you do? Create your own device and compete with Apple under
capitalism? Nope, Google tried that idea of competition and look what
happened:
http://www.nytimes.com/2012/08/25/technology/jury-reaches-decision-in-apple-samsung-patent-trial.html?_r=1ref=technology  
)


If you want to develop for only jailbroken phones, you basically alienate  
most users of iPhone.  It's not a viable business model IMO.  Yes, it  
sucks to have to jump through apple's hoops, but having access to millions  
of users is very much worth it.



Just wait until you try to install your app on your phone for the
first time -- I have a feeling you will hate that too :)



I've done it on the Android already - could be better could be worse.
Marmalade's deployment tool is really dodgy when installing to a device,
but using Google's ADB directly is pretty reliable, and so is
installing from a URL via the device's browser.

I'm definitely not looking forward to dealing with iTunes though. I've
already used it for syncing the phone, and it's just a big mess. I
don't even bother trying to sync it anymore (PalmOS syncing OTOH, was
flawless). When the time comes, I'll probably grab copies of Phone to
PC and/or Phone Disk http://www.macroplant.com/downloads.php. The
demos of those seem to work much better than iTunes, plus they don't
treat me like a brain-damaged monkey.


Oh, when you develop apps, it's quite easy to install on the phone, you  
just click run from xcode, selecting your device, you don't ever have to  
start itunes (though itunes will auto-start every time you plug in the  
phone, but you can disable this in itunes, more annoying is that iPhoto  
*always* starts, I can't figure out how to stop that).  From then on, the  
app is installed.  The issue is setting up all the certificates via xcode  
and their web portal to get that to work (should only have to do this  
once).  I think the process has 

Re: Would like to see ref and out required for function calls

2012-09-19 Thread Kevin McTaggart
I'm amazed and very pleased at the discussion that this has 
generated.  I think it would be great if ref and out required for 
function calls in D3.  As others have mentioned, it would greatly 
assist with code readability.


On Friday, 7 September 2012 at 11:33:41 UTC, Kevin McTaggart 
wrote:
I've been looking at migrating a reasonably large ship motion 
library (tens of thousands of lines) from C# to D.  I've become 
quite enthusiastic about D, and most of my problems have been 
relatively minor (e.g., inconsistent bugs with 
std.container.Array, would like orange serialization to give me 
an error telling me I didn't register a class before calling 
serialize).  I suggest that the language require ref and out 
when calling functions, as C# requires.  This would make code 
easier to understand, and would also eliminate the problem I 
had when the wrong function from the following choices was 
mistakenly called:


parseLineInts(string text, int positionStart, out int j0, out 
int j1)


parseLineInts(string text, out int j0, out int j1, out int j2)

I note that the second function calls another function as 
follows:

int positionStart = 1;
parseLineInts(text, positionStart, j0, j1, j2);

I look forward to seeing feedback from D experts.  This is the 
only significant change that I could think of recommending for 
the language.





D operator overloading. Why that way?

2012-09-19 Thread Hauleth
Is there any reason to allow overload `op=`? IMHO it should be 
left illegal and should be interpreted always as `a = a op b`. It 
will be simpler and less confusing.


Also why `opEquals` is independent from `opCmp`? Once again 
`opEquals` should be removed and equality will be provided by 
`opCmp() == 0`.


Re: D operator overloading. Why that way?

2012-09-19 Thread bearophile

Hauleth:

Is there any reason to allow overload `op=`? IMHO it should be 
left illegal and should be interpreted always as `a = a op b`. 
It will be simpler and less confusing.


The increase of complexity and confusion is small.



Also why `opEquals` is independent from `opCmp`?


A Complex number defines equality but not comparisons:
https://raw.github.com/D-Programming-Language/phobos/master/std/complex.d

Sometimes computing equality is faster than comparisons, so
better have both.


Once again `opEquals` should be removed and equality will be 
provided by `opCmp() == 0`.


I'd like the opposite: more freedom to be able to define  but
not =.

Bye,
bearophile


Re: D operator overloading. Why that way?

2012-09-19 Thread monarch_dodra
Sorry for mixing your reply, but I want to answer your second 
question first.


On Wednesday, 19 September 2012 at 14:39:20 UTC, Hauleth wrote:
Also why `opEquals` is independent from `opCmp`? Once again 
`opEquals` should be removed and equality will be provided by 
`opCmp() == 0`.
Because some types can't be logically ordered. For example, 
coordinates. It makes no sense to give coordinates a logical 
order, but comparing them for equality does.


Is there any reason to allow overload `op=`? IMHO it should be 
left illegal and should be interpreted always as `a = a op b`. 
It will be simpler and less confusing.



Arguably, this default would be much too expensive.

If anything, it would work the other way around, where:
opBinary is replaced by
{auto temp = a; a += b; return a;}

BUT:
#1: This pre-supposes that opOpAssing returns something (not 
guaranteed), so it can't be made to default to this behavior.
#2: *SOME* object don't WANT to have a default opBinary, but they 
do have opOpAssign.
#3: Even then, maybe opBinary doesn't have the same semantics as 
the above implementation.
So it is not possible to make one default on the implementation 
of the other


So yeah, long story short, you can implement opOpAssing, and then 
implementation of opBinary should be trivial, but it remains the 
dev's job to choose if or if not he wants the op.


Why do not have `0o` prefix for octal numbers?

2012-09-19 Thread Hauleth
Some time ago I've asked on SO why most languages have `0` prefix 
for octal numbers. My opinion is the same as D designers that it 
cause a lot of bugs, but why octal numbers are avaible only by 
using `std.conv.octal`?


Re: Why do not have `0o` prefix for octal numbers?

2012-09-19 Thread David Nadlinger

On Wednesday, 19 September 2012 at 16:02:41 UTC, Hauleth wrote:
Some time ago I've asked on SO why most languages have `0` 
prefix for octal numbers. My opinion is the same as D designers 
that it cause a lot of bugs, but why octal numbers are avaible 
only by using `std.conv.octal`?


How often do you use octal numbers? The reason is simply to avoid 
language feature creep where a library solution is perfectly 
acceptable.


David


Re: Why do not have `0o` prefix for octal numbers?

2012-09-19 Thread monarch_dodra

On Wednesday, 19 September 2012 at 16:02:41 UTC, Hauleth wrote:
Some time ago I've asked on SO why most languages have `0` 
prefix for octal numbers. My opinion is the same as D designers 
that it cause a lot of bugs, but why octal numbers are avaible 
only by using `std.conv.octal`?


AFAIK: It is experimental. The $(D octal) facility is intended 
as an experimental facility to replace _octal literals starting 
with $(D '0'), which many find confusing.


The reason for deprecating 0 prefix was indeed because of bugs. 
Then it was noticed that a library solution was available, and as 
a rule of thumb, if the library can do it, it is moved from the 
language to the library.


You'll see a lot of threads talking about scope, which went the 
same way (which is now a library feature, not a language feature).


IMO, deprecating 0765 was a good move. Personally, I'd rather 
have had 0o765 instead of octal!765 (if only for 
highlighting). But I don't think it is a big deal.


Re: reference to 'self' inside a function

2012-09-19 Thread Rob T

I found this discussion,

Time for std.reflection
http://forum.dlang.org/thread/juf7sk$16rl$1...@digitalmars.com

so maybe if the effort gets underway (or perhaps it is already) 
then we'll see significant improvemnts with D's reflection.


--rt


Re: [OT] Was: totally satisfied :D

2012-09-19 Thread H. S. Teoh
On Wed, Sep 19, 2012 at 12:02:24PM +0200, Timon Gehr wrote:
 On 09/19/2012 11:54 AM, Mehrdad wrote:
 ...
 At least when Windows has the occasional boot problem which I
 stupidly caused, it's _fixable_ and doesn't lie to you about having
 fixed it!!
 
 
 The issue is that in one case you know how to fix it and in the other
 one you do not (and you care less about it because you prefer to think
 Windows is superior as it is what you use '99% of the time'), not that
 the problems are inherently (un)fixable.

Yeah, that's one of the things that irks me about Windows culture. It's
touted as being user-friendly and easy to use, etc., but actually it
requires just as much effort as learning to use Linux. People complain
about how Linux is hard to use or things break for no reason, but the
same thing happens with Windows -- you either do things the Windows way
(which requires that you learn what it is), or you quickly run into a
whole bunch of gratuitous incompatibilities and bugs that nobody cares
about because you aren't supposed to do things that way.  (I tried
switching the mouse to sloppy focus once... and never dared try it
again.)

As a programmer, though, I find Windows fundamentally annoying because
the hood is welded shut. Sometimes you *know* what's wrong but it
refuses to let you fix it, whereas on Linux you can look at the source
and figure out how to fix it -- heck, you can modify and recompile the
dang *kernel* to make it do what you want, should you be so inclined!
You can't even get close to that in Windows.

But then again, this is from the POV of a programmer. From the user's
POV, none of this matters, it's all just a question of familiarity and
preference. I personally find the bash shell far easier and more
comfortable to use than any kind of klunky GUI, but most people won't
because the prevalence of Windows has made GUIs more familiar to the
average user.


T

-- 
Turning your clock 15 minutes ahead won't cure lateness---you're just making 
time go faster!


Re: [OT] Was: totally satisfied :D

2012-09-19 Thread Sean Kelly
On Sep 19, 2012, at 12:40 AM, Jacob Carlborg d...@me.com wrote:

 On 2012-09-18 17:36, Sean Kelly wrote:
 On Sep 18, 2012, at 12:48 AM, Walter Bright newshou...@digitalmars.com 
 wrote:
 
 The most common failure I've had are the power supplies, they're still as 
 bad today as in the 80's.
 
 There are good power supplies, they just don't come in pre-built computers 
 because they're expensive.  I think the same could be said of products from 
 any era.
 
 What kind of computers are you guys using. I have never owned a pre-built 
 computer (except for laptops). I always buy my own components and assembles 
 the computer. Then I know what I get.

Same here.  If I were to buy a pre-assembled computer I'd probably go to 
someplace like cyberpowerpc.com, but even then you have to explicitly pick the 
good PSU because it isn't included by default.

Re: no-arg constructor for structs (again)

2012-09-19 Thread Dmitry Olshansky

On 19-Sep-12 15:52, monarch_dodra wrote:

I realize *why* the default constructor had to go, but no-arg didn't
have to go with it. I think it was an accident to let it go, and we
should be trying to fix this.


I do not feel that there is a lot of reference-like types that take 0 
arguments at construction. Any meaningful examples?


About checking for was initialized it is indeed painful, yet I believe 
even C++ is in the same boat (empty shared_ptr?). Also I do suspect that 
in the majority of cases these are just asserts since they aim to catch 
logic errors in code.


Having a way to ensure initialization statically would be nice. 
Currently only @disabling this() would achieve that but I suspect it's 
somewhat bogus ATM.


In fact having @disable this() undermines the argument for always have 
T.init strategy as generic code now have to deal with both cases.



Could I get some feedback so I could make a formal and thorough
enhancement request?


I'd rather see static opCall go and be replaced with no-arg constructor. 
But this alone doesn't bring much benefit (if any).



--
Dmitry Olshansky


Re: no-arg constructor for structs (again)

2012-09-19 Thread monarch_dodra
On Wednesday, 19 September 2012 at 18:08:15 UTC, Dmitry Olshansky 
wrote:

On 19-Sep-12 15:52, monarch_dodra wrote:
I realize *why* the default constructor had to go, but 
no-arg didn't
have to go with it. I think it was an accident to let it go, 
and we

should be trying to fix this.


I do not feel that there is a lot of reference-like types that 
take 0 arguments at construction. Any meaningful examples?


There are not a lot currently. RefCounted is. PRNG should 
arguably be migrated to them. Containers are kind of a hybrid 
(but this seems to be more of a implementation detail than by 
concept).


About checking for was initialized it is indeed painful, yet 
I believe even C++ is in the same boat (empty shared_ptr?). 
Also I do suspect that in the majority of cases these are just 
asserts since they aim to catch logic errors in code.


No, because C++ has default constructor. Regarding D's logic 
error, the problem is that the lack of no-arg underminds the 
definition of logic error: More below!


Having a way to ensure initialization statically would be nice. 
Currently only @disabling this() would achieve that but I 
suspect it's somewhat bogus ATM.


In fact having @disable this() undermines the argument for 
always have T.init strategy as generic code now have to deal 
with both cases.



Could I get some feedback so I could make a formal and thorough
enhancement request?


I'd rather see static opCall go and be replaced with no-arg 
constructor. But this alone doesn't bring much benefit (if any).


Here is a concrete example:

import std.random, std.typeconv;

void main()
{
alias RefCounted!(int, RefCountedAutoInitialize.no) RCI; 
//RefCountedInt

RCI a;  //NOT initialized
RCI b = RefCounted!int(15); //Initialized
RCI c = RefCounted!int();   //Initialized to int.init ... ?

int i;

i = a; //Logic error
i = b; //Ok
i = c; //Logic error?
}

The issue here is with c. Arguably, it was not initialized. 
Arguably, the intent was, as opposed to a, to initialize it to 
it's default value. At that point, is trying to read c a logic 
error? And if it is, can you really blame the user?


Same example with PRNG:

void main()
{
alias ... PRNG;
PRNG a;  //NOT Seeded
PRNG b = RefCounted!int(15); //Seeded
PRNG c = RefCounted!int();   //Seeded with default seed...?

a.front(); //Logic error
b.front(); //Ok
c.front(); //Logic error?
}

Ditto. Will the user really understand that b was seeded, yet c 
wasn't. This is even more ambiguous that PRNG *does* have a 
seed() method with a default seed


I know for a FACT that _I_ would have expected c to be default 
seeded. This makes the prng *VERY* ambiguous about whether or not 
it was seeded :/


Basically:
To seed with 15: PRNG b = RefCounted!int(15); //Seeded, yay
To default seed: PRNG c = RefCounted!int(); c.seed(); //  What...?

The opCall hack would fix the issue in the above example, but as 
stated in the previous thread, it is just that, a hack: You can't 
use it to construct inplace with emplace!(T, Args...), nor can 
you take it's address, nor can you use it to new it (should you 
ever want to do that.)


Re: [OT] Was: totally satisfied :D

2012-09-19 Thread Mehrdad

On Wednesday, 19 September 2012 at 17:29:17 UTC, H. S. Teoh wrote:

On Wed, Sep 19, 2012 at 12:02:24PM +0200, Timon Gehr wrote:
The issue is that in one case you know how to fix it and in 
the other one you do not (and you care less about it because 
you prefer to think Windows is superior as it is what you use 
'99% of the time'),  not that the problems are inherently 
(un)fixable.


Yeah, that's one of the things that irks me about Windows 
culture. It's touted as being user-friendly and easy to 
use, etc., but actually it requires just as much effort as 
learning to use Linux. People complain about how Linux is hard 
to use or things break for no reason, but the same thing 
happens with Windows -- you either do things the Windows way 
(which requires that you learn what it is), or you quickly run 
into a whole bunch of gratuitous incompatibilities and bugs 
that nobody cares about because you aren't supposed to do 
things that way.



Yeah, they're fixable by your definition all right.

It's just that when you ask people how, either no one you ask 
knows why, or they try to convince you that you're an idiot for 
even thinking about asking.


Relevant examples:

It's next-to-impossible to go on a forum and ask about fixing a 
boot-sector GRUB install without some fool coming along and 
diverting the entire thread into Why the hell isn't GRUB 
installed on your MBR?


When you have a (God forbid!) space character in your 
directory/file names and some program chokes on it?

Stop putting spaces in your file names.

When you ask how to make a passwordless account or how to obtain 
permanent root privileges?

Are you insane?!

When you ask if there is a defragmenter for Linux?
Some fool comes along and says Linux doesn't need 
defragmentation!


When you ask why the fonts are blurry?
It's just different, you're just picky. Get used to it.

When you ask why the touchpad is so darn hypersensitive?
Modify the source code.



Bottom line:

Yeah, there's _always_ way to fix your problems, if by fixing 
the problem you mean rewriting the OS.


It's pretty damn hard to convince Linux users that what you're 
trying to do is, in fact, not out of stupidity/ignorance.





(I tried switching the mouse to sloppy focus once... and never 
dared try it again.)


What's sloppy focus?


Re: [OT] Was: totally satisfied :D

2012-09-19 Thread Walter Bright

On 9/19/2012 1:37 AM, Mehrdad wrote:

What exactly do you guys _do_ with your computer that suddenly breaks the power
supplies?! Maybe I'm just too young to know, but I've never seen a power supply
break...


The symptoms I had are it just won't turn on. What I do? Take the old one out, 
got to the computer store or the computer recycler, and look for a matching one.


The recycler is great for older ones not made anymore, I can get a replacement 
for $10 or so.


Sometimes, I have to modify the case to get it to fit.


Re: [OT] Was: totally satisfied :D

2012-09-19 Thread Walter Bright

On 9/19/2012 2:47 AM, monarch_dodra wrote:

I have about 2 laptops at home, whose batteries are left with, literally, 0
charge. Even a simple split second power cut, and they fill turn off :(


Yeah, my ancient laptop's batteries are good for maybe a second on full charge.


Re: no-arg constructor for structs (again)

2012-09-19 Thread deadalnix

Le 19/09/2012 20:09, Dmitry Olshansky a écrit :

On 19-Sep-12 15:52, monarch_dodra wrote:

I realize *why* the default constructor had to go, but no-arg didn't
have to go with it. I think it was an accident to let it go, and we
should be trying to fix this.


I do not feel that there is a lot of reference-like types that take 0
arguments at construction. Any meaningful examples?



A use case I encountered more than once is interfacing with C++.

Another is to create an argument-less initializer that forward to 
another one with default arguments.


Re: Review of Andrei's std.benchmark

2012-09-19 Thread Jacob Carlborg

On 2012-09-19 09:58, Jonathan M Davis wrote:


util is one of the worst package names ever, because it means basically
nothing. Any function could go in there.


Well, the util package in Phobos is called std.


As for a time/date package, we already have std.datetime (which will hopefully
be split into the package std.datetime at some point, but we need something
like DIP 15 or 16 before we can do that), and we're moving the benchmarking
_out_ of there. If std.datetime were already a package, then maybe putting it
in there would make some sense, but benchmarking is arguably fundamentally
different from what the rest of std.datetime does. I really so no problem with
benchmarking being its own thing, and std.benchmark works just fine for that.


I just think we have too many top level modules.


--
/Jacob Carlborg


Re: Review of Andrei's std.benchmark

2012-09-19 Thread Jacob Carlborg

On 2012-09-19 11:38, Peter Alexander wrote:


The problem with slowest is that you end up with the occasional OS
hiccup or GC collection which throws the entire benchmark off. I see
your point, but unless you can prevent the OS from interrupting, the
time would be meaningless.


That's way the average is good to have as well.

--
/Jacob Carlborg


Re: Review of Andrei's std.benchmark

2012-09-19 Thread Graham Fawcett

On Wednesday, 19 September 2012 at 08:28:36 UTC, Manu wrote:

On 19 September 2012 01:02, Andrei Alexandrescu 
seewebsiteforem...@erdani.org wrote:


On 9/18/12 5:07 PM, Øivind wrote:


* For all tests, the best run is selected, but would it not be


reasonable in some cases to get the average value? Maybe 
excluding the
runs that are more than a couple std. deviations away from 
the mean

value..



After extensive tests with a variety of aggregate functions, I 
can say
firmly that taking the minimum time is by far the best when it 
comes to

assessing the speed of a function.



The fastest execution time is rarely useful to me, I'm almost 
always much

more interested in the slowest execution time.
In realtime software, the slowest time is often the only 
important factor,

everything must be designed to tolerate this possibility.
I can also imagine other situations where multiple workloads 
are competing

for time, the average time may be more useful in that case.



For comparison's sake, the Criterion benchmarking package for 
Haskell is worth a look:


http://www.serpentine.com/blog/2009/09/29/criterion-a-new-benchmarking-library-for-haskell/

Criterion accounts for clock-call costs, displays various central 
tendencies, reports outliers (and their significance --- whether 
the variance is significantly affected by the outliers), etc., 
etc. It's a very well conceived benchmarking system, and might 
well be worth stealing from.


Best,
Graham



Re: Review of Andrei's std.benchmark

2012-09-19 Thread Øivind

New question for you :)

To register benchmarks, the 'scheduleForBenchmarking' mixin 
inserts a shared static initializer into the module. If I have a 
module A and a module B, that both depend on eachother, than this 
will probably not work..? The runtime will detect the init cycle 
and fail with the following error:


Cycle detected between modules with ctors/dtors

Or am I wrong now?


Re: [OT] Was: totally satisfied :D

2012-09-19 Thread H. S. Teoh
On Wed, Sep 19, 2012 at 08:49:58PM +0200, Mehrdad wrote:
 On Wednesday, 19 September 2012 at 17:29:17 UTC, H. S. Teoh wrote:
 On Wed, Sep 19, 2012 at 12:02:24PM +0200, Timon Gehr wrote:
 The issue is that in one case you know how to fix it and in the
 other one you do not (and you care less about it because you prefer
 to think Windows is superior as it is what you use '99% of the
 time'),  not that the problems are inherently (un)fixable.
 
 Yeah, that's one of the things that irks me about Windows culture.
 It's touted as being user-friendly and easy to use, etc., but
 actually it requires just as much effort as learning to use Linux.
 People complain about how Linux is hard to use or things break for no
 reason, but the same thing happens with Windows -- you either do
 things the Windows way (which requires that you learn what it is), or
 you quickly run into a whole bunch of gratuitous incompatibilities
 and bugs that nobody cares about because you aren't supposed to do
 things that way.
 
 
 Yeah, they're fixable by your definition all right.
 
 It's just that when you ask people how, either no one you ask knows
 why, or they try to convince you that you're an idiot for even
 thinking about asking.

How do I use Windows without a GUI? What are you, an idiot?!


 Relevant examples:
 
 It's next-to-impossible to go on a forum and ask about fixing a
 boot-sector GRUB install without some fool coming along and
 diverting the entire thread into Why the hell isn't GRUB installed
 on your MBR?
 
 When you have a (God forbid!) space character in your directory/file
 names and some program chokes on it?
 Stop putting spaces in your file names.
 
 When you ask how to make a passwordless account or how to obtain
 permanent root privileges?
 Are you insane?!
 
 When you ask if there is a defragmenter for Linux?
 Some fool comes along and says Linux doesn't need
 defragmentation!
 
 When you ask why the fonts are blurry?
 It's just different, you're just picky. Get used to it.
 
 When you ask why the touchpad is so darn hypersensitive?
 Modify the source code.

Why can't I do things the Linux way on Windows? Because it's not
Linux, you fool.


 Bottom line:
 
 Yeah, there's _always_ way to fix your problems, if by fixing the
 problem you mean rewriting the OS.

We have the option of rewriting the OS, or any of its parts thereof. Yes
you may have to (gosh!) spend time learning how the thing works and how
to make it do what you want. But at least it's _possible_. You couldn't
rewrite Windows even if you knew how.

Besides, most of the problems you listed are a result of trying to do
things the Windows way on a system that *isn't* Windows. I bet I'll get
exactly the same responses if I started asking Windows forums how to
make Windows behave like Linux.

It all comes down to preference. I can't stand *any* kind of GUI, much
less the straitjacketed non-configurable (not without massive breakage)
kind of GUI that Windows offers. I do stuff on the shell that no GUI can
ever hope to achieve, and I like it that way. I prefer to communicate in
complete sentences rather than point-n-grunt.  But I don't pretend that
everybody else feels the same way.  With Linux I can twist it and warp
it until X11 behaves like a glorified console. Or like a 3D desktop, if
I cared for that sorta thing. Heck, I've even contemplated writing a
_4D_ window manager, for that matter.  With Windows, I have no choice. I
have to use a GUI, and a Windows-style GUI at that. Try to change the
way it behaves, and everything breaks. The Windows way is shoved down my
throat whether I like it or not. So guess which system I prefer to use?


 It's pretty damn hard to convince Linux users that what you're
 trying to do is, in fact, not out of stupidity/ignorance.

It's pretty damn hard to convince Windows zealots that anything but the
Windows way is not out of stupidity/ignorance.


 (I tried switching the mouse to sloppy focus once... and never dared
 try it again.)
 
 What's sloppy focus?

The window focus automatically changes to whatever window the mouse is
currently hovering over. Preferably WITHOUT automatically bringing said
window to the top. (Good luck making this work on Windows. And once you
actually manage to coax Windows to do it, have fun seeing the train
wreck that is your applications once you start using them this way.)


T

-- 
INTEL = Only half of intelligence.


Re: [OT] Was: totally satisfied :D

2012-09-19 Thread Nick Sabalausky
On Wed, 19 Sep 2012 10:11:50 -0400
Steven Schveighoffer schvei...@yahoo.com wrote:

 On Wed, 19 Sep 2012 01:34:12 -0400, Nick Sabalausky  
 seewebsitetocontac...@semitwist.com wrote:
 
  On Tue, 18 Sep 2012 23:46:35 -0400
  Steven Schveighoffer schvei...@yahoo.com wrote:
  The keyboard click sound (which you can disable BTW,
  settings-sounds-keyboard clicks) obeys the ringer volume.
 
  Ehh? How unintuitive.
 
 I cannot argue that Apple's audio volume isn't too simplistic for its
 own good.  AIUI, they have two volumes, one for the ringer, and one
 for playing audio, games, videos, etc.
 

There's also a separate one for alarms/alerts:
http://www.ipodnn.com/articles/12/01/13/user.unaware.that.alarm.going.off.was.his/

And Jobs-only-knows what else.

Apple actually thought that was a good idea.

Plus, my understanding is that one of Apple's explicit design principles
is that if an user-prompted action is something that's expected to
make a sound (by whatever *Apple* decides is expected, naturally),
then to hell with the user's volume setting, it should make a sound
anyway.

It's just unbelievably convoluted, over-engineered, and as far from
simple as could possibly be imagined. Basically, you have volume up
and volume down, but there's so much damn modality (something Apple
*loves*, but it almost universally bad for UI design) that they
work pretty much randomly.


  I think the main problem is that the volume rules are just far too
  convoluted. They took something trivial and hacked it up beyond
  recognition, and all in the supposed name of simplicity, go
  figure.
 
 I think if they simply made the volume buttons control the ringer
 while locked and not playing music, it would solve the problem.
 

I very much disagree. Then when you take it out to use it, everything
will *still* be surprisingly too loud (or quiet). Just not when a call
comes in...

 BTW, a cool feature I didn't know for a long time is if you double
 tap the home button, your audio controls appear on the lock screen
 (play/pause, next previous song, and audio volume).  But I think you
 have to unlock to access ringer volume.
 

That's good to know (I didn't know).

Unfortunately, it still only eliminates one, maybe two, swipes from an
already-complex procedure, that on any sensible device would have been
one step: Reach down into the pocket to adjust the volume.

 
 It's more moving parts to break.  I wouldn't like it.  Just my
 opinion.
 

How often has anyone ever had a volume POT go bad? I don't think I've
*ever* even had it happen. It's a solid, well-established technology.

 
  If it were my own personal device, I'd just jailbreak it and be done
  with it. (And then pay the ransom to publish, of course, because
  what else can you do? Create your own device and compete with Apple
  under capitalism? Nope, Google tried that idea of competition and
  look what happened:
  http://www.nytimes.com/2012/08/25/technology/jury-reaches-decision-in-apple-samsung-patent-trial.html?_r=1ref=technology

  )
 
 If you want to develop for only jailbroken phones, you basically
 alienate most users of iPhone.  It's not a viable business model
 IMO.  Yes, it sucks to have to jump through apple's hoops, but having
 access to millions of users is very much worth it.
 

No, no, no, I'd jailbreak it for *testing*. Like I said, I'd
begrudgingly still pay Apple's ransom for publishing, because what
other realistic option is there?

 
 Oh, when you develop apps, it's quite easy to install on the phone,
 you just click run from xcode, selecting your device, you don't
 ever have to start itunes (though itunes will auto-start every time
 you plug in the phone, but you can disable this in itunes, more
 annoying is that iPhoto *always* starts, I can't figure out how to
 stop that).  From then on, the app is installed.  The issue is
 setting up all the certificates via xcode and their web portal to get
 that to work (should only have to do this once).  I think the process
 has streamlined a bit, you used to have to create an app id for each
 app and select which devices were authorized to install it.  Now I
 think you get a wildcard app id, but you still have to register each
 device.
 

I don't use a mac, and I never will again. I spent about a year or two
with OSX last decade and I'll never go back for *any* reason. Liked it
at first, but the more I used it the more I hated it.

Fortunately, I'm developing with Marmalade, so I don't have to even
have a mac at all (not only that, I don't need to touch any Objective-C,
either). Now that I've actually had some sleep, ;), I remember now that
since Marmalade's deployment tool can code-sign (assuming you paid the
ransom for Apple's dev cert) and install direct to the device, so
you're right, I don't need iTunes after all.

Apple still requires a mac to submit to the app store, but luckily
my boss has a mac, and he's going to be doing the submitting anyway.
So I don't even have to touch one of those wretched 

Re: [OT] Was: totally satisfied :D

2012-09-19 Thread Nick Sabalausky
On Wed, 19 Sep 2012 20:49:58 +0200
Mehrdad wfunct...@hotmail.com wrote:

 On Wednesday, 19 September 2012 at 17:29:17 UTC, H. S. Teoh wrote:
  On Wed, Sep 19, 2012 at 12:02:24PM +0200, Timon Gehr wrote:
  The issue is that in one case you know how to fix it and in 
  the other one you do not (and you care less about it because 
  you prefer to think Windows is superior as it is what you use 
  '99% of the time'),  not that the problems are inherently 
  (un)fixable.
 
  Yeah, that's one of the things that irks me about Windows 
  culture. It's touted as being user-friendly and easy to 
  use, etc., but actually it requires just as much effort as 
  learning to use Linux. People complain about how Linux is hard 
  to use or things break for no reason, but the same thing 
  happens with Windows -- you either do things the Windows way 
  (which requires that you learn what it is), or you quickly run 
  into a whole bunch of gratuitous incompatibilities and bugs 
  that nobody cares about because you aren't supposed to do 
  things that way.
 
 
 Yeah, they're fixable by your definition all right.
 
 It's just that when you ask people how, either no one you ask 
 knows why, or they try to convince you that you're an idiot for 
 even thinking about asking.
 
 Relevant examples:
 
 It's next-to-impossible to go on a forum and ask about fixing a 
 boot-sector GRUB install without some fool coming along and 
 diverting the entire thread into Why the hell isn't GRUB 
 installed on your MBR?
 
 When you have a (God forbid!) space character in your 
 directory/file names and some program chokes on it?
 Stop putting spaces in your file names.
 
 When you ask how to make a passwordless account or how to obtain 
 permanent root privileges?
 Are you insane?!
 
 When you ask if there is a defragmenter for Linux?
 Some fool comes along and says Linux doesn't need 
 defragmentation!
 
 When you ask why the fonts are blurry?
 It's just different, you're just picky. Get used to it.
 
 When you ask why the touchpad is so darn hypersensitive?
 Modify the source code.
 

Yea, as much as there is I like about Linux (and I intend to switch to
it for my primary system), I've always considered the culture
surrounding it to be one of Linux's biggest liabilities.

You should have seen the shitstorm I had to put up with when inquiring
about a text-mode editor (so I could use it through SSH) that worked
more like Kate/Gedit and less like VI/Emacs/Nano. Of course, I did make
the mistake of *mentioning* the forbidden word: Windows. But still,
I mean, grow up people: it's a fucking OS, not a religion. (I even got
responses that outright ignored the text-mode part and suggested
various GUI editors.)

There are certainly *good* helpful mature users too, though. It'd be
unfair, and patently untrue, for me to say that *all* the Linux culture
is screwy like that. But there's too much.



Re: [OT] Was: totally satisfied :D

2012-09-19 Thread Mehrdad
On Wednesday, 19 September 2012 at 21:30:58 UTC, Nick Sabalausky 
wrote:

On Wed, 19 Sep 2012 20:49:58 +0200
Mehrdad wfunct...@hotmail.com wrote:

On Wednesday, 19 September 2012 at 17:29:17 UTC, H. S. Teoh 
wrote:

 On Wed, Sep 19, 2012 at 12:02:24PM +0200, Timon Gehr wrote:
 The issue is that in one case you know how to fix it and in 
 the other one you do not (and you care less about it 
 because you prefer to think Windows is superior as it is 
 what you use '99% of the time'),  not that the problems are 
 inherently (un)fixable.


 Yeah, that's one of the things that irks me about Windows 
 culture. It's touted as being user-friendly and easy to 
 use, etc., but actually it requires just as much effort as 
 learning to use Linux. People complain about how Linux is 
 hard to use or things break for no reason, but the same 
 thing happens with Windows -- you either do things the 
 Windows way (which requires that you learn what it is), or 
 you quickly run into a whole bunch of gratuitous 
 incompatibilities and bugs that nobody cares about because 
 you aren't supposed to do things that way.



Yeah, they're fixable by your definition all right.

It's just that when you ask people how, either no one you ask 
knows why, or they try to convince you that you're an idiot 
for even thinking about asking.


Relevant examples:

It's next-to-impossible to go on a forum and ask about fixing 
a boot-sector GRUB install without some fool coming along and 
diverting the entire thread into Why the hell isn't GRUB 
installed on your MBR?


When you have a (God forbid!) space character in your 
directory/file names and some program chokes on it?

Stop putting spaces in your file names.

When you ask how to make a passwordless account or how to 
obtain permanent root privileges?

Are you insane?!

When you ask if there is a defragmenter for Linux?
Some fool comes along and says Linux doesn't need 
defragmentation!


When you ask why the fonts are blurry?
It's just different, you're just picky. Get used to it.

When you ask why the touchpad is so darn hypersensitive?
Modify the source code.



Yea, as much as there is I like about Linux (and I intend to 
switch to it for my primary system), I've always considered the 
culture surrounding it to be one of Linux's biggest 
liabilities.


You should have seen the shitstorm I had to put up with when 
inquiring about a text-mode editor (so I could use it through 
SSH) that worked more like Kate/Gedit and less like 
VI/Emacs/Nano. Of course, I did make the mistake of 
*mentioning* the forbidden word: Windows. But still, I mean, 
grow up people: it's a fucking OS, not a religion.



+1


Re: [OT] Was: totally satisfied :D

2012-09-19 Thread Nick Sabalausky
On Wed, 19 Sep 2012 13:38:32 -0700
H. S. Teoh hst...@quickfur.ath.cx wrote:

 On Wed, Sep 19, 2012 at 08:49:58PM +0200, Mehrdad wrote:
  It's pretty damn hard to convince Linux users that what you're
  trying to do is, in fact, not out of stupidity/ignorance.
 
 It's pretty damn hard to convince Windows zealots that anything but
 the Windows way is not out of stupidity/ignorance.
 

Windows zealots are pretty rare though. Most Windows users accept that
it's just an OS, and that it has its problems and downsides. (It'd be
pretty hard to be a Windows user and *not* accept that Windows has
it's problems.)

 
  (I tried switching the mouse to sloppy focus once... and never
  dared try it again.)
  
  What's sloppy focus?
 
 The window focus automatically changes to whatever window the mouse is
 currently hovering over. Preferably WITHOUT automatically bringing
 said window to the top. (Good luck making this work on Windows. And
 once you actually manage to coax Windows to do it, have fun seeing
 the train wreck that is your applications once you start using them
 this way.)
 

Not exactly what you described, but similar:

http://ehiti.de/katmouse/

When I point at something and scroll, I expect my *target* to scroll,
not whatever the hell random thing I just happened to have clicked on
last.

I would *HATE* using windows if I didn't have that. Unfortunately,
it doesn't *always* work on Win7 (usually does, though). Works great on
XP.

But I agree, trying to do anything the non-Windows way on Windows
involves stupid PITA hacking, that doesn't always work right, *if* it's
even possible at all.

And it's not *just* doing something the non-Windows way, it's even
specific *versions* of windows: You can't even get things the WinXP way
on Win7. Sure, *some* things you can, *sometimes*, with obscure hacks
that don't even always work...

Man, I'm really gonna have to get around to upgrading my laptop from
Win7 back to XP sometime...Fuck this shit...



Re: no-arg constructor for structs (again)

2012-09-19 Thread Felix Hufnagel

isn't it even worse?

import std.stdio;
struct S
{
int i;
this(void* p = null){this.i = 5;}
}
void main()
{
//S l(); //gives a linker error
auto k = S();
writeln(k.i); //prints 0
}


Re: no-arg constructor for structs (again)

2012-09-19 Thread bearophile

monarch_dodra:


struct S
{
int* p;
}
struct S2
{
int* p;
this(int){};
}

void main()
{
S a;
S* pa;
//auto b  = S;
auto pb = new S;
auto c  = S.init;
//auto pc = ???
auto d  = S();
auto pd = new S();
auto e  = S2(5);
auto pe = new S2(5);
}


Tangential to your discussion: this needs to be allowed, because 
this removes one unnecessary special case/limit, avoiding the 
need to write some stupid boilerplate constructor code (I have 
written tons of those):


struct Foo {
int x, y;
}
void main() {
auto f = new Foo(5, 10);
}


The currently usable workaround is silly in a language like D:

struct Foo {
int x, y;
}
void main() {
auto f = new Foo;
*f = Foo(5, 10);
}

Bye,
bearophile


Re: [OT] Was: totally satisfied :D

2012-09-19 Thread H. S. Teoh
On Wed, Sep 19, 2012 at 05:51:31PM -0400, Nick Sabalausky wrote:
 On Wed, 19 Sep 2012 13:38:32 -0700
 H. S. Teoh hst...@quickfur.ath.cx wrote:
 
  On Wed, Sep 19, 2012 at 08:49:58PM +0200, Mehrdad wrote:
   It's pretty damn hard to convince Linux users that what you're
   trying to do is, in fact, not out of stupidity/ignorance.
  
  It's pretty damn hard to convince Windows zealots that anything but
  the Windows way is not out of stupidity/ignorance.
  
 
 Windows zealots are pretty rare though. Most Windows users accept that
 it's just an OS, and that it has its problems and downsides. (It'd be
 pretty hard to be a Windows user and *not* accept that Windows has
 it's problems.)

Haha, true!


[...]
   What's sloppy focus?
  
  The window focus automatically changes to whatever window the mouse
  is currently hovering over. Preferably WITHOUT automatically
  bringing said window to the top. (Good luck making this work on
  Windows. And once you actually manage to coax Windows to do it, have
  fun seeing the train wreck that is your applications once you start
  using them this way.)
  
 
 Not exactly what you described, but similar:
 
 http://ehiti.de/katmouse/
 
 When I point at something and scroll, I expect my *target* to scroll,
 not whatever the hell random thing I just happened to have clicked on
 last.

Yeah, another annoyance -- not with Windows specifically but with GUI
apps in general -- is the search function more often than not has an
invisible cursor from which the next search begins, which may be
COMPLETELY unrelated to what you're currently looking at (e.g. if you
scrolled the screen after the previous search). Or a new search always
starts from the top of the document/page/whatever regardless of where
you currently are. This is completely counterintuitive and stupid, and
makes it a royal pain esp. when you want to search starting from a
specific location.


 I would *HATE* using windows if I didn't have that. Unfortunately, it
 doesn't *always* work on Win7 (usually does, though). Works great on
 XP.
 
 But I agree, trying to do anything the non-Windows way on Windows
 involves stupid PITA hacking, that doesn't always work right, *if*
 it's even possible at all.

Yeah, after attempting to do sloppy focus on Windows, I crawled back
into a dark corner and wept silently as I conceded to doing things the
Windows way.


 And it's not *just* doing something the non-Windows way, it's even
 specific *versions* of windows: You can't even get things the WinXP
 way on Win7. Sure, *some* things you can, *sometimes*, with obscure
 hacks that don't even always work...

Yeah that's what I meant by hood welded shut. Although it's probably
more like hood booby-trapped shut, open at your own risk. :-P


 Man, I'm really gonna have to get around to upgrading my laptop from
 Win7 back to XP sometime...Fuck this shit...

Upgrading back to XP, lol!


T

-- 
Windows 95 was a joke, and Windows 98 was the punchline.


dlang.org went down momentarily?

2012-09-19 Thread H. S. Teoh
Did dlang.org just crash, then display an intermittent Yay it works
message, and then recover?

Just making sure it isn't the corporate firewall transparent proxy
that's acting up. Nowadays you can't always tell. :-P


T

-- 
If a person can't communicate, the very least he could do is to shut up.
-- Tom Lehrer, on people who bemoan their communication woes with their
loved ones.


Re: no-arg constructor for structs (again)

2012-09-19 Thread Jonathan M Davis
On Thursday, September 20, 2012 00:12:04 Felix Hufnagel wrote:
 isn't it even worse?
 
 import std.stdio;
 struct S
 {
 int i;
 this(void* p = null){this.i = 5;}
 }
 void main()
 {
 //S l(); //gives a linker error
 auto k = S();
 writeln(k.i); //prints 0
 }

Of course that generates a linker error. You just declared a function without 
a body.

- Jonathan M Davis


Re: classes structs

2012-09-19 Thread David Currie

On Tuesday, 18 September 2012 at 18:42:33 UTC, Timon Gehr wrote:

On 09/18/2012 07:07 AM, David Currie wrote:

[ALL CAPS]


It does not matter who is the loudest guy in the room. If you 
have a
point to make, just make it. (Stating the conclusion is not 
making a
point. Skipping forward and predicting polite refusal does not 
help.)


Most of the statements in the OP are inaccurate.

The best way to get in touch with the language is by reading 
the online
documentation and by experimenting with the compiler (prepare 
for some
bugs and unspecified corner cases). Reading the newsgroup helps 
too.


Usually it is best to double-check any claims about the language
expressed online, using the reference implementation.


Apologies for SHOUTING. I am unfamiliar with forum syntax and 
etiquette

I merely wished *stressing* some words.

What is OP and perhaps why are most statements inaccurate?
How does one get to the newsgroups. I only got here because 
Walter gave

me a link. I would gratefully welcome links.



Re: classes structs

2012-09-19 Thread Jesse Phillips
I just wanted to reiterate what Steven has said here. If you will 
learn D with a plan to change it to your desires, you will be 
disappointed. That is not to say give no feedback, or attempt no 
change. For one, you are coming in way to late for a good number 
of changes (including when we go to v3). Steven already covered 
the other.



You will find that a lot has already been discussed, and many 
here have had their share of desires turned down. But we are here 
because D is not just moving in the right direction, for many it 
is already has great use-cases.


So welcome, and hopefully you'll stay.



Re: classes structs

2012-09-19 Thread Nathan M. Swan
On Thursday, 20 September 2012 at 01:42:26 UTC, David Currie 
wrote:

On Tuesday, 18 September 2012 at 18:42:33 UTC, Timon Gehr wrote:

On 09/18/2012 07:07 AM, David Currie wrote:

[ALL CAPS]


It does not matter who is the loudest guy in the room. If you 
have a
point to make, just make it. (Stating the conclusion is not 
making a
point. Skipping forward and predicting polite refusal does not 
help.)


Most of the statements in the OP are inaccurate.

The best way to get in touch with the language is by reading 
the online
documentation and by experimenting with the compiler (prepare 
for some
bugs and unspecified corner cases). Reading the newsgroup 
helps too.


Usually it is best to double-check any claims about the 
language

expressed online, using the reference implementation.


Apologies for SHOUTING. I am unfamiliar with forum syntax and 
etiquette

I merely wished *stressing* some words.

What is OP and perhaps why are most statements inaccurate?
How does one get to the newsgroups. I only got here because 
Walter gave

me a link. I would gratefully welcome links.


OP = Original Post(er). They use a lot of abbreviations I don't 
know here: acronymfinder.com is your friend.


The only inaccurate statement I noticed was that class 
constructors are called (null is the default).


NMS


Re: [OT] Was: totally satisfied :D

2012-09-19 Thread Nick Sabalausky
On Wed, 19 Sep 2012 13:38:32 -0700
H. S. Teoh hst...@quickfur.ath.cx wrote:

 I prefer to communicate in
 complete sentences rather than point-n-grunt.

That's great :)

I like both CLI and GUI, depending on what I'm doing, but that's really
good.



Re: [OT] Was: totally satisfied :D

2012-09-19 Thread H. S. Teoh
On Thu, Sep 20, 2012 at 01:15:32AM -0400, Nick Sabalausky wrote:
 On Wed, 19 Sep 2012 13:38:32 -0700
 H. S. Teoh hst...@quickfur.ath.cx wrote:
 
  I prefer to communicate in complete sentences rather than
  point-n-grunt.
 
 That's great :)
 
 I like both CLI and GUI, depending on what I'm doing, but that's
 really good.

Well, I was being a bit over the top. :-P  GUIs do have their place,
such as when you're dealing with, say, 3D CADs or inherently graphical
tasks. But IMNSHO, GUIs are overused for tasks that they aren't
necessarily the best interface for. I cringe everytime I have to
construct an expression (boolean or otherwise) using a hilariously
convoluted GUI dialogue with all manner of drop boxes and other assorted
widgets---or worse, a deeply-nested set of menus that you have to wade
through for every single term in the expression---when I could've just
typed out the expression on the keyboard in less than 1/10 of the time
it takes to point-n-grunt it out.

Makes me feel like trying to write D code in KR C, or worse, PHP. :-P
(There goes my feeble attempt at bringing this back on topic.)


T

-- 
The day Microsoft makes something that doesn't suck is probably the day they 
start making vacuum cleaners... -- Slashdotter


Re: splitting numbers from a test file

2012-09-19 Thread Ali Çehreli

On 09/18/2012 09:56 PM, Craig Dillabaugh wrote:
 On Wednesday, 19 September 2012 at 04:03:44 UTC, Jonathan M Davis
 wrote:

 The documentation says that it returns a range.

 From:
 http://dlang.org/phobos/std_array.html#splitter

 The documentation (copied and pasted) for splitter reads:

 auto splitter(C)(C[] s);
 Splits a string by whitespace.

 Example:
 auto a =  a bcd ef gh ;
 assert(equal(splitter(a), [, a, bcd, ef, gh][]));

It is unfortunate that there is also the other splitter, which at least 
implies ranges: :-/


  http://dlang.org/phobos/std_algorithm.html#splitter

Yes, the documentation can be much better.

For example, the documentation for the second splitter above looks 
exacly like the other one, except that one says using an element as a 
separator. while the other one says using another range as a separator.


I think it is a ddoc limitation: Template constraints are not included 
in documentation yet.


Ali



Re: Can't install DMD 2.060 on OS X 10.6.8

2012-09-19 Thread Jacob Carlborg

On 2012-09-18 19:55, Elias Zamaria wrote:

How can I get permission to run sudo. I thought that sudo was the
command required to get permission to run other things. Is there a
catch-22? In any case, why am I having this problem, and why don't I see
any hint that anyone else is experiencing it?


I just tried the installer on 10.6.3 and I got the same error. I'm 
wondering if it has anything to do with that the installer is, most 
likely, created on a newer version of Mac OS X.


--
/Jacob Carlborg


Problem with environ variable (Mac OS X)

2012-09-19 Thread Chris
I tried to create a JNI library that - via C - accesses a D 
function. Calling D from C is not a problem, but when the whole 
stuff is wrapped into a JNI library, I get the following error 
message:


Error:
Undefined symbols:
  _environ, referenced from:
  _environ$non_lazy_ptr in libphobos2.a(process_61b_495.o)
 (maybe you meant: _environ$non_lazy_ptr)

I know it's a Mac specific thing and a fix exists (cf. 
https://www.gnu.org/software/gnulib/manual/html_node/environ.html), 
however it doesn't work in my case. process.d accesses environ in 
a similar way. I am not sure whether I get it all wrong, or 
whether it isn't possible at all to do the JNI-C-D thing.


I have also read somewhere that JNI could be created directly 
using D, I haven't found an example, though. Does anyone know 
anything about it? This would of course be more convenient.


move object from heap to stack

2012-09-19 Thread Namespace

Is that possible?
I can initialize an object with scope or, in feature, with 
scoped, directly on the stack but is it also possible to move an 
existing object from the heap to the stack?


Re: move object from heap to stack

2012-09-19 Thread Namespace

On Wednesday, 19 September 2012 at 13:32:42 UTC, Namespace wrote:

Is that possible?
I can initialize an object with scope or, in feature, with 
scoped, directly on the stack but is it also possible to move 
an existing object from the heap to the stack?


I tried this:
http://dpaste.dzfl.pl/2955ff41
But as you can see in line 25/26, after I destroyed the heap 
object, the stack object seems to be corrupted.


Re: move object from heap to stack

2012-09-19 Thread Simen Kjaeraas
On Wed, 19 Sep 2012 15:45:21 +0200, Namespace rswhi...@googlemail.com  
wrote:



On Wednesday, 19 September 2012 at 13:32:42 UTC, Namespace wrote:

Is that possible?
I can initialize an object with scope or, in feature, with scoped,  
directly on the stack but is it also possible to move an existing  
object from the heap to the stack?


I tried this:
http://dpaste.dzfl.pl/2955ff41
But as you can see in line 25/26, after I destroyed the heap object, the  
stack object seems to be corrupted.


The problem here is that A.sizeof returns the size of the reference, not
the instance. Instead you should use __traits(classInstanceSize, A).

Also, do have a look at the internals of std.typecons.scoped, it likely
contains some good ideas.

--
Simen


Re: move object from heap to stack

2012-09-19 Thread Namespace

Thanks, I will use __traits(classInstanceSize, A);
But it does not work either.


D object model

2012-09-19 Thread Andrej Mitrovic
One of the problems with wrapping C++ is wrapping multiple-inheritance
classes. You could simulate these with interfaces, e.g.:

interface IRoot { }
interface IBase1 : IRoot { }
interface IBase2 : IRoot { }
class Base1 : IBase1 { void* cppObj; }
class Base2 : IBase2 { void* cppObj; }
class MIClass : IBase1, IBase2 { void* cppObj; }

Now to define a function that can be called with an object instance of
any class in the tree, you can use:
void foo(IRoot obj) { }

Typically every wrapper D class will have an associated pointer to a
C++ object as a void* field (hence that cppObj field up there). This
is to allow invoking C++ library methods on the underlying C++ object,
e.g.:

class Base1 : IBase1
{
void* cppObj;
void invokeMethod(IBase1 objArg)
{
extern_c_invokeMethod(this.cppObj, objArg.getCppObj());
}
}

The above allows invokeMethod to be called with any IBase1-inherited
class (IBase1 or MIClass). Note that changing IBase1 objArg to
Base1 objArg would mean the method can't be invoked with an MIClass
instance (but it would allow direct access to the .cppObj field).

The problem here is performance. Interfaces don't hold state, so
classes which inherit from interfaces have to implement a special
getCppObj() method which returns the cppObj field. That means
retrieving cppObj is a virtual call instead of a simple field lookup.

My question is: I I have the definition of *all* the D classes in the
library (+ I control how they're inherited since they're
autogenerated) is it possible to cheat and retrieve the .cppObj field
from an interface parameter without going through a virtual call?

Obviously this would be implementation-dependent, but remember that
all the wrapper D classes would only hold 1 field (cppObj), so I was
hoping using a hack would be somewhat reliable. Here's one way to
cheat:

http://dpaste.dzfl.pl/fd794170

That trick would only be used for the wrapper classes. What I don't
know is, *under what circumstances does it break*? If I knew for sure
that a certain object layout always guarantees this trick to work,
then I could configure my codegenerator to always generate wrapper
code that would make this trick reliable. It could be a good
performance win.


Re: splitting numbers from a test file

2012-09-19 Thread Craig Dillabaugh

On Wednesday, 19 September 2012 at 06:09:38 UTC, Ali Çehreli
wrote:

On 09/18/2012 09:56 PM, Craig Dillabaugh wrote:
 On Wednesday, 19 September 2012 at 04:03:44 UTC, Jonathan M
Davis
 wrote:

 The documentation says that it returns a range.

 From:
 http://dlang.org/phobos/std_array.html#splitter

 The documentation (copied and pasted) for splitter reads:

 auto splitter(C)(C[] s);
 Splits a string by whitespace.

 Example:
 auto a =  a bcd ef gh ;
 assert(equal(splitter(a), [, a, bcd, ef, gh][]));

It is unfortunate that there is also the other splitter, which 
at least implies ranges: :-/


  http://dlang.org/phobos/std_algorithm.html#splitter

Yes, the documentation can be much better.

For example, the documentation for the second splitter above 
looks exacly like the other one, except that one says using an 
element as a separator. while the other one says using 
another range as a separator.


I think it is a ddoc limitation: Template constraints are not 
included in documentation yet.


Ali


Ali and Johnathan:
Thank you for your help. Also Ali thanks for your book, motivated
by this little problem I've started reading your Chapter on
ranges.  It is very helpful.

Cheers,
Craig



Re: Problem with environ variable (Mac OS X)

2012-09-19 Thread Jacob Carlborg

On 2012-09-19 12:35, Chris wrote:

I tried to create a JNI library that - via C - accesses a D function.
Calling D from C is not a problem, but when the whole stuff is wrapped
into a JNI library, I get the following error message:

Error:
Undefined symbols:
   _environ, referenced from:
   _environ$non_lazy_ptr in libphobos2.a(process_61b_495.o)
  (maybe you meant: _environ$non_lazy_ptr)

I know it's a Mac specific thing and a fix exists (cf.
https://www.gnu.org/software/gnulib/manual/html_node/environ.html),
however it doesn't work in my case. process.d accesses environ in a
similar way. I am not sure whether I get it all wrong, or whether it
isn't possible at all to do the JNI-C-D thing.

I have also read somewhere that JNI could be created directly using D, I
haven't found an example, though. Does anyone know anything about it?
This would of course be more convenient.


A fix for that was applied last year. Which version of the compiler are 
you using?


https://github.com/D-Programming-Language/phobos/blob/master/std/process.d#L60

--
/Jacob Carlborg


Re: splitting numbers from a test file

2012-09-19 Thread Ali Çehreli

On 09/19/2012 10:22 AM, Craig Dillabaugh wrote:

 Thank you for your help. Also Ali thanks for your book, motivated
 by this little problem I've started reading your Chapter on
 ranges. It is very helpful.

Thank you. :)

Obviously, I am aware of its shortcomings. Especially, the difference 
between a container and a range must be stressed. The chapter touches on 
that idea at different places but I don't think it is spelled out 
sufficiently.


To be improved some time in the future... :)

Ali



Writing/Reading Compressed Binary Files

2012-09-19 Thread TJB

D Helpers,

I have a ton of huge financial data to process and analyze 
statistically.  I am looking for the best way to store/retrieve 
the data for processing. I am wondering how to write the data to 
a compressed binary file and then later read from that same file 
for processing.


I can read/write the binary data just fine, but how to do it with 
compression?


I appreciate your help and suggestions.

TJB


Re: Writing/Reading Compressed Binary Files

2012-09-19 Thread Justin Whear
On Wed, 19 Sep 2012 19:48:49 +0200, TJB wrote:

 D Helpers,
 
 I have a ton of huge financial data to process and analyze
 statistically.  I am looking for the best way to store/retrieve the data
 for processing. I am wondering how to write the data to a compressed
 binary file and then later read from that same file for processing.
 
 I can read/write the binary data just fine, but how to do it with
 compression?
 
 I appreciate your help and suggestions.
 
 TJB

Take a look at std.zip and std.zlib.  Personally, I use LZO which is 
incredibly fast and pretty easy to wrap (it's a C lib).  Using LZO takes 
a little more work (you need split the data into chunks, manually store 
compressed/uncompressed lengths, etc.), so the easy route is to use 
std.zlib.


Re: move object from heap to stack

2012-09-19 Thread Namespace
On Wednesday, 19 September 2012 at 17:08:28 UTC, monarch_dodra 
wrote:
On Wednesday, 19 September 2012 at 14:16:31 UTC, Namespace 
wrote:

Thanks, I will use __traits(classInstanceSize, A);
But it does not work either.


This is because classes are already pointers. when you write 
a, you are getting the address of pointer itself. So when 
you memcopy, don't use a, but use cast(void*)a.


What you were currently doing was memcopying the pointer to a 
into your chunk. From there, since you were casting to A*, 
everything worked and was legal, but you still only had 1 class 
intance. Your destroying that instance made your ap crash.


this works:
http://dpaste.dzfl.pl/8ba1f457


I forget this. Thank you!
IMO something like this should exist in phobos. A more flexible 
version of scoped also.


Running unittests in a D library

2012-09-19 Thread Chris Molozian

Hey all,

I'm sure that this is a rather daft question but I've tried to 
search the d.learn mailing list and must have missed a question 
about it.


I've read the unit testing documentation on dlang.org and I know 
that `unittest { /* some code */ }` blocks are compiled into the 
executable and executed after static initialization and before 
the main() function is called. This makes sense in an application 
but how does this apply to a library?


For example, writing a D library using DMD's `-lib` compiler 
flag, how do I run the unit tests in the generated library?


Cheers,

Chris


Re: Running unittests in a D library

2012-09-19 Thread Chris Molozian
Actually after more digging it seems that unit testing libraries 
in D doesn't work.


It seems pretty bad that in 2012 with unit testing a huge part of 
the software development process and D describing itself as a 
language with unit testing built in, this bug report / feature 
request hasn't been addressed:


http://d.puremagic.com/issues/show_bug.cgi?id=4669

Is there any update on the status of this enhancement? Is there a 
recommended workaround to unit test a D library?


Cheers,

Chris


On Wednesday, 19 September 2012 at 18:49:12 UTC, Chris Molozian 
wrote:

Hey all,

I'm sure that this is a rather daft question but I've tried to 
search the d.learn mailing list and must have missed a question 
about it.


I've read the unit testing documentation on dlang.org and I 
know that `unittest { /* some code */ }` blocks are compiled 
into the executable and executed after static initialization 
and before the main() function is called. This makes sense in 
an application but how does this apply to a library?


For example, writing a D library using DMD's `-lib` compiler 
flag, how do I run the unit tests in the generated library?


Cheers,

Chris





Re: move object from heap to stack

2012-09-19 Thread Namespace

Result:
http://dpaste.dzfl.pl/24988d8f


Re: Running unittests in a D library

2012-09-19 Thread Jonathan M Davis
On Wednesday, September 19, 2012 20:50:08 Chris Molozian wrote:
 Hey all,
 
 I'm sure that this is a rather daft question but I've tried to
 search the d.learn mailing list and must have missed a question
 about it.
 
 I've read the unit testing documentation on dlang.org and I know
 that `unittest { /* some code */ }` blocks are compiled into the
 executable and executed after static initialization and before
 the main() function is called. This makes sense in an application
 but how does this apply to a library?
 
 For example, writing a D library using DMD's `-lib` compiler
 flag, how do I run the unit tests in the generated library?

You don't build it as a library when your unit testing it. You create an empty 
main, compile it all as an executable, and run it. I believe that rdmd --main 
will do this for you (rdmd comes with dmd), but I haven't really used rdmd, so 
I'm not 100% certain.

- Jonathan M Davis


access enclosing type from shared static this()

2012-09-19 Thread Øivind
I want to access the type of the enclosing struct in in a shared 
static initializer.. How do I do that? The following code will 
not compile:


mixin template MsgMixin(T ...) {
  static string getName(this M)() {
return M.stringof;
  }
  shared static this() {
import std.stdio;
writeln(register  ~ getName());
  }
}

struct MsgTestMsg {
  mixin MsgMixin!();
}

I get the following error messages:

src/main.d(40): Error: template 
main.MsgTestMsg.MsgMixin!().getName does not match any function 
template declaration
src/main.d(40): Error: template 
main.MsgTestMsg.MsgMixin!().getName(this M) cannot deduce 
template function from argument types !()()


If not possible, just getting the name of the enclosing struct 
would help a lot!


-Øivind



Re: Running unittests in a D library

2012-09-19 Thread Jacob Carlborg

On 2012-09-19 21:34, Jonathan M Davis wrote:


You don't build it as a library when your unit testing it. You create an empty
main, compile it all as an executable, and run it. I believe that rdmd --main
will do this for you (rdmd comes with dmd), but I haven't really used rdmd, so
I'm not 100% certain.


The problem in that bug report is you can't first compile your library 
as a library and then compile an executable using the library. According 
to the bug report it won't run the unittest blocks from the library.


--
/Jacob Carlborg


Re: access enclosing type from shared static this()

2012-09-19 Thread David

If not possible, just getting the name of the enclosing struct would
help a lot!

-Øivind


typeof(this).stringof

This should do it




Re: access enclosing type from shared static this()

2012-09-19 Thread Timon Gehr

On 09/19/2012 09:37 PM, Øivind wrote:

I want to access the type of the enclosing struct in in a shared static
initializer.. How do I do that? The following code will not compile:

mixin template MsgMixin(T ...) {
   static string getName(this M)() {
 return M.stringof;
   }
   shared static this() {
 import std.stdio;
 writeln(register  ~ getName());
   }
}

struct MsgTestMsg {
   mixin MsgMixin!();
}

I get the following error messages:

src/main.d(40): Error: template main.MsgTestMsg.MsgMixin!().getName does
not match any function template declaration
src/main.d(40): Error: template main.MsgTestMsg.MsgMixin!().getName(this
M) cannot deduce template function from argument types !()()

If not possible, just getting the name of the enclosing struct would
help a lot!

-Øivind



use typeof(this), eg:

mixin template MsgMixin(T ...) {
shared static this() {
import std.stdio;
writeln(register  ~ typeof(this).stringof);
}
}



Re: move object from heap to stack

2012-09-19 Thread monarch_dodra

On Wednesday, 19 September 2012 at 19:24:34 UTC, Namespace wrote:

Result:
http://dpaste.dzfl.pl/24988d8f


I like it, but how can something placed on the stack be reference 
counted? The chunk is also placed on the stack, so it doesn't 
really make sense to me: When the object goes out of scope, the 
chunk goes, regardless of ref count. I think you should ditch the 
whole ref count thing.


You'll also have to be aware of the dangers of putting a class 
instance on the stack:


main()
{
A a;
{
stacked_obj!A so;
so.gen;
a = so.get;
}
a.print(); //-- undefined, with or without reference count
}

IE: Big red comment you should NEVER extract an instance from the 
stack.


Re: access enclosing type from shared static this()

2012-09-19 Thread Øivind
Thanks a lot both of you. The code below worked. I did not expect 
'this' to be available in the static function, but of course the 
type of 'this' is available.



mixin template MsgMixin(T ...) {
shared static this() {
import std.stdio;
writeln(register  ~ typeof(this).stringof);
}
}




std.json: SkipWhitespace = false ?

2012-09-19 Thread Peter Sommerfeld

Hi Everyone!

I'm new to :D and have a small problem with std.json.

If I use parseJSON() or toJSON() all whitespaces are
removed. I would like it to have them preserved for
better readability for users.

In std.json.d various functions contain SkipWhitespace
as parameter but that is not propagated to the toplevel
functions.

Are there any strong reasons for this behavior or can
I rebuild it with SkipWhitespace = true? Or is there
another way to work around it.

Peter


static init cycle detection problem

2012-09-19 Thread Øivind
I am struggeling to get around the cycle detection kicking in 
when I have static init in modules that depend on eachother.


I have seen some threads on 'fixes' for this, e.g. adding a 
@standalone property to the module or similar. Has there been any 
progress on this?


If not would it be possible in e.g. main() to get a list of all 
compiled-in modules, and then iterate over them and call an init 
function where it exists? As long as there is a way to list the 
name of the modules at compile-time, this should be pretty easy..?


-Øivind




Re: undefined reference to `_D6deimos6python6Python12__ModuleInfoZ'

2012-09-19 Thread Jesse Phillips
On Tuesday, 18 September 2012 at 04:56:27 UTC, Ellery Newcomer 
wrote:


In a templated function in my header file, I make a call to 
enforce. When the function is not called [instantiated], all is 
well. When the function is called, it generates yon undefined 
reference to __ModuleInfoZ.


I guess this is because D needs a pointer to the module in 
order to look up enforce?


What does the call to enforce look like? The error isn't from the 
compiler so you are pulling in a symbol which isn't in your 
object files.


Re: std.json: SkipWhitespace = false ?

2012-09-19 Thread Jesse Phillips
On Wednesday, 19 September 2012 at 20:06:31 UTC, Peter Sommerfeld 
wrote:

Hi Everyone!

I'm new to :D and have a small problem with std.json.

If I use parseJSON() or toJSON() all whitespaces are
removed. I would like it to have them preserved for
better readability for users.

In std.json.d various functions contain SkipWhitespace
as parameter but that is not propagated to the toplevel
functions.

Are there any strong reasons for this behavior or can
I rebuild it with SkipWhitespace = true? Or is there
another way to work around it.

Peter


Save a copy of it locally and make the changes needed. There is a 
new version of std.json which is waiting on changes to 
std.variant and review... Anyway not much will happen with the 
current version so this will be good anyway.


Re: static init cycle detection problem

2012-09-19 Thread Simen Kjaeraas

On Wed, 19 Sep 2012 22:25:46 +0200, Øivind oivind@gmail.com wrote:

I am struggeling to get around the cycle detection kicking in when I  
have static init in modules that depend on eachother.


I have seen some threads on 'fixes' for this, e.g. adding a @standalone  
property to the module or similar. Has there been any progress on this?


If not would it be possible in e.g. main() to get a list of all  
compiled-in modules, and then iterate over them and call an init  
function where it exists? As long as there is a way to list the name of  
the modules at compile-time, this should be pretty easy..?


There's no way to get that list at compile-time, because object files may
be added at link-time. However, D has a ModuleInfo object, which contains
information on all modules in the program:

import std.stdio;
void main( ) {
foreach( m; ModuleInfo ) {
writeln( m.name );
}
}

For details on how this object works, have a look-see at
src/druntime/src/object_.d in your DMD installation folder.

I'm not sure what you're asking for is possible even given this object,
but it's probably the closest you'll (easily) get.

--
Simen


Re: undefined reference to `_D6deimos6python6Python12__ModuleInfoZ'

2012-09-19 Thread Ellery Newcomer

On 09/19/2012 01:30 PM, Jesse Phillips wrote:

On Tuesday, 18 September 2012 at 04:56:27 UTC, Ellery Newcomer wrote:


In a templated function in my header file, I make a call to enforce.
When the function is not called [instantiated], all is well. When the
function is called, it generates yon undefined reference to
__ModuleInfoZ.

I guess this is because D needs a pointer to the module in order to
look up enforce?


What does the call to enforce look like? The error isn't from the
compiler so you are pulling in a symbol which isn't in your object files.


here is an older file, as I haven't committed recently, but it shows the 
identical call:


https://bitbucket.org/ariovistus/pyd/src/364451b5d732/infrastructure/python/python.d#cl-653

making a call to enforce elsewhere doesn't fix the linker problem.


Re: std.json: SkipWhitespace = false ?

2012-09-19 Thread Peter Sommerfeld

Jesse Phillips wrote:

Peter Sommerfeld wrote:

Hi Everyone!

I'm new to :D and have a small problem with std.json.

If I use parseJSON() or toJSON() all whitespaces are
removed. I would like it to have them preserved for
better readability for users.

In std.json.d various functions contain SkipWhitespace
as parameter but that is not propagated to the toplevel
functions.

Are there any strong reasons for this behavior or can
I rebuild it with SkipWhitespace = true? Or is there
another way to work around it.

Peter


Save a copy of it locally and make the changes needed. There is a new  
version of std.json which is waiting on changes to std.variant and  
review... Anyway not much will happen with the current version so this  
will be good anyway.


Thanks Jesse, will do so!

Peter


  1   2   >