Re: Account on ARM/Debian

2012-10-16 Thread Alix Pexton

On 16/10/2012 02:06, Walter Bright wrote:

On 10/15/2012 5:39 PM, Brad Roberts wrote:

I wouldn't go out and buy one just for this.  The raspberry's are pretty
underpowered anyway.


They're so cheap, it's no big deal even if they're a total loss.



I have a RasPi already!

I might be able to get it connected up to my brother's static ip and 
have it sitting headless on top of the router, but I'll have to ask him 
first of course!


I'll let you know what he says, and start asking questions about how to 
set it up if he agrees ^^


A...


Re: Account on ARM/Debian

2012-10-16 Thread Alix Pexton

On 16/10/2012 10:22, Alix Pexton wrote:

On 16/10/2012 02:06, Walter Bright wrote:

On 10/15/2012 5:39 PM, Brad Roberts wrote:

I wouldn't go out and buy one just for this.  The raspberry's are pretty
underpowered anyway.


They're so cheap, it's no big deal even if they're a total loss.



I have a RasPi already!

I might be able to get it connected up to my brother's static ip and
have it sitting headless on top of the router, but I'll have to ask him
first of course!

I'll let you know what he says, and start asking questions about how to
set it up if he agrees ^^

A...


He says OK!

Is just SSH enough for you to work with or do you need any other ports open?

The regular port numbers for some things are not available though (80, 
443, 20, 21) but I'm sure that won't be a problem ^^


A...


Re: Account on ARM/Debian

2012-10-16 Thread Alix Pexton

On 16/10/2012 11:48, Iain Buclaw wrote:

On 16 October 2012 10:42, Alix Pexton  wrote:

On 16/10/2012 10:22, Alix Pexton wrote:


On 16/10/2012 02:06, Walter Bright wrote:


On 10/15/2012 5:39 PM, Brad Roberts wrote:


I wouldn't go out and buy one just for this.  The raspberry's are pretty
underpowered anyway.



They're so cheap, it's no big deal even if they're a total loss.



I have a RasPi already!

I might be able to get it connected up to my brother's static ip and
have it sitting headless on top of the router, but I'll have to ask him
first of course!

I'll let you know what he says, and start asking questions about how to
set it up if he agrees ^^

A...



He says OK!

Is just SSH enough for you to work with or do you need any other ports open?

The regular port numbers for some things are not available though (80, 443,
20, 21) but I'm sure that won't be a problem ^^

A...


SSH will be fine, thanks. :-)

Do you need a static IP set on the firewall to allow connections in?




I don't think so, will have to throw that one over to my brother to be 
sure ^^


My network-admin-fu is somewhat lacking ><

A...


Re: Account on ARM/Debian

2012-10-18 Thread Alix Pexton

On 16/10/2012 12:11, Alix Pexton wrote:

On 16/10/2012 11:48, Iain Buclaw wrote:

Do you need a static IP set on the firewall to allow connections in?



I don't think so, will have to throw that one over to my brother to be
sure ^^



Make that a maybe!

After being on-line for less than 24 hours, the poor RasPi was being 
penetration tested from IPs as far apart as Korea and Sussex!


I'm still willing to let my RasPi be used for this fine cause, but my 
Brother wants to investigate why his IP has gotten interest from foreign 
powers, and reconfigure the firewall before it gets reconnected.


Aside from Ian, are there any other GDC/ARM developers (who might want 
access)? I'm considering making individual accounts for each user rather 
than just giving out the password to the "pi" user.


A...


Re: Account on ARM/Debian

2012-10-18 Thread Alix Pexton

On 18/10/2012 14:32, Joseph Rushton Wakeling wrote:

On 10/18/2012 03:18 PM, Alix Pexton wrote:

I'm considering making individual accounts for each user rather than
just giving
out the password to the "pi" user.


TBH that "pi" account seems like a massive security vulnerability for
any RasPi that is open to remote login.  Yes, you can change the
password, but I'd be inclined to remove it and set up an administrator
account with a completely different name ...


Any advice/instruction (the clearer the better) on how to setup my RasPi 
so that it is more secure are very welcome ^^


I'm also looking for a smallish USB hard drive to attach as a swap-drive 
so that there is scope to compile GDC, everything I have seen so far 
costs more than the RasPi did and does not fit my definition of "smallish".


A...


Re: [OT] Ubuntu 12.10 guest in VirtualBox completely broken

2012-11-10 Thread Alix Pexton

On 10/11/2012 10:14, Jacob Carlborg wrote:

I just wanted you all to know that running Ubuntu 12.10 as a guest in
VirtualBox is completely broken. I update by guest system from 12.04 to
12.10 and it's so slow it's not usable. This is a known issue:

https://www.virtualbox.org/ticket/11107

That issue contains a pre-release of VirtualBox, I tried that on Mac OS
X and it broken the Ubuntu guest even more. No title bar on the windows
or any window frame actually.



What a coincidence, I just installed VirtualBox and was looking for 
advice on what distro of linux to install...


All I want to be able to do with my VM is be able to build GDC for my 
RasPi (via all the hoops that are necessary to get cross compilation 
working), not bothered about any GUI stuff or bells/whistles, 
suggestions for a good distro to go with are welcome!


A...


Re: [OT] Ubuntu 12.10 guest in VirtualBox completely broken

2012-11-11 Thread Alix Pexton


You don't necessarily need a cross compiler to do the job. Set-up a
raspbian chroot instead!

There's some rough instructions here.

http://superpiadventures.wordpress.com/2012/07/16/development-environment/


You are also able to debug programs through qemu, though there's a
hurdle you have to jump through.

http://tinkering-is-fun.blogspot.co.uk/2009/12/debugging-non-native-programs-with-qemu.html


Regards,
Iain.




interesting...

but a lot of these instructions assume a lot more linux expertise than I 
have to hand, even the ones that claim to cover every step miss things.


That's one of the reasons that I made my RasPi available to all (as long 
as they ask for an account) ^^


A...


Re: [OT] Ubuntu 12.10 guest in VirtualBox completely broken

2012-11-11 Thread Alix Pexton




You don't necessarily need a cross compiler to do the job. Set-up a
raspbian chroot instead!

There's some rough instructions here.

http://superpiadventures.wordpress.com/2012/07/16/development-environment/


You are also able to debug programs through qemu, though there's a
hurdle you have to jump through.

http://tinkering-is-fun.blogspot.co.uk/2009/12/debugging-non-native-programs-with-qemu.html


Regards,
Iain.




The comments on the first article say that using qemu is as slow as 
compiling on the RasPi, and recommend using the cross-compiler instead.


I followed the instructs anyway, and all seemed to go well, but they 
just stop without detailing how to actually compile anything, or 
explaining what has been done ><


A...


Re: [OT] Ubuntu 12.10 guest in VirtualBox completely broken

2012-11-11 Thread Alix Pexton



What's been done is a chroot system has been set-up with ARM binaries,
instead of i386 or x86_64.  qemu-debootstrap installs an executable
qemu-arm-static inside this chroot, so when you try to run any ARM
binaries, qemu kicks in and acts as an emulator.

To compile, simply following the same instructions as per the gdc
wiki.   apt-get install all build deps, retrieve source, ./configure
and make.  :-)



o.O

you are still assuming I have way more pre-existing linux 
knowledge/experience than I actually do, I really do need this stuff 
explaining in tiny baby steps...


I followed the instructions, pretty sure I will have messed up 
somewhere, read some more of the comments on the original qemu 
instructions and someone points out that if reports to be emulating the 
wrong arm processor, and no one has posted to say they have had any 
success, never a good sign ><


A...


Re: [OT] Ubuntu 12.10 guest in VirtualBox completely broken

2012-11-12 Thread Alix Pexton



Don't think that would be the case for you.  It works just fine, just
make sure you are using the correct configure --target flag.



On my third time running through the instructions I felt like I was on 
the right track until I got to the part about running


./setup-gcc.sh $HOME/gcc-4.7-4.7.1/src

to "add gdc to gcc sources"

but this script is not in the branch that I got from git!

There is a

./update-gcc.sh

which I have tried to run, but I only got the help message or an error 
depending on if I add "--setup" or not ><


should setup-gcc be present? if not, what is the correct way to call 
update-gcc?


A...




Re: [OT] Ubuntu 12.10 guest in VirtualBox completely broken

2012-11-13 Thread Alix Pexton

On 12/11/2012 20:27, Alix Pexton wrote:

./update-gcc.sh

which I have tried to run, but I only got the help message or an error
depending on if I add "--setup" or not ><

should setup-gcc be present? if not, what is the correct way to call
update-gcc?



OK, ibuclaw helped me over that hurdle over irc, it is now building (I 
think) ^^


My next stupid question, is once its compiled on the qemu chroot, how do 
I get it onto the RasPi?


A...


Re: [OT] Ubuntu 12.10 guest in VirtualBox completely broken

2012-11-13 Thread Alix Pexton

On 13/11/2012 15:31, Iain Buclaw wrote:

On 13 November 2012 13:09, Alix Pexton  wrote:

On 12/11/2012 20:27, Alix Pexton wrote:


./update-gcc.sh

which I have tried to run, but I only got the help message or an error
depending on if I add "--setup" or not ><

should setup-gcc be present? if not, what is the correct way to call
update-gcc?




OK, ibuclaw helped me over that hurdle over irc, it is now building (I
think) ^^

My next stupid question, is once its compiled on the qemu chroot, how do I
get it onto the RasPi?

A...


Someone in IRC mentioned IPoAC.  I think this is the way to go. ;-)



Pigeons?


Re: [OT] Ubuntu 12.10 guest in VirtualBox completely broken

2012-11-14 Thread Alix Pexton

On 13/11/2012 21:15, Iain Buclaw wrote:


But really, you got network on Raspi?  Tarball up the binaries and scp
across the wire.




You know the RasPi is networked, I gave you login details for it ><

Its still building atm, do I do the tarballing after the make-install stage?

I'll read the scp man page while I wait ^^

A...


Re: [OT] Ubuntu 12.10 guest in VirtualBox completely broken

2012-11-14 Thread Alix Pexton

On 14/11/2012 10:49, Iain Buclaw wrote:


You know how to cp, you know how to ssh?  You should know how to scp. ;)



Assume I know nothing, its much safer, and probalbly quicker in the long 
run ^^


A...


Re: Discussion on std.regex (FReD)

2011-10-24 Thread Alix Pexton

On 24/10/2011 01:46, Jesse Phillips wrote:

If discussion is needed about std.regex voting please bring it to this
thread as it is easier to tally votes.


I've not had a chance to have a good look through the code, but in my 
very basic testing it did meet my performance and feature requirements. 
I still feel however that the documentation needs more work, but not so 
much as to stop me voting for.


I'll hold off on casting a vote in case I get an unexpected chance to 
delve deeper, but provisionally, I'm a "Yes".


A...


Re: std.csv: Vote in this thread

2011-11-19 Thread Alix Pexton
There are other features that I think are needed in a complete CSV 
module, but reading is the most troublesome and this offering seems to 
do a good job of that!


1: Yes!

2: Indifferent (not had time to contemplate the issue.)

A...


Re: CURL Wrapper: Vote Thread

2011-12-18 Thread Alix Pexton

On 17/12/2011 19:36, dsimcha wrote:

The time has come to vote on the inclusion of Jonas Drewsen's CURL
wrapper in Phobos.


Code: https://github.com/jcd/phobos/blob/curl-wrapper/etc/curl.d
Docs: http://freeze.steamwinter.com/D/web/phobos/etc_curl.html


For those of you on Windows, a libcurl binary built by DMC is available
at http://gool.googlecode.com/files/libcurl_7.21.7.zip.


Voting lasts one week and ends on 12/24.


 YES

A...


Re: Next in Review Queue (12/18/2011)? std.serialize/orange?

2011-12-19 Thread Alix Pexton

On 18/12/2011 21:17, Alex Rønne Petersen wrote:

On 18-12-2011 21:24, dsimcha wrote:

The review of std.net.curl is done and the voting has started. I'm
loving this steady pipeline of reviews and additions to Phobos.
According to http://prowiki.org/wiki4d/wiki.cgi?ReviewQueue, there's
nothing ready for review now, though.

Jacob Carlborg, are you ready to have std.serialize reviewed for
inclusion in Phobos in a week? Serialization is a pretty high priority
and should be reviewed ASAP if it's ready. Otherwise, does anyone else
have something to fill in the bubble in the queue? I'd like to start a
new review after the std.net.curl vote is done.


I hate to be the one doing this, but can I nitpick on the name?
std.serialization sounds much better than std.serialize for a module name.

In any case, +1 for having Orange up for review next! Would definitely
like to see it in Phobos ASAP.

- Alex


I recently started abbreviating Serialization as s11n (Es-Eleven-En) in 
the same vain as i18n for Internationalization and l10n for 
Localization. Its not my invention, its in use in C/C++ libs and 
probably other languages too. I think std.s11n; world be an acceptable 
module name.


A...


Re: Next in Review Queue (12/18/2011)? std.serialize/orange?

2011-12-20 Thread Alix Pexton

On 20/12/2011 07:38, Jacob Carlborg wrote:

On 2011-12-20 01:52, Alix Pexton wrote:


I recently started abbreviating Serialization as s11n (Es-Eleven-En) in
the same vain as i18n for Internationalization and l10n for
Localization. Its not my invention, its in use in C/C++ libs and
probably other languages too. I think std.s11n; world be an acceptable
module name.

A...


I've never heard that abbreviation.



I got fed up of typing it "the long way" and started using the same 
abbreviation technique as for i18n (ie 
firstLetter-#omittedLetters-lastLetter) googled the result and found out 
I was not the first to have the same idea. I've no more etymological 
references than that but I never claimed it was common or well known ^^


A...


Re: byKey and byValue: properties or methods?

2012-01-21 Thread Alix Pexton

On 20/01/2012 17:58, Andrei Alexandrescu wrote:

On 1/17/12 12:48 AM, Andrei Alexandrescu wrote:

I hate I must ask this:

int[string] aa;
foreach (k; aa.byKey) { ... }

or

int[string] aa;
foreach (k; aa.byKey()) { ... }



Thanks,

Andrei "I told you" Alexandrescu


I tallied the votes.

Function: Mail Mantis, bearophile, Jacob Carlborg, Olivier Pisano, Ary
Manzana, torhu.

Property: Nick Sabalausky, Simen Kjaeraas.

I wasn't able to discern a clear vote from the others. Please correct
the list.


Thanks,

Andrei


I vote property.

While the names do not fall in line with the properties-are-nouns 
pattern, I do see the compound aa.byKey as a noun (especially when aa is 
something more meaningful, and preferably plural). So I think the names 
should stay as they are.


A...


Re: Inheritance of purity

2012-02-24 Thread Alix Pexton

On 24/02/2012 00:48, Andrei Alexandrescu wrote:

On 2/23/12 6:46 PM, Andrei Alexandrescu wrote:

On 2/23/12 6:01 PM, F i L wrote:

It's unrealistic to think people (at large) will be writing any sort of
serious application outside of a modern IDE.


You'd hate working for Facebook :o).

Andrie


I tried to remove the message above, but Thunderbird doesn't recognize
it as coming from me. Is there some recent change in the forum that
could be linked to that?

I think Thunderbird recognizes messages by a specific author by
comparing email addresses.


Thanks,

Andrei


Obviously it goes by signature now ^^

A...


Re: Inheritance of purity

2012-02-24 Thread Alix Pexton

On 24/02/2012 11:03, David wrote:

Am 24.02.2012 11:43, schrieb Walter Bright:

On 2/23/2012 4:01 PM, F i L wrote:

Well then I disagree with Walter on this as well. What's wrong with
having a
"standard" toolset in the same way you have standard libraries? It's
unrealistic
to think people (at large) will be writing any sort of serious
application
outside of a modern IDE. I'm not saying it's Walters job to write IDE
integration, only that the language design shouldn't cater to the
smaller
use-case scenario.


Do you really want a language that the source code isn't readable or
browsable outside of an IDE?

Like the switch from command line to GUI, perhaps there are some that
are ready to switch from text files to some visually graphy thingy for
source code. But D ain't such a language. I don't know what such a
language would look like. I've never thought much about it before,
though I heard there was a toy language for kids that you "programmed"
by moving boxes around on the screen.


I think you mean Robot Karol, but this uses also a basic like syntax.


Sounds to me more like Scratch

http://en.wikipedia.org/wiki/Scratch_%28programming_language%29

A...


Re: AssociativeArray.opIndex

2012-03-03 Thread Alix Pexton

On 03/03/2012 11:50, Daniel Murphy wrote:

"H. S. Teoh"  wrote in message
news:mailman.341.1330753339.24984.digitalmar...@puremagic.com...

Value opIndex(Key key, int file=__FILE__, int line=__LINE__)


The AssociateArray stuct has semantic run on it with errors gagged.  Spot
the error in the line above!

If you're messing with dmd, try editing 'verror' to print error messages
while gagged and it should show up.




I checked the language reference, __FILE__ seems to be a little under 
documented ^^


A...


Re: Arbitrary abbreviations in phobos considered ridiculous

2012-03-08 Thread Alix Pexton
I feel compelled to point out that there is no such thing as "British 
English". There is English, the written language with all its archaic 
spellings and there are many spoken dialects, the most formal of which 
is RP (Received Pronunciation) sometimes called The Queen's English 
(even though she is German).


If we went to the effort of re-spelling words to match how they were 
spoken, then we would just end up with multiple accepted spellings (and 
some new letters), or a nation of 1920s radio newscasters, neither of 
which appeals to me. As it is, the archaic spellings help to make words 
more visually distinct, after all, we have some words that are spoken 
the same but spelled differently (and vice versa >< ).


As for identifiers and abbreviations, as long as they are sufficiently 
visually distinct, I'd be happy. I tolerate USian spellings as much as 
non-English speaking programmers do, because I see it as an accepted 
"Programmer's English".


Secondly, D has its "the obvious solution is the right solution" 
philosophy. so the "right" identifiers should also be the obvious ones, 
but they should also be short especially when used frequently. Longer 
identifiers should be used sparingly, but are useful to convey 
subtleties such as different side effects and of course, to make 
non-safe code stand out.


A...


Re: Arbitrary abbreviations in phobos considered ridiculous

2012-03-09 Thread Alix Pexton

On 08/03/2012 21:08, Matt Soucy wrote:


"American" does have the benefit of being more pronounceable, though...I
just tried to pronounce that "oohz-ee-an", "us-ee-an", etc and they all
sound odd.



I say it as "Yu-Essian", it gets a lot of funny looks even after I have 
explained ^^


A...


Re: Arbitrary abbreviations in phobos considered ridiculous

2012-03-09 Thread Alix Pexton

On 09/03/2012 00:07, Nick Sabalausky wrote:


But yea, it would be interesting to see a langauge that was based on
something very different. A German-based one would be fun. Or even better,
something that doesn't use the Latin alphabet, like Japanese or Hebrew or
Russian. Or Swahili (which is an awesome-sounding language). Designing/using
an Arabic (right-to-left, IIRC) programming language would be a great
mind-fuck. Heh one of us should hack up DMD to produce a NihonD, using (or
at least allowing) kanji instead of the kanas wherever appropriate :) That'd
be both fun to make and to use.



I recall, but have no idea where to start looking for it, reading an 
article about why English is the only language that works for 
programming. I think the jist was that its archaic rules allowed any 
syntax needed to be shoe-horned into place. After all, "grammatical, 
everything Yoda says, is." Or perhaps it is a relic of lost colonialism 
that English is good for listing instructions.


Having said that, I'd love to see a programming language that was based 
on Welsh/Gaelic/Irish/Cornish/Occitan/Catalan, they make for beautiful 
sounding poetry (no idea what they mean though) and I have a theory that 
poetic languages would be good for programming in.


Also I think I remember there being a Greek version of C, but it never 
took off even in Greece.


A...


Re: Arbitrary abbreviations in phobos considered ridiculous

2012-03-09 Thread Alix Pexton

On 09/03/2012 18:29, Nick Sabalausky wrote:

"Alix Pexton"  wrote in message
news:jjcn41$2g4g$1...@digitalmars.com...


and I have a theory that poetic languages would be good for programming
in.



http://shakespearelang.sourceforge.net/

Hello World:
http://shakespearelang.sourceforge.net/report/shakespeare/shakespeare.html#sec:hello




Not quite what I had in mind, but still amusing ^^

A...


[OT] Re: Arbitrary abbreviations in phobos considered ridiculous

2012-03-11 Thread Alix Pexton

On 11/03/2012 09:15, Nick Sabalausky wrote:



Written on someone's tombstone: "I *told* you I was sick!"



Spike Milligan's epitaph reads "Duirt mé leat go raibh mé breoite", 
Irish for "I told you I was ill."


A...


Re: EBNF grammar for D?

2012-03-12 Thread Alix Pexton

On 11/03/2012 16:49, Philippe Sigaud wrote:

Hello,

I'm looking for a D grammar in (E)BNF form. Did any of you write
something like that or do you think I can use the grammar parts on
dlang.org?


I remember different threads on this subject and saw the docs being
updated regularly on github, but my google-fu is weak today.



Rainer Schuetze pulled all the grammar out of the docs and fixed them up 
a while back as part of his work on Visual D. Its not in straight EBNF 
and it may not be 100% up to date, but it may be a good place to start.


http://www.dsource.org/projects/visuald/wiki/GrammarComparison

I hope that is of some use!

A...


Re: OpenBSD port of dmd?

2012-03-17 Thread Alix Pexton

I think Walter and Andrei are both right, just about different things.

I think Walter is right that there is no such thing as a default 
implementation when it comes to compatibility with the host environment, 
and asserting is the best course of action.


I think Andrei is right that when a particular environment has some 
advantageous alternate implementation of a feature it can be used while 
leaving the default for the cases where said feature is unavailable.


Walter is concerned with compatibility, Andrei with opportunistic 
optimisation.


Knowing how to tell the difference is the real trick, and that is often 
a much harder thing to pin down. Code that potentially needs to be 
different on every platform should assert when the platform is 
unrecognised. Code which is specialised for just a few platforms and has 
a "known good" default can use else to provide said default. When 
unsure, assert is the more cautious option.


A...


Re: OpenBSD port of dmd?

2012-03-17 Thread Alix Pexton

On 17/03/2012 16:43, Andrei Alexandrescu wrote:

On 3/17/12 9:10 AM, Sean Kelly wrote:

Pretty much. I'd expect to see:

version (linux) {
// optimized impl
} else version (OSX) {
version = UseDefault;
} else {
static assert(false, "unknown platform");
}
version (UseDefault) {
...
}


Taking this to its logical conclusion means that _all_ code that is
currently unguarded must be guarded by version (UseDefault).

Andrei




Firstly, I don't think the name "UseDefault" was well chosen for this 
example. I don't think its meant to be a catch all for every occasion 
when version statements are used. Perhaps "NoFeatureXyzIntrinsic" would 
be clearer.


Secondly, if every line of D code is potentially platform-specific 
and/or inherently inefficient unless optimised with some case specific 
intrinsic, then there must be some glaring problems with the 
abstractions that the language provides.


I will also reiterate that I believe that there are 2 different cases 
being considered together here.
_Compatibility_, where asserting in the else of a version statement is 
the best course of action.
_Opportunistic-Optimisation_, where providing a default case in the else 
as a fall back is quite sensible.


The scenario which applies can often be easily deduced, it is my 
experience that optimisations are "versioned-in" while incompatibilities 
are "versioned-out".
i.e. Adding a platform specific optimisation is "versioning-in", and the 
prior platform agnostic code becomes the default. Proofing a platform 
specific module is "versioning-out" removing inapplicable code and 
leaving a note for the maintainer that other platforms will require 
their own implementation.


In the cases where the programmer does not have enough knowledge to know 
which scenario applies (perhaps not knowing if a particular intrinsic 
has compatible implementations across all platforms), I find it hard to 
find any argument in favour of providing a default action that may have 
unknown effects on another system.


A...


Re: Mascot for D

2012-04-06 Thread Alix Pexton

On 06/04/2012 05:42, F i L wrote:

crudbug wrote:

May be a Dodo as a mascot ?


I doubt a Dodo would send a positive message... considering they when
extinct years ago and where considered to have very little intelligence.

I think a Martian is the best idea.


My first thought when I saw this thread was some kind of cute little 
Astronaut. I like the name "Digital Martian" but worry that any kind of 
alien mascot would lack originality or require explanation. What does it 
take to be a Martian? DO the Mars Rovers count?


A...


Re: against enforce

2011-03-25 Thread Alix Pexton

On 25/03/2011 08:04, Kagamin wrote:

So, there really is no good answer.
- Jonathan M Davis


So why do you need to differentiate between assert and enforce if you can't 
choose, which of them should be used?

We can't really turn off both of them, and if we really want performance and no 
checks, we would want to turn off both of them, so they should work in the same 
way, shouldn't they?


I can't think of an occasion when I would want to have my uses of 
enforce() stripped for a release build. Removing asserts once I am sure 
that my code has no logic errors make sense, but removing the code that 
validates user input and system integrity doesn't.


Performance is irrelevant if you are processing corrupted memory or 
malformed input.


Before there we had enforce, I did tend to use assert for both cases as 
I cobbled code together, then rewrite the validation parts as throws on 
the second pass. When enforce appeared that 2 phase process got much 
easier, and now I can choose the right one as I code, which increases 
productivity.


Enforce does not replace assert, it compliments it, and very elegantly so.



With regard to libraries, there is an overlap between what is input 
validation and what is logic checking (a logic error in the code of 
program a, results in bad input being sent to lib b). Here, assert is 
the only choice as hitting an assert in a library (hopefully) exposes 
logic errors in the program that uses the library, this is something 
that you fix by reviewing your code, not by recovering at runtime and 
trying again. This means that libraries (should) have 2 types of assert, 
but I hesitate to suggest the creation of a synonym to help better 
document the difference between them, as I find that the use of in{} and 
out{} do a pretty good job of that already.


The only problems that I foresee are for libraries where the source is 
not available (which I have not had an issue with yet) and libs that 
wrap non-D code that does not use the same conventions. In these cases, 
one will not always know if the -release flag (or equivalent) has been 
used. If it has, then one may not find logic errors as one codes, if it 
hasn't then one will find the errors, but will not be able to strip the 
asserts when producing one's own release build.




A...


Re: against enforce

2011-03-25 Thread Alix Pexton

On 25/03/2011 20:23, spir wrote:


This logic certainly looks sensible, but I cannot understand how it
should work in practice. Say I'm implementing a little set of operations
on decimals. Among those, some (division, square root...) will
necessarily have to check their input.
According to the rationale you expose, I should use assertions, since
operand will nearly never be (direct) user input, instead be products of
the app's logic. Then, what happens when div gets a null denominator on
a release build? In practice, the issue is not that serious since I will
certainly delegate to a lower-level func which itself throws. But I
could also (in theory) implement it in assembly or whatnot.
My point of view is if a func has preconditions on its args, then
checkings simply cannot go away.

Such considerations lead me to wonder whether we should not instead use
exceptions/enforce everywhere for actual func arg checking, and use
asserts in unittests only. Or use them also for /temporary/ additional
checkings during development (similar to unittests in fact).

A special case may be about checkings that control logical values or
ranges which do not prevent the func to run. Say, a.length should
logically be in 1..9 -- but the func can run fine anyway.

Denis


Since I started programming in D, unittests have been among the first 
things I write, and I am just about getting the hang of using DMD's 
coverage features to make sure that my tests cover every branch of my 
code. Recently I have been trying to write unittests without using any 
additional asserts, making unittests into examples of use, designed to 
hit every corner case while "telling a story". I don't find it quite as 
easy as just writing asserts, but it is a half step toward writing 
decent documentation, (something I often fail at >< ) and it makes the 
code to be tested easier to write.


With the iota case, I want it to use assert, not enforce. I write my 
test so that when it runs it hits the corner cases and if there is a 
problem with the arguments sent to iota then execution stops in the 
library code. In this scenario, I know there is something I need to fix 
in my code (or possibly in Phobos ^^ ). If iota instead threw an 
exception, I would then have to put in a try/catch or a scope() and try 
to recover (to do otherwise would be to duplicate code already in the 
library), but that doesn't fix the problem, it just masks it, so my 
program has gotten worse, not better!


That a compiled lib (including the Phobos lib distributed with DMD) is 
assert-less for performance reasons, is a quality of implementation 
issue, not a fault of enforce, or something it was ever intended to fix.


A...


Re: i like cakes

2011-03-28 Thread Alix Pexton

try this?

Dealing with Internet Trolls - the Cognitive Therapy Approach
http://unarmed.shlomifish.org/909.html

A...

On 28/03/2011 02:57, Andrew Wiley wrote:

On Sun, Mar 27, 2011 at 8:45 PM, Gary Whatmore  wrote:

Hello again

I've stayed quiet for a long time because people started accusing me of 
trolling. But now, I REALLY HATE THIS IDIOT IN REDDIT  HE IS DRIVING ME 
CRAZY. ASSHOLE ASSWIPE SHITHOLE LUNATIC. I HATE HIM. BASHING D JUST BECAUSE 
HE'S SOME MENTALLY ILL PSYCHOPATE WANTING TO KILL ANDREI AND WALTER :-( THE 
BEST WE CAN DO IS FIND I LIKE CAKES AND DOWNVOTE ALL HIS VOTES. GO AWAY TROLL! 
:-(



The problem with trolls is that when you do this, they win. No one
likes them, but you've just got to learn to ignore them or you just
make things worse.




Re: i like cakes

2011-03-28 Thread Alix Pexton

On 28/03/2011 10:36, Iain Buclaw wrote:

== Quote from Alix Pexton (alix.dot.pex...@gmail.dot.com)'s article

try this?
Dealing with Internet Trolls - the Cognitive Therapy Approach
http://unarmed.shlomifish.org/909.html
A...
On 28/03/2011 02:57, Andrew Wiley wrote:

On Sun, Mar 27, 2011 at 8:45 PM, Gary Whatmore   wrote:

Hello again

I've stayed quiet for a long time because people started accusing me of

trolling. But now, I REALLY HATE THIS IDIOT IN REDDIT  HE IS DRIVING ME 
CRAZY.
ASSHOLE ASSWIPE SHITHOLE LUNATIC. I HATE HIM. BASHING D JUST BECAUSE HE'S SOME
MENTALLY ILL PSYCHOPATE WANTING TO KILL ANDREI AND WALTER :-( THE BEST WE CAN DO
IS FIND I LIKE CAKES AND DOWNVOTE ALL HIS VOTES. GO AWAY TROLL! :-(



The problem with trolls is that when you do this, they win. No one
likes them, but you've just got to learn to ignore them or you just
make things worse.


It broke the flow of reading.

Why is top posting bad?


---
http://flamewarriors.com



oops, rush ><

A...


Re: __traits so long and ugly, what about ::?

2011-03-30 Thread Alix Pexton

On 30/03/2011 20:28, Ary Manzana wrote:

I think :: is not used in the language.

In a recent article about D I saw:

mixin(__traits(identifier, T) ~ " " ~
to!string(tolower(__traits(identifier, T)[0])) ~
__traits(identifier, T)[1..$] ~ ";");

What if foo::bar were an alias for __traits(foo, bar) ?

The code would look like this:

mixin(T::identifier ~ " " ~
to!string(tolower(T::identifier[0])) ~
T::identifier[1..$] ~ ";");

What do you think?

Another uses:

__traits(int, isArithmetic) ==> int::isArithmetic
__traits(C, isAbstractClass) ==> C::isAbstractClass

__traits(hasMember, S, "m") ==> S::hasMember("m")

Well, you get the idea...

:: might be applied to other compile time uses, but I just came up with
this...


Hmn, interesting idea! I noticed, however, that the "foo" and "bar" in 
your example are actually swapped...


__traits(foo, bar) ==> foo::bar

should be

__traits(foo, bar) ==> bar::foo

For many the uses of __traits I can recall off the top of my head, it 
certainly seems to be both elegant and intuitive. One sore thumb would 
be __traits(compiles, ...) which I believe gets used quite frequently in 
Phobos.


Clarifications and my lack of insight into the complete breadth of 
__traits's capabilities and variations aside, I think this is the best 
suggestion for the replacement of the much maligned experimental keyword 
that I have seen posted since Don's suggestion of a magic namespace[1]. 
I'm not 100% sure if this :: syntax could also tidy up is() expressions 
too, but if it can, I can imagine it having a lot of support. If 
language design was a democracy, I'd certainly vote for it ^^


A...

[1] Search the NG for "Proposal: Replace __traits and is(typeof(XXX)) 
with a 'magic namespace'."


Re: __traits so long and ugly, what about ::?

2011-03-30 Thread Alix Pexton

On 30/03/2011 21:09, Alix Pexton wrote:

On 30/03/2011 20:28, Ary Manzana wrote:

I think :: is not used in the language.

In a recent article about D I saw:

mixin(__traits(identifier, T) ~ " " ~
to!string(tolower(__traits(identifier, T)[0])) ~
__traits(identifier, T)[1..$] ~ ";");

What if foo::bar were an alias for __traits(foo, bar) ?

The code would look like this:

mixin(T::identifier ~ " " ~
to!string(tolower(T::identifier[0])) ~
T::identifier[1..$] ~ ";");

What do you think?

Another uses:

__traits(int, isArithmetic) ==> int::isArithmetic
__traits(C, isAbstractClass) ==> C::isAbstractClass

__traits(hasMember, S, "m") ==> S::hasMember("m")

Well, you get the idea...

:: might be applied to other compile time uses, but I just came up with
this...


Hmn, interesting idea! I noticed, however, that the "foo" and "bar" in
your example are actually swapped...

__traits(foo, bar) ==> foo::bar

should be

__traits(foo, bar) ==> bar::foo

For many the uses of __traits I can recall off the top of my head, it
certainly seems to be both elegant and intuitive. One sore thumb would
be __traits(compiles, ...) which I believe gets used quite frequently in
Phobos.

Clarifications and my lack of insight into the complete breadth of
__traits's capabilities and variations aside, I think this is the best
suggestion for the replacement of the much maligned experimental keyword
that I have seen posted since Don's suggestion of a magic namespace[1].
I'm not 100% sure if this :: syntax could also tidy up is() expressions
too, but if it can, I can imagine it having a lot of support. If
language design was a democracy, I'd certainly vote for it ^^

A...

[1] Search the NG for "Proposal: Replace __traits and is(typeof(XXX))
with a 'magic namespace'."


Damn I type slow ><


Re: __traits so long and ugly, what about ::?

2011-03-30 Thread Alix Pexton

On 30/03/2011 20:45, KennyTM~ wrote:

This is confusing as :: is used to separate scopes in C++ (and PHP too).


The first thing it reminded me of was Lua, where a single colon makes 
the left hand side into the first argument of the function on the right.


foo:bar(x) ==> bar.(foo, x)

So it felt kinda familiar to me ^^

A...


Re: __traits so long and ugly, what about ::?

2011-04-01 Thread Alix Pexton

On 31/03/2011 18:37, Jonathan M Davis wrote:

On 2011-03-31 06:35, Kagamin wrote:

Ary Manzana Wrote:

I just hate it when you have to write too much


hasMember!(S, "m")
is only 1 character longer than
S::hasMember("m")

not too much for me


And hasMember!(S, "m") is actually consistent with the rest of the language
and straight forward to read for those who know the language.
S::hasMember("m") just adds more syntax where there's no need for it, and
makes it so that there's that much more syntax to learn and keep straight.

- Jonathan M Davis


I thought the :: syntax seemed pretty intuitive (keystroke savings never 
entered into my evaluation), but I seem to be in a minority on that.


After re-reading the previous discussion of __traits and its proposed 
replacement, however, I am reminded of an important point: language 
features should not have special powers that can't be replicated in 
client code.


So, with that in mind, I have to agree that using templates for things 
like hasMember has to be the way forward.


Having templates that are internal to the complier or that simply 
forward to __traits seems a bit odd to me. I think I'd rather see 
__traits simplified and more of work moved into the library, which may 
make it more versatile and easier to extend (pure speculation ^^).


Right, I'm off to go and squirrel all my uses or traits away inside 
templates, I have a sneaking suspicion that it is going to make some big 
improvements in readability ^^


A...


GSoC packaging

2011-04-04 Thread Alix Pexton
While reading through the details of some of the GSoC proposals, it 
occurred to me that it may be a good idea to specify a special top-level 
package for the projects to go in while they are being developed. Steven 
Schveighoffer gets the credit for first suggesting that new code should 
not be put directly into any existing modules, thus making it easier to 
identify the additions, but I'd like to go one step further and suggest 
keeping all the GSoC modules together, perhaps in "gsoc2011.whatever".


I don't think its my worse idea ever ^^

A...


Re: std.parallelism: Review resumes now

2011-04-16 Thread Alix Pexton

On 13/04/2011 15:28, Lars T. Kyllingstad wrote:

We now resume the formal review of David Simcha's std.parallelism
module.  Code and documentation can be found here:

 https://github.com/dsimcha/std.parallelism/blob/master/parallelism.d
 http://cis.jhu.edu/~dsimcha/d/phobos/std_parallelism.html

Please post reviews and comments in this thread.

Voting for inclusion in Phobos will start on April 19 and end on April
26.  Please do not cast any votes in this thread.  I will start a new
thread for that purpose when the voting period begins.

-Lars


I'll be away all next week with, and I doubt I'll have internet, so I'd 
like to cast my vote in advance ^^


I vote *for* inclusion!

Good Luck David ^^

A...


Re: Rank The D Programming Language

2012-07-25 Thread Alix Pexton

On 25/07/2012 04:43, Nick Sabalausky wrote:

On Tue, 24 Jul 2012 21:35:24 -0500
Caligo  wrote:


Just found this:

http://hammerprinciple.com/therighttool/items/d/c-2


Jesus, that's one of the most poorly implemented sites I've ever seen.
I tried going through the questions (after switching to my
non-preferred browser), but by only the second one, I couldn't take the
"poorly-reinvented-UI-elements inside of a pointlessly TEENY miniature
little popup" any more and gave up. And even outside of that, there's
that "schizophrenic frames" layout and lines covering the text. Not
worth it. God that site's horrid.



I have to agree, I've not encountered anything quite so claustrophobic. 
I got 3 questions in before I started wishing I had been more strict in 
my definition of what it is to "know" a language (I picked all the ones 
I knew as well as C++ or better, and as my C++fu is lacking it was about 
1/3 of the full list ><).
I recall doing a similarly themed survey some time ago, but it was much 
easier to respond to, perhaps the sense of deja-vu also put me off.


A...


Re: [OT] Good^H^H^H^HAcceptable NG/email client?

2012-07-25 Thread Alix Pexton

On 25/07/2012 05:12, Nick Sabalausky wrote:
[snip]

Anyone know of a NG/email client, available on Win (preferably cross
platform
- I do want to switch to Lin eventually) that isn't shit?



Once upon a time, I used Emacs over telnet to check mail/news on my uni 
account from my parents place where there was only rural backwater 
dail-up (that was still billed per minute!) Overall I would not 
recommend the experience, but I did grow fond of the Emacs mail mode and 
used it exclusively for the rest of my time at uni. Chances are it has 
improved since then, but perhaps you can find a version of Emacs from 
[REDACTED] on the wayback machine?


A...


Re: [OT] Good^H^H^H^HAcceptable NG/email client?

2012-07-25 Thread Alix Pexton

On 25/07/2012 05:12, Nick Sabalausky wrote:
[snip]

Anyone know of a NG/email client, available on Win (preferably cross
platform
- I do want to switch to Lin eventually) that isn't shit?



Once upon a time, I used Emacs over telnet to check mail/news on my uni 
account from my parents place where there was only rural backwater 
dail-up (that was still billed per minute!) Overall I would not 
recommend the experience, but I did grow fond of the Emacs mail mode and 
used it exclusively for the rest of my time at uni. Chances are it has 
improved since then, but perhaps you can find a version of Emacs from 
1998 on the wayback machine?


A...


Re: Rank The D Programming Language

2012-07-25 Thread Alix Pexton

On 25/07/2012 04:43, Nick Sabalausky wrote:

On Tue, 24 Jul 2012 21:35:24 -0500
Caligo  wrote:


Just found this:

http://hammerprinciple.com/therighttool/items/d/c-2


Jesus, that's one of the most poorly implemented sites I've ever seen.
I tried going through the questions (after switching to my
non-preferred browser), but by only the second one, I couldn't take the
"poorly-reinvented-UI-elements inside of a pointlessly TEENY miniature
little popup" any more and gave up. And even outside of that, there's
that "schizophrenic frames" layout and lines covering the text. Not
worth it. God that site's horrid.



I have to agree, I've not encountered anything quite so claustrophobic. 
I got 3 questions in before I started wishing I had been more strict in 
my definition of what it is to "know" a language (I picked all the ones 
I knew as well as C++ or better, and as my C++fu is lacking it was about 
1/3 of the full list ><).
I recall doing a similarly themed survey some time ago, but it was much 
easier to respond to, perhaps the sense of deja-vu also put me off.


A...


Re: [OT] Good^H^H^H^HAcceptable NG/email client?

2012-07-25 Thread Alix Pexton

On 25/07/2012 09:30, Alix Pexton wrote:

On 25/07/2012 05:12, Nick Sabalausky wrote:
[snip]

Anyone know of a NG/email client, available on Win (preferably cross
platform
- I do want to switch to Lin eventually) that isn't shit?



Once upon a time, I used Emacs over telnet to check mail/news on my uni
account from my parents place where there was only rural backwater
dail-up (that was still billed per minute!) Overall I would not
recommend the experience, but I did grow fond of the Emacs mail mode and
used it exclusively for the rest of my time at uni. Chances are it has
improved since then, but perhaps you can find a version of Emacs from
[REDACTED] on the wayback machine?

A...


PS

I've just gone right off Thunderbird (which I only use for news) as its 
just reported posting failures that were not failures, hence my double 
posts, and no longer allows me to delete my own messages from the NG!


/em goes to download Emacs!


Re: Vote here for best article iPad2 contest

2011-06-05 Thread Alix Pexton

[4] D Slices by Steve Schveighoffer


Re: Article discussing Go, could well be D

2011-06-08 Thread Alix Pexton

On 08/06/2011 11:34, Nick Sabalausky wrote:

"Russel Winder"  wrote in message
news:mailman.704.1307525385.14074.digitalmar...@puremagic.com...

On Wed, 2011-06-08 at 04:29 -0400, Nick Sabalausky wrote:
[ . . . ]

I'm convinced the real reason is just that he's far too much a fan of ad
hominem reasoning.


Assuming the author knew what ad hominem meant!

Of course hatred of Latin could be a good argument for ignoring the term.
;-)


Heh :)  I wonder what the Scientific/Latin term for "Fear of Latin" would
be?




I believe most (if not all) phobias are derived from the Greek, which 
was, oddly enough, the lingua franca of the Roman empire. So I'd guess 
the answer would be something like "Latinikaphobia", but I'm drawing on 
Google translate more than any residual knowledge of the Classics.


A...


Re: Flag proposal [OT]

2011-06-11 Thread Alix Pexton

On 11/06/2011 06:18, Andrej Mitrovic wrote:

We should rename Yes and No to Yay and Nay to make them alignable, and
even more importantly to make us appear as old Englishmen!


"Yay" and "Nay" are too similar looking, but luckily, "Yay" is not 
actually a old English word :)  A more correct alternative would be 
"Aye" (pronounced the same as "eye"), which (along with "Nay") is still 
used for some voting actions (such as councillors deciding where to go 
for lunch). I myself say it al least 20 times a day :)


A...


Re: Flag proposal [OT]

2011-06-11 Thread Alix Pexton

On 11/06/2011 11:56, Nick Sabalausky wrote:

"Alix Pexton"  wrote in message
news:isvae3$2o51$1...@digitalmars.com...

On 11/06/2011 06:18, Andrej Mitrovic wrote:

We should rename Yes and No to Yay and Nay to make them alignable, and
even more importantly to make us appear as old Englishmen!


"Yay" and "Nay" are too similar looking, but luckily, "Yay" is not
actually a old English word :)  A more correct alternative would be "Aye"
(pronounced the same as "eye"), which (along with "Nay") is still used for
some voting actions (such as councillors deciding where to go for lunch).
I myself say it al least 20 times a day :)



Dost thou, verily?




Aye!

A...


Re: Best article vote tally - WE HAVE TWO WINNERS!

2011-06-11 Thread Alix Pexton

On 10/06/2011 09:56, Walter Bright wrote:

On 6/9/2011 5:10 PM, Robert Clipsham wrote:

On 10/06/2011 00:40, Steven Schveighoffer wrote:

[snip]

"I wrote this article on D, and all I got was this lousy!T shirt"

-Steve


I would happily accept this as my runners up prize.


If someone wants to edit up an image for a lousy!T shirt, I can see
about getting it produced.



I think I made the attached the right size for printing on the "pocket" 
area of a t-shirt from cafepress. I think it may alternatively work well 
printed across the shoulders, which would be a little larger.


I've made the changes to the wording that have been suggested by some 
others in this thread, and applied minimal "d-ification". K.I.S. etc...


It is by no means a final design, but perhaps a starting point, so 
suggestions welcome.


A...

P.S.
consider it Public Domain :)
<>

Re: Best article vote tally - WE HAVE TWO WINNERS!

2011-06-11 Thread Alix Pexton

On 11/06/2011 14:00, Mafi wrote:

Am 11.06.2011 14:33, schrieb Alix Pexton:


It is by no means a final design, but perhaps a starting point, so
suggestions welcome.


What about:
/++ I wrote an article about D and all I got was ++/
this.Lousy!T shirt;

//d-programming-language.org


I thought about that, I wasn't sure it would parse as valid D code ><

also, the difference in the line lengths/breaks is less aesthetically 
pleasing (imho)...


I also considered...


/++ I wrote an article about D
and all I got was ++/
this(){
Lousy!T shirt;
}

which I know is valid, albeit, pointless D, but it also has a less 
appealing shape (imho)...


A...


Re: Best article vote tally - WE HAVE TWO WINNERS!

2011-06-11 Thread Alix Pexton

On 11/06/2011 19:35, Andrei Alexandrescu wrote:

On 6/11/11 1:39 PM, Timon Gehr wrote:

On 11/06/2011 14:28, Alix Pexton wrote:

On 11/06/2011 14:00, Mafi wrote:

Am 11.06.2011 14:33, schrieb Alix Pexton:


It is by no means a final design, but perhaps a starting point, so
suggestions welcome.


What about:
/++ I wrote an article about D and all I got was ++/
this.Lousy!T shirt;

//d-programming-language.org


I thought about that, I wasn't sure it would parse as valid D code><
[snip.]


This would: (with minimal context)
T shirt;
struct T{
T lousy(T)(T arg){return arg;}
T submitArticle(Article){
return this.lousy!T(shirt);
}
}
struct Article{};


Timon


We don't have (g|m)onads if we don't make it a range.

Andrei


I think it is possible to take the d-ification too far ><

A...


Re: Flag proposal [OT]

2011-06-12 Thread Alix Pexton

On 12/06/2011 02:40, Steven Schveighoffer wrote:

On Sat, 11 Jun 2011 13:04:47 -0400, Andrej Mitrovic
 wrote:


On 6/11/11, Alix Pexton  wrote:

On 11/06/2011 06:18, Andrej Mitrovic wrote:

We should rename Yes and No to Yay and Nay to make them alignable, and
even more importantly to make us appear as old Englishmen!


"Yay" and "Nay" are too similar looking, but luckily, "Yay" is not
actually a old English word :) A more correct alternative would be
"Aye" (pronounced the same as "eye"), which (along with "Nay") is still
used for some voting actions (such as councillors deciding where to go
for lunch). I myself say it al least 20 times a day :)

A...



Oh damn, yay is what teenage girls would say, not old Englishmen. My
bad, it really is "Aye". :p


You were phonetically right :) It's yea or nay.

http://dictionary.cambridge.org/dictionary/british/yea-or-nay

My son's most recent birthday (3 years old) was a farm-themed birthday,
and we asked people to RSVP yay or neigh :P

So I guess there's all kinds of kooky fun you can have with flags...

-Steve


Nope, its definitely Aye when used for voting, (at least it is round 
here) as in "all those in favour, say aye", "ayes to the right" and "the 
ayes have it". Maybe southerners say this "yea" word of which you speak, 
we don't hold with their strange customs in these parts ^^


A...


Re: Flag proposal [OT]

2011-06-12 Thread Alix Pexton

On 12/06/2011 16:11, Steven Schveighoffer wrote:

On Sun, 12 Jun 2011 04:36:55 -0400, Alix Pexton
 wrote:


On 12/06/2011 02:40, Steven Schveighoffer wrote:

On Sat, 11 Jun 2011 13:04:47 -0400, Andrej Mitrovic
 wrote:


On 6/11/11, Alix Pexton  wrote:

On 11/06/2011 06:18, Andrej Mitrovic wrote:

We should rename Yes and No to Yay and Nay to make them alignable,
and
even more importantly to make us appear as old Englishmen!


"Yay" and "Nay" are too similar looking, but luckily, "Yay" is not
actually a old English word :) A more correct alternative would be
"Aye" (pronounced the same as "eye"), which (along with "Nay") is
still
used for some voting actions (such as councillors deciding where to go
for lunch). I myself say it al least 20 times a day :)

A...



Oh damn, yay is what teenage girls would say, not old Englishmen. My
bad, it really is "Aye". :p


You were phonetically right :) It's yea or nay.

http://dictionary.cambridge.org/dictionary/british/yea-or-nay

My son's most recent birthday (3 years old) was a farm-themed birthday,
and we asked people to RSVP yay or neigh :P

So I guess there's all kinds of kooky fun you can have with flags...

-Steve


Nope, its definitely Aye when used for voting, (at least it is round
here) as in "all those in favour, say aye", "ayes to the right" and
"the ayes have it". Maybe southerners say this "yea" word of which you
speak, we don't hold with their strange customs in these parts ^^


I don't deny that aye is used frequently for voting. All I was saying
is, the correct expression is yea or nay, not yay or nay. Andrej thought
it was actually aye or nay, which I've never heard as an expression.

I'm not sure it's used anymore, but it's definitely an expression that
was used for voting (see my dictionary reference).

-Steve


True, "yea-or-nay" is quite a common, if old fashioned phrase, but "yea" 
on its own is exceptionally rare (to the point where I doubt ever 
hearing anyone make such a noise and mean it to indicate the affirmative).


A...


Re: Flag proposal [OT]

2011-06-13 Thread Alix Pexton

On 13/06/2011 02:31, Paul D. Anderson wrote:

Alix Pexton Wrote:


On 12/06/2011 16:11, Steven Schveighoffer wrote:

On Sun, 12 Jun 2011 04:36:55 -0400, Alix Pexton
  wrote:


On 12/06/2011 02:40, Steven Schveighoffer wrote:

On Sat, 11 Jun 2011 13:04:47 -0400, Andrej Mitrovic
  wrote:


On 6/11/11, Alix Pexton  wrote:

On 11/06/2011 06:18, Andrej Mitrovic wrote:

We should rename Yes and No to Yay and Nay to make them alignable,
and
even more importantly to make us appear as old Englishmen!


"Yay" and "Nay" are too similar looking, but luckily, "Yay" is not
actually a old English word :) A more correct alternative would be
"Aye" (pronounced the same as "eye"), which (along with "Nay") is
still
used for some voting actions (such as councillors deciding where to go
for lunch). I myself say it al least 20 times a day :)

A...



Oh damn, yay is what teenage girls would say, not old Englishmen. My
bad, it really is "Aye". :p


You were phonetically right :) It's yea or nay.

http://dictionary.cambridge.org/dictionary/british/yea-or-nay

My son's most recent birthday (3 years old) was a farm-themed birthday,
and we asked people to RSVP yay or neigh :P

So I guess there's all kinds of kooky fun you can have with flags...

-Steve


Nope, its definitely Aye when used for voting, (at least it is round
here) as in "all those in favour, say aye", "ayes to the right" and
"the ayes have it". Maybe southerners say this "yea" word of which you
speak, we don't hold with their strange customs in these parts ^^


I don't deny that aye is used frequently for voting. All I was saying
is, the correct expression is yea or nay, not yay or nay. Andrej thought
it was actually aye or nay, which I've never heard as an expression.

I'm not sure it's used anymore, but it's definitely an expression that
was used for voting (see my dictionary reference).

-Steve


True, "yea-or-nay" is quite a common, if old fashioned phrase, but "yea"
on its own is exceptionally rare (to the point where I doubt ever
hearing anyone make such a noise and mean it to indicate the affirmative).

A...


Then you must not have heard the King James Version of the Bible read aloud, or 
been to a Shakespeare play.

Admittedly the KJV and Shakespeare's works don't count as modern English, but I doubt 
you've never "heard such a noise"!  :-)

p.s. The word appears 209 times in Shakespeare's plays. There's a website for 
everything!



Aye, I did mean people using their own words and not someone else's. for 
such a prolific writer, 209 doesn't seem like a lot, and I can't help 
wondering how many times the bard used "aye".


Mind you, he was a southerner!

A...



Re: Rename std.string.toStringz?

2011-06-16 Thread Alix Pexton

On 16/06/2011 07:30, Jonathan M Davis wrote:


1. Keep toStringz as it is (as well as toUTF16z) and either consider stringz
to be some sort of word unique to the D community or just admit that we're not
going to camelcase it because it would break too much code to do so.


I vote for no change, I like stringz as it is ^^

A...


Re: Rename std.string.toStringz?

2011-06-17 Thread Alix Pexton

On 16/06/2011 21:32, Jonathan M Davis wrote:


I have _never_
heard the term stringz used outside of D. Searching for it online brings up
_nothing_ (not even D).


Have you tested what results you get when searching for "c string"?

A...


Re: D brand identity repository

2011-07-03 Thread Alix Pexton

On 03/07/2011 13:32, SimonM wrote:

Ooh, don't forget about the dsource logo:
http://www.dsource.org/chrome/dsource/img/dsource-logo.gif

and also the d-programming-language.org site's favicon:
http://d-programming-language.org/favicon.ico


Visual D has its own logo too, though it is partially inspired by that
of Visual Studio...


http://www.dsource.org/projects/visuald/browser/wiki/vd_logo.png?format=raw

I started to do a more Martian version and realised that it reminded me 
too much of the old netscape logo ><


The current logo (white on red) is still my favourite, though I think I 
see it differently to some of you. When I look at it, I see the letter D 
on a window that is looking out onto a view of 3 celestial bodies, but 
many of the new designs make the D into the planet. Of the new designs, 
I like Mafi's the most.


A...



Re: D Programming Language Specification ebook

2011-07-05 Thread Alix Pexton

On 05/07/2011 00:35, Nick Sabalausky wrote:



"Whom" is about as relevant to modern day as "Thou".



I must be some kind of antique ><

A...



Re: Prototype buildsystem "Drake"

2011-07-14 Thread Alix Pexton

On 14/07/2011 03:53, Andrej Mitrovic wrote:

Why build a tool anyway? Why not make a build library that we can use
in our build scripts?

Then we just import the library in our `build.d` script, write the
build script with the help of those library functions, and let the
user run `rdmd build.d`. No need to install any tools, just run rdmd.

I'm already using this approach for DWinProj., the only issue is that
the build script is a little large (~300 lines), but a lot of its code
could be put into a library (e.g. it has file traversing, parallel
builds, checking if all tools are present, checking if all libraries
are present, converting header files, etc..).

This would reduce the script to a few dozen lines. And that's probably
what I'll do to make my other projects easier to build.


Oooh, I like this build lib idea!

A...


Re: Byte Order Swapping Function

2011-07-17 Thread Alix Pexton

On 17/07/2011 07:42, Jonathan M Davis wrote:

On Saturday 16 July 2011 23:31:09 Andrew Wiley wrote:

[snip]

Take a look at http://www.dmh2000.com/cpp/dswap.shtml . It made the odd
behavior make a lot more sense to me.


Okay. Good to know. In other words, we can't have swapEndian work with floating
point values like that. It can generate a byte array from them (or maybe an
integral value of the same size), but it can't generate another floating point
value. Bleh. Okay. Floating point values with have to use an entirely different
overload then. Thanks for the info.

- Jonathan M Davis



I find myself wanting to address this issue by using types, as the FP 
example demonstrates that when the endieness of a value changes, its 
type should too.


using double as an example, I'd like to be able to write code something 
like this.



auto v0 = 0.1;
auto v1 = nbo!double(v0); // nbo = network byte order, your names may vary
auto v2 = to!double(v1);
assert(v0 == v2);


I would, of course, expect aliases for those occasions when one wants to 
state endieness explicitly (I just can't think of any >< ), and for 
non-conversions (when nbo == hbo) to be no-ops.


Or am I missing something?

A...


Re: std.path review: update

2011-07-20 Thread Alix Pexton

On 20/07/2011 20:57, Lars T. Kyllingstad wrote:


Does anyone know whether Windows' case insensitivity is limited to ASCII?
If not, is the filesystem Unicode-aware, or does it uses some locale
specific codepage to compare file names?

-Lars


Wikipedia says Windows long file names are up to 255 UTF-16 characters 
(or code points, depending which article you refer to >< ) Seems 
consistent with Microsoft's approach to character encoding throughout 
the rest of the Windows API.



http://en.wikipedia.org/wiki/Long_filename


A...


Re: What does C++ do better than D? - StackOverflow.com

2011-07-30 Thread Alix Pexton

On 30/07/2011 11:22, Jonathan M Davis wrote:

On Saturday 30 July 2011 11:43:29 Klaim - Joël Lamotte wrote:

Hi,

I just wanted to point this question to make sure there are feedbacks from
several points of view.
Some points in the current most voted answer are interesting and I guess
some people here will want to comment it.
However I don't think it's a very good idea, It would be better to just try
to post the most pragmatic and useful answer to the original question:

http://programmers.stackexchange.com/questions/97207/what-does-c-do-better-t
han-d


Ouch. Now you're going to make me think. My first reaction is to answer
"nothing," but there almost has to be _something_. At the moment, however, I
have no clue what that could be. I'll definitely have to think about this one.

- Jonathan M Davis


Looks like that "current most voted answer" got some heavy edits to make 
it more objective. I didn't see the original, but what I read was full 
of misconceptions.


If I were to reply to the OP, I'd say that the one thing that C++ does 
better than D is confuse new-comers, but that simply shows that I do not 
have enough experience with C++ to know what it does well (if anything).


A...


Re: Std.path: Final Vote

2011-08-05 Thread Alix Pexton

On 05/08/2011 14:26, dsimcha wrote:

My apologies for not announcing this yesterday. For some reason I
thought today was the official end of review. Anyhow, Lars Kyllingstad's
new std.path module, which has been in review for the past 3 weeks, is
up for vote. Please vote yes or no in this thread.

Code:
https://github.com/kyllingstad/phobos/blob/std-path/std/path.d

Docs
http://www.kyllingen.net/code/std-path/phobos-prerelease/std_path.html

Voting ends next Friday, August 12, since it started a day late.


YES!


Re: Should we add drop to Phobos?

2011-08-16 Thread Alix Pexton

On 16/08/2011 00:22, Jonathan M Davis wrote:


Does anyone else have an opinion on this? It will be a lot easier to talk
Andrei into having drop in Phobos if more than just 2 people respond.

- Jonathan M Davis


I find the arguments for drop quite compelling.

+1 from me.

A...


Re: CURL review request

2011-08-16 Thread Alix Pexton

On 16/08/2011 12:48, Jonas Drewsen wrote:

Hi all,

This is a review request for the curl wrapper. Please read the "known
issues" in the top of the source file and if possible suggest a solution.

We also need somebody for running the review process. Anyone?

Code:
https://github.com/jcd/phobos/blob/curl-wrapper/etc/curl.d
Docs:
http://freeze.steamwinter.com/D/web/phobos/etc_curl.html

Demolish!

/Jonas



Here are my initial observations and impressions...

In the opening description...
"The request is perform when first accessing..." -> "The request is 
performed when first accessing..."


On first reading, I found it very hard to follow the first collected 
example. (Still not 100% clear after reading the whole of the 
documentation either >< )


Some (all?) of the @property members of Protocol are documented as 
functions. (Perhaps an artefact of the ddoc mixin issue mentioned before 
this section?)


Description of Protocol.onSend...
"...specifies the max number of bytes that can be send." -> 
"...specifies the maximum number of bytes that can be sent."
"...returns the number of elements in the buffer that has been filled 
and is ready to send." -> "...returns the number of elements in the 
buffer that have been filled and are ready to send."


Description of Protocol.onReceive...
"...is not guaranteed to be valid aften the callback returns." -> "...is 
not guaranteed to be valid after the callback returns."


Protocol.onProgress represents transfer statistics using doubles?

CurlTimeCond, members are all lower case, took me a few goes to work out 
what they might mean, still not all that sure. Should I assume that if 
the meanings are not obvious that I'm not ready to be tinkering with 
curl at this level, or should each value be clarified?


Http.addHeader / Http.setHeader both have the same description, I assume 
the latter overwrites an existing value if it exists? what is the 
behaviour of addHeader when the key already exists?


Http.setTimeCondition parameter names in ddoc don't match those in the 
function prototype.


Http._whatever_Async (and also Async functions for Ftp.)
"Asynchronous HTTP _WHATEVER_ to the specified URL." -> "Performs a HTTP 
_WHATEVER_ on the specified URL, asynchronously."
(Wording looks very similar across this group of functions, not sure if 
my suggested alteration here correctly captures the subtleties for all 
cases. Also, later examples are just marked as "Asynchronous version 
of..." and lose the note about callbacks, which I assume still apply.)


All callbacks are write only properties which prevents the use of event 
hooking (which, in my experience, is a common occurrence in event based 
models). Hooking might not apply in this case however (I've not 
particularly thought through any use cases) and safe event hooking might 
be beyond the scope of this module.


Http.traceAsync
Calls AsyncResult with Method.get? I would have expected Method.trace, 
but I only spotted this by chance, could very well be my ignorance 
showing ^^


Http.onReceiveStatusLine
"...several callbacks can be done for on call to perform() because if 
redirections." -> "...several callbacks can be done for each call to 
perform() [because of | due to] redirections."


Http.authenticationMethod
std.etc.c.curl.AuthMethod? I think this is an issue with the XREF macro 
not expecting the link to break out of the std package.


Ftp.Result.encoding / Ftp.AsyncResult.encoding
I'm not sure what these functions are supposed to return, the 
descriptions seem inadequate.


---

Not fully read all the source yet, but as I'm not all that familiar with 
curl, I'm not sure I'll spot much ^^


Not a criticism, but at first glance, it doesn't feel very D-ey, but I'm 
still not 100% sure what idiomatic D is yet.


A...



Re: CURL review request

2011-08-16 Thread Alix Pexton

On 16/08/2011 12:48, Jonas Drewsen wrote:

Hi all,

This is a review request for the curl wrapper. Please read the "known
issues" in the top of the source file and if possible suggest a solution.

We also need somebody for running the review process. Anyone?

Code:
https://github.com/jcd/phobos/blob/curl-wrapper/etc/curl.d
Docs:
http://freeze.steamwinter.com/D/web/phobos/etc_curl.html

Demolish!

/Jonas


Spotted another issue...

In the example for Protocol.onReceive, there is a mismatch between the 
parameter names specified for the delegate and those used inside it.


Also, all the XREF macros point to std_curl.html. instead of 
etc_curl.html, is this going to become std.curl when incorporated into 
Phobos?


A...


Re: CURL review request

2011-08-16 Thread Alix Pexton

On 16/08/2011 17:38, Nick Sabalausky wrote:

"Alix Pexton"  wrote in message
news:j2dsq0$2aht$1...@digitalmars.com...


"...returns the number of elements in the buffer that has been filled and
is ready to send." ->  "...returns the number of elements in the buffer
that have been filled and are ready to send."



"in the buffer that has been filled" is correct. The "has" refers to "the
buffer" not the elements that have been put into it. And there's only one
buffer in question, so "has".

But yea, "is ready to send" should be changed to "are ready to send".


I suspected my edit was off in this case (from a technical point of 
view), but it is still poor use of English (imho). If the buffer has 
been "filled" then the return will equal its capacity, otherwise filled 
seems to be the wrong word. Perhaps changed "filled" to "written"?






"Asynchronous HTTP _WHATEVER_ to the specified URL." ->  "Performs a HTTP
_WHATEVER_ on the specified URL, asynchronously."


"Performs a HTTP" ->  "Performs an HTTP". The letter "H" may technically be a
consonant, but in this case it's read as the *name* of the letter, not the
letter's normal sound. And the name of H starts with a vowel sound (long A).
(Besides, "a HTTP" just sounds awkward.)

Also, little bikeshedding, but I think this would be better still:

"Performs an asynchronous HTTP _WHATEVER_ on the specified URL."



I played with this word order too, but I must admit the a/an thing snook 
through between many of my rewrites, good catch ^^


A...



Re: CURL review request

2011-08-16 Thread Alix Pexton

On 16/08/2011 20:44, jdrewsen wrote:

Den 16-08-2011 15:54, Alix Pexton skrev:


Protocol.onProgress represents transfer statistics using doubles?


That is what we get from libcurl


I'll let you off then, but just this once ^^


CurlTimeCond, members are all lower case, took me a few goes to work out
what they might mean, still not all that sure. Should I assume that if
the meanings are not obvious that I'm not ready to be tinkering with
curl at this level, or should each value be clarified?


I will include a link to the HTTP RFC that explains it.


Seems reasonable.


Http.addHeader / Http.setHeader both have the same description, I assume
the latter overwrites an existing value if it exists? what is the
behaviour of addHeader when the key already exists?


Added explanation and a link to HTTP RFC explaining sematics.


I read the source now, they do do as I expected, which made me wonder 
why there is no removeHeader, but I can't think of a reason to use 
removeHeader, so I won't suggest its addition ^^



Also, later examples are just marked as "Asynchronous version
of..." and lose the note about callbacks, which I assume still apply.)


The latter examples are trivial HTTP methods not sending or receiving
anything but the status codes are used. Therefore they do not need an
elaborate example as for the GET/POST/PUT methods.


Well, my honest thought as I read through it was that you were getting 
fed up of writing near identical documentation for each method and had 
started to cut corners. Can ddoc be used to add a section in front of 
these functions that outlines their common features? Making it a bit DRYer?



All callbacks are write only properties which prevents the use of event
hooking (which, in my experience, is a common occurrence in event based
models). Hooking might not apply in this case however (I've not
particularly thought through any use cases) and safe event hooking might
be beyond the scope of this module.


It is possible to provide read functionallity of the properties. The
only issue with this is that the delegate read would not be the same as
the one just written because it gets wrapped it the propery set call. I
don't know if this is a problem though?


Hmn, it could well be! I've not thought of a good use case yet though, 
so I'd recommend leaving it as it is for now, and if D gets an Events 
module in the future, the hooking issue can be revisited.



Ftp.Result.encoding / Ftp.AsyncResult.encoding
I'm not sure what these functions are supposed to return, the
descriptions seem inadequate.


I will try to improve the docs. They return the EncodingSchemes that is
used when reading the data

http://www.d-programming-language.org/phobos/std_encoding.html

The scheme is changed by using the encodingName property.


I looked at the code, and for a moment I though I got it, but I was wrong ><
from the source...

ref Result encoding(const(char)[] schemeName) {
rp._encodingSchemeName = schemeName;
return this;
}


I'm now guessing this is just for chaining?


Not fully read all the source yet, but as I'm not all that familiar with
curl, I'm not sure I'll spot much ^^

Not a criticism, but at first glance, it doesn't feel very D-ey, but I'm
still not 100% sure what idiomatic D is yet.


Maybe you're right. Whether it is a product of being a wrapper around an
existing library and thereby forcing some design decisions or by my
coding style I don't know.

If anyone can give some input as how to make it more D'ish please do.


The source, for the most part, does feel D'ish, so you must be doing 
something right, but there is no point in adding extra templates and 
custom ranges if there is no need. I'll have a stab at writing some code 
with it tomorrow, to see how the bits fit together in the wild.



Thank you the valuable feedback


No problem, I'm glad you found it so ^^

A...


Re: CURL review request

2011-08-16 Thread Alix Pexton

On 16/08/2011 20:55, jdrewsen wrote:

Den 16-08-2011 16:43, Alix Pexton skrev:

On 16/08/2011 12:48, Jonas Drewsen wrote:

Hi all,

This is a review request for the curl wrapper. Please read the "known
issues" in the top of the source file and if possible suggest a
solution.

We also need somebody for running the review process. Anyone?

Code:
https://github.com/jcd/phobos/blob/curl-wrapper/etc/curl.d
Docs:
http://freeze.steamwinter.com/D/web/phobos/etc_curl.html

Demolish!

/Jonas


Spotted another issue...

In the example for Protocol.onReceive, there is a mismatch between the
parameter names specified for the delegate and those used inside it.


you mean this one:

client.onReceive = (ubyte[] data) { writeln("Got data", cast(char[])
data); return data.length;};

I cannot identify the problem?


My mistake, I was in a hurry and mixed up the functions ><
This is the snippet in question (lines 414-417 in the source)


http.onProgress = delegate int(double dl, double dln, double ul, double ult) {
writeln("Progress: downloaded ", dln, " of ", dl);
writeln("Progress: uploaded ", uln, " of ", ul);
   };


The last parameter is named "ult", but the writeln is passed "uln", I 
think more descriptive names might help.


A...


How to Design a Good API and Why it Matters

2011-09-05 Thread Alix Pexton
I had a quick look through the archives to see if anything about this 
talk by Joshua Bloch had been posted before, but couldn't find any 
references. Here are the slides...


http://lcsd05.cs.tamu.edu/slides/keynote.pdf

I think I remember seeing a (poor quality) video of the presentation too.

I'd be interested to hear what people think of these guidelines and if 
anyone has any other good API design resources to share.


A...


Re: How to Design a Good API and Why it Matters

2011-09-05 Thread Alix Pexton

On 05/09/2011 13:11, Jacob Carlborg wrote:


Another good read is the book "Clean Code":
http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882




Thanks for the recommendation! Looks like an interesting read, but my 
cursory glance through the index on Amazon didn't alight upon anything 
that specifically applies to API design (feel free to point out anything 
I may have missed).  Might be worth the investment, as it seems to cover 
a lot of best practice for general coding, documenting and testing tasks ^^


Any others?

A...


Re: How to Design a Good API and Why it Matters

2011-09-05 Thread Alix Pexton

On 05/09/2011 14:44, Mirko Pilger wrote:

anyone has any other good API design resources to share.


http://www.amazon.com/API-Design-C-Martin-Reddy/dp/0123850037


At first I worried that this would be too C++ specific, but from what I 
have seen in the example pages the opening chapters at least are pretty 
general, with many ideas that are equally applicable to D and code that 
is (for C++) quite readable. The later chapters do seem to depend on C++ 
very heavily however, so while they might contain some patterns that D 
programmers can utilise or even improve upon, I suspect it may be harder 
to translate.


Anyone out there to second this recommendation?

A...


Re: Printing tuples

2011-09-06 Thread Alix Pexton

On 06/09/2011 19:24, Andrei Alexandrescu wrote:

sometimes we want to print "DSON"-formatted stuff without it being in an
array.

Andrei



If JSON stands for JavaScript Object Notation[1], then the D equivalent 
would surely be DON? I'm sure no prominent members of the community will 
mind and there would be absolutely no confusion ^^


A...

[1] see json.org, although I acknowledge that some people prefer to 
insert "Serialized".


Re: Formal Review of region allocator begins

2011-09-07 Thread Alix Pexton
1. The last part of the module description [lines 57-59 in the source] 
is a little hard to follow.


2. The description of out of memory behaviour in the ddoc for 
RegionAllocatorException [100-104] should be just one sentence, not two.


3. There is too much whitespace between the values of the GCScan enum ^^

4. I think there is a comma missing (or something) from the first XREF 
in the description of RegionAllocatorStack [131]


5. In the example for RegionAllocatorStack [152-174], I suspect it might 
be easier to follow if there were a comment highlighting that fun1 
passes stack to fun2.


	NB I also keep getting muddled between RegionAllocator and 
RegionAllocatorStack, as if my brain only differentiates identifiers by 
the first 15 characters, probably more an issue with me than the module ^^


6. ddoc for RegionAllocatorStack's constructor [84-186] should mention 
that it throws when passed 0 as the segment size.


7. docs for scanThreadLocalStack is vague about exception type (source 
on git hub appears to be correct, so I'll assume they are just out of 
sync, from here on I'll review the ddoc straight from the source).


8. examples for struct RegionAllocator [448-508] Is it possible to split 
this into 2 or 3 sub examples, to make it more clear that foo and bar 
are interdependent, but independent from the rest?


9. Note about large allocations [512-520] the last sentence about time 
considerations is a little clumsy, don't be afraid to to use big-O 
notation to make it clear what effects what.


10. resize [825...] Not sure if I like it returning a bool to denote 
success/failure, I think I'd prefer it to throw if the resize fails.


11. uninitializedArray [909...] ddoc seems a bit misleading, should 
perhaps be something like...

"Same as newArray, except skips initialization of elements for
occasions when greater performance is required."

12. alignBytes [939...] just has me stumped, the introduction says that 
16 byte alignment is guaranteed, so shouldn't this always return 16? I 
tried to follow the breadcrumbs through the source, but couldn't find 
where the value it returns is defined, only places where it is used/checked.


13. array [990...] I think this needs a more elaborate example that 
shows a full use case. Also, what happens if it is passed an infinite range?


And your GCAllocator bonus

14. The macro for array [137] is incomplete so nothing shows up in the 
ddoc output.


On the whole I think this module goes way over my head! I think some of 
my confusion originates from the naming of RegionAllocatorStack which, 
if I'm finally up to speed, is not a stack of RegionAllocators, but the 
actual stack which is being allocated from, in segments. I can 
understand why the module is not named SegmentAllocator, but nowhere is 
the term Region explained.


Is the restriction that only the most recently created RegionAllocator 
(for a given stack) can be used going to be universal across all 
allocator implementations? It doesn't seem to be the case for the 
GCAllocator, which makes me worry that some (future) Allocators will not 
be interchangeable, even though they share the same API. That being 
said, the only problematic scenarios that I can think of are rather 
contrived.


I hope some of that made sense, I suspect much of it may not ><

A...


Re: Formal Review of region allocator begins

2011-09-08 Thread Alix Pexton

On 07/09/2011 14:05, Alix Pexton wrote:


12. alignBytes [939...] just has me stumped, the introduction says that
16 byte alignment is guaranteed, so shouldn't this always return 16? I
tried to follow the breadcrumbs through the source, but couldn't find
where the value it returns is defined, only places where it is
used/checked.



Found it! 'twas just as I suspected, no idea how I missed it the first 
time ><


A...


Re: std.stdio overhaul by Steve Schveighoffer

2011-09-08 Thread Alix Pexton

On 08/09/2011 21:02, Andrei Alexandrescu wrote:

On 9/8/11 1:28 PM, Marco Leise wrote:

Am 08.09.2011, 18:52 Uhr, schrieb Simen Kjaeraas
:


On Thu, 08 Sep 2011 11:40:01 +0200, Sean Cavanaugh
 wrote:


In the COM based land for D3D, there is just a number tacked onto the
class name. We are up to version 11 (e.x. ID3D11Device). It works
well and is definitely nicer once you are used to it, than calling
everything New or FunctionEx, and left wondering what to do when you
rev the interface again


In the case of D3D though, D3D itself has a version number. The next
version
of std.xml will not be parsing XMLv2.0. When a version 2.0 of the XML
spec
shows up, what do we do about std.xml2, which parses version 1.1? And
what
do we call the new one? Should std.xml3 parse XMLv2.0?


That is late in the discussion, but a valid point.


Waiting for a suggestion from the XML experts.

Andrei


I'm not really an XML expert, but I do recall that the XML Core Working 
Group shelved there plans to develop "XML2.0". All enhancements that are 
in the pipeline are separate projects with their own acronyms.


IMHO, even if there were an XML2.0 spec, I don't think it would effect 
the naming of the module in Phobos, because I doubt very much it would 
introduce anything that would require a complete rewrite. std.xml2 could 
just be extended to support the new features of the spec in the context 
of its existing architecture. But it is probably a moot point.


A...


Re: clear()

2011-09-13 Thread Alix Pexton

On 13/09/2011 17:05, sclytrack wrote:

Rename "clear" to "blank" in D version 3.

Like blank a CD it is ready for writing but not ready for use. It is ready for 
use
after you have burned something on it. Unless you consider burning a CD using 
it.

blank();



 wipe(); //??

A...


Re: Possible bug with mixin and __traits(allMembers,T)

2011-09-15 Thread Alix Pexton

On 15/09/2011 06:56, Benjamin Thaut wrote:

The following program

mixin template Members(){
static int i1;
static int i2;
static int i3; //comment out to make func2 visible
static int i4; //comment out to make func1 visible
}

class Test {
mixin Members;

typedef void function() func1;
typedef bool function() func2;

static void init(){
foreach(m;__traits(allMembers,Test)){
pragma(msg,m);
}
}
}

int main(string[] argv)
{
return 0;
}

Gives me the output:
i1
i2
i3
i4
toString
toHash
opCmp
opEquals
Monitor
factory

If I comment out i4:
i1
i2
i3
func1
toString
...

And if I comment out i3 in addition to i4:
i1
i2
func1
func2
toString
...

Is this some new feature of mixin I'm missing, oder is this a bug?
Started to happen in dmd 2.055 does not happen with dmd 2.054



Moving the mixin to between the typedefs has the same effect as 
commenting out i4 (only the order of the members is different). Moving 
the mixin to after both typedefs has the same effect as commenting out 
both i3 and i4 (modulo change of order). I think that shows that it is 
definitely a bug and not a feature!


A...


Re: Formal Review of region allocator begins

2011-09-23 Thread Alix Pexton

On 23/09/2011 13:22, dsimcha wrote:


resize() will be changed to:

size_t resize(void* ptr, size_t minBytes, size_t nBytes);

where minBytes is the minimum amount to declare success and nBytes is
the desired amount.


and the value returned is the new size, which will always be between 
minBytes and nBytes?


A...


Re: Anonymous function syntax

2011-09-24 Thread Alix Pexton

What are the pros and cons of using "=>" rather than "->"?

In an ideal world we might be able to use the correct "rightwards arrow 
from bar" character (u+21A6), but I'm not suggesting we try to make one 
out of the characters we can type ("|->" looks terrible).


To my mind, "->" is somewhat closer to being mathematically correct, 
while "=>" reads as "implies", which is probably why lambdas in other 
languages have confused me.


Is there a lexical justification for choosing "=>" over "->"?

A...


Re: Formal Review of std.regex (FReD)

2011-10-09 Thread Alix Pexton
I've not had a proper look at the code yet, but I recall from when I 
read the docs during the pre-review period that the introduction was a 
little on the informal side. It doesn't seem to have changed since then, 
and IMHO the introduction/description needs a bit of a polish to bring 
it up to the standard that is required of official documentation.


I'll be busy over the next few weeks, but I will try to make time to 
assemble some more specific comments. I just wanted to let you know that 
I thought the docs needed some work, just in case.


A...


String Literal Docs

2010-06-19 Thread Alix Pexton
I've been sketching some grammar diagrams for D2.0, a little like those 
on JSON.org, and of course I didn't get far before I ran into something odd.


In the section of www.digitalmars.com/d/2.0/lex.html on string literals, 
the productions imply that the [c|w|d] "postfix" is allowed on Wysiwyg, 
DoubleQuote and Hex strings and not on either Delimited or Token 
strings, which didn't make a lot of sense to me, so I tested it with DMD 
(v2.046, win)...


---

import std.stdio;

void main(){
auto t1 = "double quote"d; // OK
auto t2 = `back tick`d;// OK
auto t3 = x"dead beef";// postfix not allowed on hexstrings!
auto t4 = q""d;// OK
auto t5 = q{if}d;  // OK

writefln("all literals A-OK!");
}

---

This makes sense to me, HexStrings with wide chars would have made my 
brain scream ><


So, to correct the documentation, the "postfix" needs to be removed from 
HexString and added to DelimitedString and TokenString.


I tried to see if this was already reporded in the bug tracker but 
couldn't see anything close.


On a slightly quieter note, there is also a spare underscore in the 
definition of HexidecimalDigit as it "extends" DecimalDigit which 
already has an underscore.


I also noticed a bug in the tracker related to initial underscores in 
float literals, if the diagrams start getting to puzzling I might look 
into that ^^


A...

PS, my copy of tDPL is in the post, yay!


Re: String Literal Docs

2010-06-20 Thread Alix Pexton

On 20/06/2010 01:09, div0 wrote:

On 19/06/2010 23:17, Ellery Newcomer wrote:


All I can say is

auto w = x"dead beef"w;

results in

Error: invalid UTF-8 sequence

on dmd 2.047


Then you've found a bug, you know what to do:

http://d.puremagic.com/issues/



Hmn, that would seem to indicate to me that the postfix is being allowed 
when the hex represents a valid UTF sequence, but not otherwise.


I didn't do too much testing myself as I know next to zilch about string 
internals ><


The text that describes hex strings says that they have to have an even 
number of digits, but this would seem to imply that they have to have a 
multiple of 4 or 8 for wstrings and dstrings respectively, which makes 
sense, but I'm not sure that can be verified in the lexing of a string 
literal without insane lookahead rules ><


But, then I guess that is why the spec says that hex strings are exempt 
from the valid UTF rule, and in that case hexstrings should really make 
byte arrays rather than strings, but failing that, always chars and not 
anything wider.


A...


Re: String Literal Docs

2010-06-20 Thread Alix Pexton

On 19/06/2010 22:16, Ellery Newcomer wrote:

On 06/19/2010 03:12 PM, Alix Pexton wrote:

I also noticed a bug in the tracker related to initial underscores in
float literals, if the diagrams start getting to puzzling I might look
into that ^^


What what?



Bug 2734 is the underscores in floats issue.

Bug 949 also has a shed full of replacement grammar rules that fix 
escape sequences and some coner cases in floats (and probably some other 
stuff too!)


A...


Re: String Literal Docs

2010-06-20 Thread Alix Pexton

On 19/06/2010 21:12, Alix Pexton wrote:

I've been sketching some grammar diagrams for D2.0, a little like those
on JSON.org, and of course I didn't get far before I ran into something
odd.



I think I will take the plunge and base my diagrams on the source of 
DMD. After looking at the code in lexer.c, it does not seem as far 
beyond my rusty old c++ parsing skills as I had expected! Massive credit 
to Walter for having a codebase that is as mature as DMD without it 
turning into a labyrinth of preprocessor macros and cryptic "comefrom"s.


This will mean however that my little project may take a little longer, 
sigh...


A...


Re: String Literal Docs

2010-06-20 Thread Alix Pexton

On 20/06/2010 20:14, Nick Sabalausky wrote:

"div0"  wrote in message
news:hvlok6$1rf...@digitalmars.com...

On 20/06/2010 18:55, Nick Sabalausky wrote:

"div0"   wrote in message
news:hvkrsc$2r5...@digitalmars.com...


It says multiple of 2, not even number of digits.


"multiple of 2" == "even number"

"Even" as in "even vs odd"


I also said 'To me that implies'. Please don't take what I said out of
context and be a smart arse about it. There's more than enough of that
goes on round here.



That wan't my intent, sorry if it came across that way. It sounded to me
like you were implying there was a difference between "multiple of 2" and
"even number". If that wasn't the case, then I guess I'm just not sure what
you were really getting at.




From looking at the source, I now know that all string literals can 
have a postfix, and that as far as lexing goes, all strings are in UTF8. 
I've not tracked down yet where the the value of the postfix is applied, 
but I'm fairly certain that it would be easy enough to turn off the UTF 
verification for the hexstrings at that end.


As far as making my diagrams, I don't think it matters, for now...

A...


Re: String Literal Docs

2010-06-20 Thread Alix Pexton

On 20/06/2010 21:37, Ellery Newcomer wrote:

On 06/20/2010 03:01 PM, Alix Pexton wrote:

On 19/06/2010 21:12, Alix Pexton wrote:

I've been sketching some grammar diagrams for D2.0, a little like those
on JSON.org, and of course I didn't get far before I ran into something
odd.



I think I will take the plunge and base my diagrams on the source of
DMD. After looking at the code in lexer.c, it does not seem as far
beyond my rusty old c++ parsing skills as I had expected! Massive credit
to Walter for having a codebase that is as mature as DMD without it
turning into a labyrinth of preprocessor macros and cryptic "comefrom"s.

This will mean however that my little project may take a little longer,
sigh...

A...


Do share. I've always been too lazy to read lexer.c, and from this
discussion, it sounds like there are a few spots where my own lexer
grammar is incorrect (or at least differs from dmd).



of course ^^

A...


Re: String Literal Docs

2010-06-21 Thread Alix Pexton

On 20/06/2010 22:46, Alix Pexton wrote:

On 20/06/2010 21:37, Ellery Newcomer wrote:

On 06/20/2010 03:01 PM, Alix Pexton wrote:

On 19/06/2010 21:12, Alix Pexton wrote:

I've been sketching some grammar diagrams for D2.0, a little like those
on JSON.org, and of course I didn't get far before I ran into something
odd.



I think I will take the plunge and base my diagrams on the source of
DMD. After looking at the code in lexer.c, it does not seem as far
beyond my rusty old c++ parsing skills as I had expected! Massive credit
to Walter for having a codebase that is as mature as DMD without it
turning into a labyrinth of preprocessor macros and cryptic "comefrom"s.

This will mean however that my little project may take a little longer,
sigh...

A...


Do share. I've always been too lazy to read lexer.c, and from this
discussion, it sounds like there are a few spots where my own lexer
grammar is incorrect (or at least differs from dmd).



of course ^^

A...


Well, I think I have got my head around lexer.c now, and its various 
peculiarities, like "000377." being a valid float (although not 
according to my shiny new, limited edition copy of tDPL (fig2.2 p35)^^).


The weirdness occurs because some of some corner cases are handled not 
by the neat little state state machine that validates reals, but in the 
scanner at the point where it recognises a number beginning with a zero. 
The productions in lex.html represent the range of inputs that are 
accepted by the state machine without taking into account that the 
scanner rejects the sequence "._" (which makes sense as that is the 
identifier "_" in the outer scope).


Andrei's analysis in tDPL also points out that 0xp0 is a valid hexfloat, 
but a strict reading of lex.html would not allow it.


Overall the diagram for hexfloat is much simpler than the one for 
decimalfloat, which I think will have to be split into 3 ><


A...

PS, octal must die!


Re: This just in: authorless TDPL becomes collector's edition

2010-06-21 Thread Alix Pexton

On 21/06/2010 20:23, Mike James wrote:

Got my "collectors item"  delivered today from Amazon UK. Looks good. I like
the bonus of being able to download a PDF version of TDPL.

Thanks for all the hard work Andrei.

-=mike=-

"Andrei Alexandrescu"  wrote in message
news:hu3hq6$2f0...@digitalmars.com...

Due to a pretty odd mistake at the printer, the first 1000 copies of TDPL
will not have the name of the author on their cover. (The name still
appears on the back cover and the spine.)

The history of printing is rife with rare printing mistakes that have
become collector's editions. Preorder now to be among the first 1000
readers who get the authorless TDPL edition.


Andrei




Mine arrived today too, yay, very pleasant reading so far.

Bit confused abgout the "free online edition" though, does it go *poof* 
after 45 days?


A...


Re: Errors in TDPL

2010-06-21 Thread Alix Pexton

On 21/06/2010 20:09, Jonathan M Davis wrote:

Okay. I am in no way trying to say anything negative about TDPL. In fact,
from what I've read so far, it's absolutely fantastic and quite possibly the
most entertaining programming book that I've read in addition to being quite
informative about D. However, no one's perfect (Andrei included), and there
are bound to be errors in the book which didn't get caught.

My thought was that we could point out any errors that we've found so that
Andrei can get them fixed in future printings and/or we can find out that
they aren't actually errors.

The only errors that I've found so far have been omissions in the list of
keywords on page 31. I'm listing them according to my understanding of
whether they're still keywords, since I think that some have been removed as
keywords or at least are no longer supposed to be keywords.

Definitely should be there
--
immutable
lazy
pure
nothrow
shared

I _think_ that it's supposed to be there

cent
ucent

I think that they might not supposed to be keywords anymore
---
cdouble
cfloat
creal
delete
idouble
ifloat
ireal
foreach_reverse

Everything under "definitely" appears to be used in TDPL as keywords but not
listed as them. cent and ucent aren't listed, but as far as I know are still
keywords (albeit not implemented yet). The ones that are missing which I
think have been removed are still listed in the online docs' list of
keywards but not in the book. IIRC, the c/i floating points got moved to
phobos; according to TDPL, delete was deprecated (though I hadn't picked up
on that); and I believe that foreach_reverse has been deprecated in favor of
using the combination of foreach and retro. So, TDPL is missing at least
some keywords in its list, and the online docs have too many.

In any case, I figured that it would be helpful if any errors in TDPL could
be pointed out, since it could be helpful to Andrei and could be helpful to
those reading it if the error isn't obvious. However, I certainly do _not_
want to in any way indicate displeasure with the book. It's quite good. It's
just that it does appear to have some errors in it that snuck through.

- Jonathan M Davis


Good Idea!

I must admit I skipped over that table, didn't look overly interesting 
as tables go (><) but good catch!


There is only one mention of lazy evaluation in the index and it doesn't 
mention the lazy k/w at all. I seem to remember Andrei dislikes it, but 
also that there is another way to get function params to be evaluated 
lazily without using it.


immutable, nothrow, pure and shared are definitely oversights though.

I've not spotted anything D-specific myself yet, I'm not a particularly 
speedy reader ^^


A...


Re: String Literal Docs

2010-06-21 Thread Alix Pexton

On 21/06/2010 21:20, Ellery Newcomer wrote:


Are your diagrams solely concerned with the lexer? Because I have a
(messy) parser grammar which I'm a bit more confident about if you're
interested.


So far I have only covered the lexer, but most of it needs redoing in 
light of the errors in the DMD docs, but I am hoping to cover the whole 
spec, eventually...


The more I do the quicker I'm able to make them as my workflow evolves, 
so its hard to say how long it will take...


A...


Re: Errors in TDPL

2010-06-22 Thread Alix Pexton

On 21/06/2010 21:51, Tomek Sowiński wrote:

Dnia 21-06-2010 o 21:57:49 Alix Pexton 
napisał(a):


There is only one mention of lazy evaluation in the index and it
doesn't mention the lazy k/w at all. I seem to remember Andrei
dislikes it, but also that there is another way to get function params
to be evaluated lazily without using it.


Yeah, speaking of which - what happened to that proposal*?

*The proposal AFAIR was (correct me if wrong): if a function has a
parameterless delegate as a parameter, then on the call site any
expression in the delegate slot is implicitly turned into a delegate. I
think the delegate ought to be pure to make the magic happen.

Yeah, speaking of which - do/will we have pure delegates?


Tomek


This is the "trick" I was refering to, from a post by the programmer 
formerly known as downs...


Amusing D facts: typesafe variadic arrays are lazy!
>
> Did you know the following code compiles?
>
> > > module test;
> > >
> > > import std.stdio;
> > >
> > > void Assert(bool cond, string delegate()[] dgs...) {
> > >   debug if (!cond) {
> > > string str;
> > > foreach (dg; dgs) str ~= dg();
> > > throw new Exception(str);
> > >   }
> > > }
> > >
> > > void main() {
> > >   Assert(false, "O hai thar! ");
> > > }
>
> It's true! :)

A...


Re: Errors in TDPL

2010-06-23 Thread Alix Pexton

On 23/06/2010 16:24, Andrei Alexandrescu wrote:

On 06/23/2010 02:11 AM, Rick Trelles wrote:

Saving a keystroke, if it is in sound and clear way, is a plus.
At least the option to save the keystroke should be maintained.

I don't see now any advantages in using a pair of braces over a single
semicolon for a null statement, but why not keep it both ways?


We've all seen that requiring "{}" after the likes of if, while etc. are
very beneficial for readability. Then why not generalize that? As far as
I can tell the only vestigial use of the lone ";" is with labels that
don't precede any instruction (a very rare case). At this point, ";"
needs more justification to stay than to go.


I never liked the semicolon after while() but surely it wouldn't hurt to
interpret it as a null statement for those who are used to it.

By the way, I always glue the closing bracket to while

do{

. . .

}while( . . . ) // plus ";" if coding in C


Rick Trelles


That's great, except for those who enjoy "brace on its own line"
formatting style. For those, the "}while" would look jarring.

Andrei



I find that the "}while(..." style is the best way to highlight that you 
are looking a a do...while and not a regular while loop, that it is 
jarring is exactly the point ^^


Making the the semicolon on the end a requirement helps if you are 
familiar with D and know it is not allowed on a regular while, but the 
less enlightened might see a classic bug pattern where there isn't one 
and try to "maintain" it away ><


In some ways I think it was a mistake in to reuse while in the first 
place, but that was a decision that was made a loong time before D...


A...


Re: Errors in TDPL

2010-06-23 Thread Alix Pexton

On 23/06/2010 17:51, Andrei Alexandrescu wrote:

On 06/23/2010 11:40 AM, Walter Bright wrote:

Jonathan M Davis wrote:

Well, while I, personally, would put a semicolon there (it feels naked
to me without one), dmd doesn't actually seem to require it. But TDPL
says that the semicolon is required. So, it does appear to be an error
in the text. Of course, there's no helping his pet peeve regardless,
but the semicolon doesn't appear to be required.


For reference for this discussion, the current grammar does not
require it:

http://www.digitalmars.com/d/2.0/statement.html#DoStatement

The C grammar does require it:

do statement while ( expression ) ;


I mistakingly assumed D followed C in that regard. Given the argument
stated in this thread (that absent semicolons require more context to be
absorbed while reading), do you agree that D should make the semicolon
required?

Andrei


++vote

A...


Re: Errors in TDPL

2010-06-24 Thread Alix Pexton

Can someone sanity check me on the code on pages 334-5?

Does the method push really need !empty in its in contract?

I might not be fully awake yet ><

A...


Re: Errors in TDPL

2010-06-24 Thread Alix Pexton

On 24/06/2010 09:09, Jonathan M Davis wrote:

Alix Pexton wrote:


Can someone sanity check me on the code on pages 334-5?

Does the method push really need !empty in its in contract?

I might not be fully awake yet><

A...


It has to be an error. If you couldn't push onto an empty stack, then you'd
never be able to put anything on the stack.

- Jonathan M Davis


That's what I thought, but it's there in the example over the page as 
well, so I though maybe I was missing something ><


A...


Re: Errors in TDPL

2010-06-24 Thread Alix Pexton

Does anyone else feel that the following is a fair clarification?

Page 396
...
	This means that communicating processors "forget" the exact order in 
which data was written: one tread writes x and then y and for a while 
another thread sees the new y but only the old x.


vvv

	This means that communicating processors "forget" the exact order in 
which data was written: one tread writes to x and then to y and for a 
while another thread sees the new value of y but only the old value of x.


...


Once I got my head around what is being claimed, I realised that it is 
correct as it appears, but it took me several reading to get there. It 
might just be because I'm a bit of a concurrency novice, but I'm sure 
I'm not the only one with a copy of tDPL ^^


A...


  1   2   >