Re: parallelFuture

2009-10-23 Thread Christopher Wright

Andrei Alexandrescu wrote:

dsimcha wrote:

Again, code:

http://dsource.org/projects/scrapple/browser/trunk/parallelFuture/parallelFuture.d 



Docs:

http://cis.jhu.edu/~dsimcha/parallelFuture.html


What license is the library under?

Andrei


Boost. I suppose you didn't want to look at the source in case the 
license wasn't sufficiently liberal, but it's easy enough to scan 
through the module's doc comments for a license block, without reading 
the source code.


Re: Serialization for D. Comments, please!

2009-06-11 Thread Christopher Wright

grauzone wrote:

Is there any real reason for all those mixins?



which ones?


All used by the user. That would be Serializable and SerializableRecuring.


Also, what is curing in this context, and why would you need to do it 
multiple times?


Re: dmd 1.045 / 2.030 release

2009-05-12 Thread Christopher Wright

Leandro Lucarella wrote:

Walter Bright, el 12 de mayo a las 09:40 me escribiste:

Tomas Lindquist Olsen wrote:

Is there a reason for the missing announcement ?

Yes, I sent it to people who'd asked for a prerelease so they could
check their builds against it.


I think a better way to do prereleases is to do a full release but mark
it as a release candidate.

For example, make a DMD 1.045rc release. Wait a week, if nobody complains,
release DMD 1.045. If somebody complains, fix the bug, make a DMD
1.045rc2, etc (normally the final would be the same as the rc, and there
should be very rare cases where a rc2+ would be needed). Maybe it's
a little more work, but I'm sure the prerelease will get a lot more
testing than a hidden release and people won't get confused thinking that
something that is in the website ready for download and looks like a final
release, really is a hidden prerelease.

Anyways, I think pre-releasing is great and it's better to have it this
way than not having them at all.


-rc is good when you have long release cycles. It isn't appropriate for 
dmd, which has very short release cycles.


If dmd had public source control, we could set up continuous integration 
for it that will, for instance, run dstress and attempt to compile the 
latest release of various common libraries. Then Walter can just check 
its results when he wants to do a release -- depending on how long that 
takes to run.


Re: Slide design

2009-05-05 Thread Christopher Wright

Simen Kjaeraas wrote:
On Mon, 04 May 2009 20:47:10 +0200, Sean Kelly s...@invisibleduck.org 
wrote:


== Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s 
article


I don't agree. I think there is much more at work here. Slides are
limited in size and text content simply because there is so much
information a person can absorb simultaneously by hearing and seeing. So
the slide with text is simply an anchor, a high-level memento to rest
one's eyes on, while the speaker gives some detail pertaining to the
high-level points that the slide makes.


For lectures I basically have a choice between two options:

1. Take notes and not remember a darn thing that was said.
2. Not take any notes and remember the lecture.


I'm fond of using the third option: Not take notes unless something
unexpected pops up.
I tend to use notes for remembering things I will look up later,
not for learning directly.


I take notes so that I will remember what was said five minutes prior. I 
never review notes after the lecture, but during, it helps me work 
through the examples given, at my own rate, and change the notation used.


For example, I was at a compilers lecture and took twenty minutes to 
understand a parsing example. Then I changed the notation slightly in my 
notes (the professor was using states 1, 2, 3, ... and rules 1, 2, 3, 
...; I changed the states to be S1, S2, S3, ... and the rules to be R1, 
R2, R3, ...) and suddenly everything became a lot clearer.


Re: Titanion 0.4

2009-04-28 Thread Christopher Wright

Moritz Warning wrote:

Titanion is a 2.5D shooter game for Windows, *nix and MacOSX.

The original code by Kenta Cho was ported to use Tango and Derelict.
This made it possible to create binaries for different platforms
and is what this 0.4 release is about.

The code was also put on sourceforge.net to make it easier for 
contributers to participate.



http://titanion.sourceforge.net


Have fun,
Moritz Warning


I played it a bit, and it's fun. Though I'd like changing scenery and 
ship upgrades :)


Re: dmd 2.029 release

2009-04-27 Thread Christopher Wright

Walter Bright wrote:

Georg Wrede wrote:

Walter Bright wrote:

Lutger wrote:

what the hell...this code can't be human.


I was replaced by Colossus years ago.


Michael A. Jackson wouldn't approve 1175 gotos in 113 files.



I see I was being too obscure.
See Colossus, the Forbin Project http://us.imdb.com/title/tt0064177/


To clarify: you are *not* 80 feet high and protector of Rhodes?


Re: dmd 2.029 release [OT]

2009-04-24 Thread Christopher Wright

BCS wrote:
I guess if you 
really hate having it not kill the app then the program could just not 
/have/ a x button.


Your window manager does not support such windows.


Re: dmd 2.029 release

2009-04-23 Thread Christopher Wright

Andrei Alexandrescu wrote:
Yes. The way it should be is not with sink, but with the standard output 
iterator method put().


void streamOut(T, R)(T object, R range)
{
foreach(x; a) range.put(x);
range.put(b);
range.put(c);
}


// object.d
class Object
{
void streamOut(R)(R range);
}

No?


Re: ACCU conference

2009-04-22 Thread Christopher Wright

Georg Wrede wrote:

Walter Bright wrote:

I'm off to speak at it!

http://accu.org/index.php/conferences/accu_conference_2009/accu2009_speakers 



Next time you come over to the Old World, why not fly back a day later. 
Then a few of us might get together. A mini D-meeting wouldn't hurt. It 
could be interesting and fun!


Nor would a MiniD meeting.


TypeInfoEx: it's here!

2009-04-18 Thread Christopher Wright

Hello everyone,

I have created TypeInfoEx, a clone of Jascha Wetzel's ClassInfoEx.

Quick info:
Support: D2 / Phobos
License: any license that is used by Phobos or Tango
Status: alpha at best
Download: svn co http://felt-project.org/reflect/trunk

Bugs:
 - The type 'real' is not supported. (fst my_real doesn't work; I don't 
know the asm operation to store an 80-bit real.)

 - Functions that return structs are not supported.
 - Constructors are not supported :(
 - Complex types are not supported, because I'm lazy.
 - The whole deal is poorly tested.

Supported operations:
 - Creating XRTTI for any user-defined type (including library types 
that you don't control)

 - Listing fields of a type
 - Listing member functions of a type
 - Extracting fields from an object or struct
 - Invoking methods on an object or struct

Operations that really should be supported but have been overlooked for now:
 - Setting fields
 - Invoking methods with an array of variants for arguments rather than 
D varargs (ironic since I switched from std.boxer to homegrown variant 
in order to support this)



So, download it, ridicule the crufty code, and curse its shortcomings. 
But if you do, tell me what you would like to have changed, plx. I'll be 
working on it in any case, but your feedback is appreciated.

svn co http://felt-project.org/reflect/trunk


Re: Tango 0.99.8 Sean released

2009-03-28 Thread Christopher Wright

Nick Sabalausky wrote:
Lars Ivar Igesund larsi...@igesund.net wrote in message 
news:gqkpm7$2ci...@digitalmars.com...
The CSS and DDoc macro's are in SVN, I think most of what you mention can 
be

fixed via that so feel free to suggest patches. A note on fonts; I think
none are currently specified meaning that what you see are the browswer
defaults.



The only font I have a problem with is the one used for the function 
signature. It looks like some sort of typewriter font and definitely isn't 
my browser's default. (Although I suppose it might be my default monospace 
font and just looks weird when scaled up and bolded...In fact, glancing at 
the HTML/CSS right now, I think that is the case.) 


I've been annoyed with this in the past. These days, I let websites 
choose serif, sans serif, or monospace; but only I choose which fonts 
those map to. If your website asks for Helvetica or Arial, it's getting 
Cronos. If it asks for Times, it gets Chaparral. And so forth.


In Firefox, under the Content tab of the preferences window, look at the 
Fonts  Colors group and press Advanced. There is a checkbox that 
controls whether websites' preferences for fonts will be honored.


Re: DAllegro 4.2.2.1 release

2009-03-28 Thread Christopher Wright

torhu wrote:
Since there's still some interest in this project, I'm making a release. 
DAllegro enables the use of Allegro 4.2.2 with the D programming 
language.  Allegro is a game programming library written in C.


Project page: http://www.dsource.org/projects/dallegro
Downloads: http://www.dsource.org/projects/dallegro/wiki#Downloads
Allegro: http://www.talula.demon.co.uk/allegro/

Here's the changelog:

- Compatibility with DMD 1.041 and 2.026.
- Compatibility with Tango 0.99.7 and 0.99.8, and some older versions.
- Support for building examples etc. with DSSS (Windows only for now).
- Minor tweaks to DBlocks.

I wasn't able to test on OS X, but hopefully it'll still work there. 
DAllegro probably won't work with DMD on OS X, though. No idea about the 
LDC compiler either. So GDC is the only option, unless someone with a 
Mac wants to help out. :)


Awesome. I'm taking a look.


Re: Descent 0.5.4 released

2009-03-23 Thread Christopher Wright

Jarrett Billingsley wrote:

On Sat, Mar 21, 2009 at 7:23 PM, Saaa em...@needmail.com wrote:

Poseidon has 7 (custom) groups of keywords which have different colours.
eg. import=orange, static=green, void=blue, this=purple
To me it makes source much easier to navigate.


Honestly I don't know how people can cope with that.. if you use 30
colors, don't they stop having meaning?  :|


Yes, but they make me feel better, especially with a blue / mint green 
color scheme.


Re: The new DWT2

2009-03-21 Thread Christopher Wright

Frank Benoit wrote:

Now there is the new hg repository for DWT2.

DWT2 is like dwt-win/linux/addons, but the folders are organized in the
original directory structure of the Eclipse sources. This also means the
packages are again like the original.

DWT.CENTER =
SWT.CENTER

import dwt.widgets.Button; =
import org.eclipse.swt.widgets.Button;


Wow, that's like twelve extra characters. I did want to try this out, 
but I already have gtkd, and that lets me just import gtk.Button.


It shouldn't be too hard to write a script that would generate files of 
the type:

module dwt.Button;
public import org.eclipse.swt.widgets.Button;


Re: The new DWT2

2009-03-21 Thread Christopher Wright

torhu wrote:

On 21.03.2009 14:08, Christopher Wright wrote:

Frank Benoit wrote:

 Now there is the new hg repository for DWT2.

 DWT2 is like dwt-win/linux/addons, but the folders are organized in the
 original directory structure of the Eclipse sources. This also means 
the

 packages are again like the original.

 DWT.CENTER =
 SWT.CENTER

 import dwt.widgets.Button; =
 import org.eclipse.swt.widgets.Button;


Wow, that's like twelve extra characters. I did want to try this out,
but I already have gtkd, and that lets me just import gtk.Button.



It's a bit annoying, but seems like the right thing to do.  I'll 
probably just type it once for each file, then use my editor's 
'duplicate line' feature for the rest.  That's what I've been doing 
already anyway.


It's well motivated from a development standpoint. I don't see what it 
contributes, otherwise.


Re: dunit r247

2009-03-19 Thread Christopher Wright

bearophile wrote:

Christopher Wright:

Having other testing frameworks/tools for D is good. There are many kinds of 
testing, and the built-in one isn't supposed to implement them all.

Regarding the issues of unit testing with unittest{}, I think the built-in 
unittesting has to be improved, to removed some of such issues. I am not 
looking for an universal and perfect built-in unittesting, and I think the 
built-in unittesting has to be kept simple, but the following things have to be 
fixed, maybe Walter will eventually understand why they are important:
- Unittests are not labeled.
- There is no output that specifically indicates that the tests were run.
- A failing test will prevent any other tests from running. 
- There is no indication of which test failed, if any.

Such things are bare-bone functionality for any unit testing system.
And I'd like to add a way to unittest at compile time too, to test types, 
templates, etc. (Until few weeks ago I didn't know any way at all to do this, 
then someone has given me a hint).


What are you using for this? __traits(compiles) works for d2, to an 
extent, and for d1, is (typeof(expression)). But for templates that have 
to be mixed into some context, that's more tricky.



What's the advantage of:
expect(foo(5), equals(3) | greaterThan(5));
Compared to:
expect(foo(5) == 3 | foo(5)  5);


What error message should that give?

The former gives:
Expected: equal to 3 or greater than 5
But was: whatever value foo(5) returned

The latter gives:
Assertion error


If you write Dunit tests in separate modules, while your production code doesn't 
include dunit, you cannot test private methods. Dunit encourages the practice of 
separating tests and modules.


For me it's often better to keep tests very close to the things they test. It 
helps me spot and fix bugs faster, to avoid jumping across files, and when I 
quickly move a block of code (function, class, template, etc) when I reorganize 
the code it is less likely for me to lose its tests along the way. I think 
tests are a part of a function/class/template, just like its ddocs.


I believe that there is a benefit to keeping the tests close to the 
tested code. I have not noticed a significant lack, however, when using 
junit or nunit.



Bye,
bearophile


dunit r247

2009-03-18 Thread Christopher Wright

Hi all,

I've released a new version of dunit, r247. (I have finally decided on
subversion revision numbers as a simple, unambiguous versioning scheme).
It's recommended for immediate use and is certified alpha-quality software.

Documentation and Downloads
---
Documentation is included in the .zip file and also on the wiki.
Docs: http://dsource.org/projects/dmocks/wiki/DUnit
Download: 
http://dsource.org/projects/dmocks/browser/downloads/dunit.r247.zip?format=raw


Assertions
--
The major production-ready element of dunit is a greatly-tweaked
assertion system. There are minor API changes; in general, you can convert:
expect(value).constraint;
to:
expect(value, constraint);

Additionally, you can combine constraints using | or :
expect(6, equals(3) | greaterThan(5));

Additionally, it is much more reasonable to add additional messages to
an assertion:
expect(foo(), lessThan(5), foo is being mean again!);

The assertions system is now extensible; deriving from
dunit.assertions.model.Constraint will allow you to use your constraint
as if it were a regular, builtin constraint.

Parameterized tests
---
A parameterized test is one that uses data generated externally. Dunit
now supports parameterized testing. The builtin parameterization systems
are combinatorial and sequential, with test data generators for random
and sequential integers and floating point values.


Re: Blaze 2.0

2009-03-16 Thread Christopher Wright

Mason Green wrote:

Blaze 2.0, a 2D game physics engine based on Box2D, is finally here.  The 
testBed examples have been completely overhauled with Hybrid and Dog!

Project page:
http://www.dsource.org/projects/blaze/wiki/WikiStart

Testbed examples (win32 binary):
http://svn.dsource.org/projects/blaze/downloads/blazeDemos.zip

I've taken a stab at writing a `getting started` section on the wiki, with 
clear (hopefully) instructions on how to compile. Comments, suggestions, 
contributions, and bug reports are appreciated in the dsource forum.


Just the place for a Blaze! the Bellman cried,
As he landed his crew with care;
Supporting each man on the top of the tide
By a finger entwined in his hair.

Just the place for a Blaze! I have said it twice:
That alone should encourage the crew.
Just the place for a Blaze! I have said it thrice:
What I tell you three times is true.


Re: Open source dmd on Reddit!

2009-03-13 Thread Christopher Wright

Nick Sabalausky wrote:
Walter Bright newshou...@digitalmars.com wrote in message 
news:gpc2ik$2t8...@digitalmars.com...

Nick Sabalausky wrote:
That's one thing that's kind of nice about Japanese. Native words and 
loanwords are written in different alphabets (sort of like uppercase vs 
lowercase), so unlike English, you generally know if a word is a 
properly-pronounced native word or a potentially-differently-pronounced 
loanword. (Not that this is necessarily the original reason for the 
separate native/foreign alphabets, but it's at least a nice benefit.)
I don't see having 3 alphabets as having some sort of compelling advantage 
that remotely compares with the cost of learning 3 alphabets and 3 
spellings for everything.


Native Japanese words never use the Katakana alphabet, and loanwords never 
use the Hiragana alphabet (those are the two phonetic alphabets).


There are situations in Japanese where you use katakana natively. 
Onomatopoeia, for instance, and company names.


I know that, when introducing someone's name in writing, an author will 
sometimes follow the kanji version of the name with a phonological 
representation of the name. Does this typically use hiragana, or would 
you use katakana for that as well?


Re: rdmd

2009-03-07 Thread Christopher Wright

Okay, here's an improved version of rdmd with config files.

Added features:
- Config file
  - Specify a compiler
  - Specify default imports for --eval
  - Specify build flags
- Option to show source with --eval
- Changed the definition of main with --eval to use 'in char[][]' 
rather than 'string[]' (the args probably don't matter much anyway)
- Executables are stored in the temp directory, not the current 
directory. This way, they can be reused even if you change directories; 
and they don't clutter up your working directory.


Attached is a sample rdmd.conf as well as the modified source (based on 
r958 from the phobos repository).
// Written in the D programming language.

/*
 *  Copyright (C) 2008 by Andrei Alexandrescu
 *  Written by Andrei Alexandrescu, www.erdani.org
 *
 *  This software is provided 'as-is', without any express or implied
 *  warranty. In no event will the authors be held liable for any damages
 *  arising from the use of this software.
 *
 *  Permission is granted to anyone to use this software for any purpose,
 *  including commercial applications, and to alter it and redistribute it
 *  freely, subject to the following restrictions:
 *
 *  o  The origin of this software must not be misrepresented; you must not
 * claim that you wrote the original software. If you use this software
 * in a product, an acknowledgment in the product documentation would be
 * appreciated but is not required.
 *  o  Altered source versions must be plainly marked as such, and must not
 * be misrepresented as being the original software.
 *  o  This notice may not be removed or altered from any source
 * distribution.
 */

import std.getopt, std.string, std.process, std.stdio, std.contracts, std.file,
std.algorithm, std.iterator, std.md5, std.path, std.regexp, std.getopt,
std.c.stdlib, std.date, std.process;

private bool chatty, buildOnly, dryRun, force, showSource;
private string exe, compiler = dmd;
// TODO: should we use these imports as a matter of convenience
// in all scripts, not just --eval scripts?
private string imports;
private string flags;

// For --eval
immutable string importWorld = 
import std.stdio, std.algorithm, std.array, std.atomics, std.base64, 
std.bigint, std.bind, /*std.bitarray,*/ std.bitmanip, std.boxer, 
std.compiler, std.complex, std.contracts, std.conv, std.cpuid, std.cstream,
std.ctype, std.date, std.dateparse, std.demangle, std.encoding, std.file, 
std.format, std.functional, std.getopt, std.intrinsic, std.iterator, 
/*std.loader,*/ std.math, std.md5, std.metastrings, std.mmfile, 
std.numeric, std.openrj, std.outbuffer, std.path, std.perf, std.process, 
std.random, std.range, std.regex, std.regexp, std.signals, std.socket, 
std.socketstream, std.stdint, std.stdio, std.stdiobase, std.stream, 
std.string, std.syserror, std.system, std.traits, std.typecons, 
std.typetuple, std.uni, std.uri, std.utf, std.variant, std.xml, std.zip,
std.zlib;;

int main(string[] args)
{
//writeln(Invoked with: , map!(q{a ~ , })(args));
if (args.length  1  std.string.startsWith(args[1], --shebang ))
{
// multiple options wrapped in one
auto a = args[1][--shebang .length .. $];
args = args[0 .. 1] ~ split(a) ~ args[2 .. $];
}

// Continue parsing the command line; now get rdmd's own arguments
// parse the -o option
void dashOh(string key, string value)
{
if (value[0] == 'f')
{
// -ofmyfile passed
exe = value[1 .. $];
}
else if (value[0] == 'd')
{
// -odmydir passed
// add a trailing path separator to clarify it's a dir
exe = std.path.join(value[1 .. $], );
assert(std.string.endsWith(exe, std.path.sep));
}
else if (value[0] == '-')
{
// -o- passed
enforce(false, Option -o- currently not supported by rdmd);
}
else
{
enforce(false, Unrecognized option: ~key~value);
}
}

// start the web browser on documentation page
void man()
{
foreach (b; [ std.process.getenv(BROWSER), firefox,
sensible-browser, x-www-browser ]) {
if (!b.length) continue;
if (!system(b~ http://www.digitalmars.com/d/2.0/rdmd.html;))
return;
}
}

// set by functions called in getopt if program should exit
bool bailout, loop;
string eval;
getopt(args,
std.getopt.config.caseSensitive,
std.getopt.config.passThrough,
std.getopt.config.stopOnFirstNonOption,
build-only, buildOnly,
chatty, chatty,
dry-run, dryRun,
force, force,
show, (string) { showSource = true; },
help, (string) { writeln(helpString); bailout = true; },
man, (string) { man; bailout = true; },

Re: rdmd

2009-03-07 Thread Christopher Wright

Andrei Alexandrescu wrote:

Christopher Wright wrote:

Okay, here's an improved version of rdmd with config files.


Thanks, that's interesting.


Added features:
- Config file
  - Specify a compiler
  - Specify default imports for --eval
  - Specify build flags


I'm sorry, I think a config file is overkill. Perl has many more options 
and does fine without any configuration besides the envvar PERL5LIB.


But indeed there must be a possibility to veer away from the hardcoded 
imports.


It depends on whether --eval is going to be used to any reasonable 
degree. I don't think it is, so config files are overkill.



- Option to show source with --eval


Sounds good.

- Changed the definition of main with --eval to use 'in char[][]' 
rather than 'string[]' (the args probably don't matter much anyway)


in char[][] is the worst of the pack because it's the supertype of both 
immutable and mutable. You're better off with either string[] or char[][].


But tango doesn't deal with string.

You could add at the top:
static if (!is (string)) alias char[] string;

- Executables are stored in the temp directory, not the current 
directory. This way, they can be reused even if you change 
directories; and they don't clutter up your working directory.


That's a good idea.


When I saw that rdmd put the executable with an insanely long name in my 
working copy, I was quite annoyed.


Attached is a sample rdmd.conf as well as the modified source (based 
on r958 from the phobos repository).


Thanks. Let's hold off on that for a bit until we all have the same phobos.


The only difference due to different phoboses is using FILE* rather than 
struct File.


Re: Open source dmd on Reddit!

2009-03-07 Thread Christopher Wright

Gregor Richards wrote:
I realize people are going to misuse the term Open Source. However, the 
term is NOT generic, and DOES have a specific meaning; it is in fact 
trademarked, and using it to describe software that does not fit the 
Open Source Definition is in violation of the trademark. But more 
importantly than that, it's confusing to the loads of people out here 
who use F/OSS and depend on the freedoms it provides. Without 
redistribution rights, F/OSS is substantially less valuable, as it 
doesn't provide any escape if the original creator loses interest, 
spontaneously combusts, decides he hates giving away his source and 
closes it again, etc, etc, etc.


I've heard the term 'disclosed source' before, in the context of various 
Microsoft products where the source code is available but not 
redistributable. It's as good a choice as any.


Re: dmd 1.041 and 2.026 releases

2009-03-06 Thread Christopher Wright

Nick Sabalausky wrote:
hasen hasan.alj...@gmail.com wrote in message 
news:gophel$2vj...@digitalmars.com...

Don wrote:

Haruki Shigemori wrote:

Don :
On Windows, it compiles, but I can't get it to link. The errors are all 
related to malloc-family functions.

As far as I know, that's the first time I've ever  something.


? [kakimashita] - wrote
*don't try to pronounce it in English because it's *not* ka-kee-mashii-ta 
:P


In other words, the i from the shi generally gets dropped in cases like 
this. (There isn't anything else about the pronunciation I'm unaware of, is 
there?) 


It's elided completely these days? I was aware that high vowels became 
voiceless between voiceless consonants, but this is new. It does sound 
about right, but I'm not used to hearing voiceless vowels, so it's a bit 
hard for me to distinguish.


Re: rdmd

2009-03-05 Thread Christopher Wright

Andrei Alexandrescu wrote:

Georg Wrede wrote:

Should I be able to

$ rdmd --eval='printf(Yay, rdmd!)'



Yah. For my money, I can't fathom working in D without rdmd. Now with 
--eval and passable regexes it's even better because I can easily do 
tasks (from shell files) that would take longer in Perl.


Since the current source uses the not-yet-released phobos, I wanted to 
attach a binary so you can try it, but it's too big for the news server.



Andrei


It would be nice to have a config file that lets me specify the default 
imports and compiler (though this would make it slower). I can send you 
a patch for this, but I can't seem to build rdmd without modifications; 
it requires a struct File that has a method popen(string). I can change 
File to FILE* and make a few minor changes to get it to compile, which 
is what I did.


Anyway, my modifications look for a config file:
in /etc/
in /usr/local/etc
in the exe directory

Currently it just looks for default imports and the compiler name. Other 
things to add are compiler flags, and maybe dsss support.


The solution for getting the exe directory isn't included in phobos, as 
far as I could tell. Perhaps you'd like to change that.
// Written in the D programming language.

/*
 *  Copyright (C) 2008 by Andrei Alexandrescu
 *  Written by Andrei Alexandrescu, www.erdani.org
 *
 *  This software is provided 'as-is', without any express or implied
 *  warranty. In no event will the authors be held liable for any damages
 *  arising from the use of this software.
 *
 *  Permission is granted to anyone to use this software for any purpose,
 *  including commercial applications, and to alter it and redistribute it
 *  freely, subject to the following restrictions:
 *
 *  o  The origin of this software must not be misrepresented; you must not
 * claim that you wrote the original software. If you use this software
 * in a product, an acknowledgment in the product documentation would be
 * appreciated but is not required.
 *  o  Altered source versions must be plainly marked as such, and must not
 * be misrepresented as being the original software.
 *  o  This notice may not be removed or altered from any source
 * distribution.
 */

import std.getopt, std.string, std.process, std.stdio, std.contracts, std.file,
std.algorithm, std.iterator, std.md5, std.path, std.regexp, std.getopt,
std.c.stdlib, std.date, std.process;

private bool chatty, buildOnly, dryRun, force;
private string exe, compiler = dmd;
string imports;

// For --eval
immutable string importWorld = 
import std.stdio, std.algorithm, std.array, std.atomics, std.base64, 
std.bigint, std.bind, /*std.bitarray,*/ std.bitmanip, std.boxer, 
std.compiler, std.complex, std.contracts, std.conv, std.cpuid, std.cstream,
std.ctype, std.date, std.dateparse, std.demangle, std.encoding, std.file, 
std.format, std.functional, std.getopt, std.intrinsic, std.iterator, 
/*std.loader,*/ std.math, std.md5, std.metastrings, std.mmfile, 
std.numeric, std.openrj, std.outbuffer, std.path, std.perf, std.process, 
std.random, std.range, std.regex, std.regexp, std.signals, std.socket, 
std.socketstream, std.stdint, std.stdio, std.stdiobase, std.stream, 
std.string, std.syserror, std.system, std.traits, std.typecons, 
std.typetuple, std.uni, std.uri, std.utf, std.variant, std.xml, std.zip,
std.zlib;;

int main(string[] args)
{
//writeln(Invoked with: , map!(q{a ~ , })(args));
if (args.length  1  std.string.startsWith(args[1], --shebang ))
{
// multiple options wrapped in one
auto a = args[1][--shebang .length .. $];
args = args[0 .. 1] ~ split(a) ~ args[2 .. $];
}

	// Read the config file
	findcfg();

// Continue parsing the command line; now get rdmd's own arguments
// parse the -o option
void dashOh(string key, string value)
{
if (value[0] == 'f')
{
// -ofmyfile passed
exe = value[1 .. $];
}
else if (value[0] == 'd')
{
// -odmydir passed
// add a trailing path separator to clarify it's a dir
exe = std.path.join(value[1 .. $], );
assert(std.string.endsWith(exe, std.path.sep));
}
else if (value[0] == '-')
{
// -o- passed
enforce(false, Option -o- currently not supported by rdmd);
}
else
{
enforce(false, Unrecognized option: ~key~value);
}
}

// start the web browser on documentation page
void man()
{
foreach (b; [ std.process.getenv(BROWSER), firefox,
sensible-browser, x-www-browser ]) {
if (!b.length) continue;
if (!system(b~ http://www.digitalmars.com/d/2.0/rdmd.html;))
return;
}
}

// set by functions called in getopt if program should exit
bool bailout, loop;
string eval;

Re: QtD 0.1 is out!

2009-03-01 Thread Christopher Wright

Frits van Bommel wrote:

Walter Bright wrote:

Christopher Wright wrote:

Walter Bright wrote:

Christopher Wright wrote:
Additionally, the compiler has sufficient information to complain 
about the problem at compile time, but it doesn't. That is a bug.


No, it does not. The compiler doesn't know about private imports of 
separately compiled modules.


Okay, the compiler could gain that information, but it does not, 
since it is not required. In many cases, the compiler could detect 
these issues. Detecting these would be a reasonable, if low priority, 
enhancement.


The problem if it detects it in an implementation-defined manner is 
the source code is no longer portable.


... If the result of compilation provably won't *run* anyway, what's the 
problem with a compile-time error?


Right. It's like the compiler warning you if your program starts with 
assert (false).


Re: QtD 0.1 is out!

2009-03-01 Thread Christopher Wright

Jarrett Billingsley wrote:

On Sun, Mar 1, 2009 at 10:16 AM, Don nos...@nospam.com wrote:

The D system has a major limitation, though -- you can't split the source
for a module across multiple files. Which pushes you towards enormous source
files. It's more restricted than both C# and C++ in this respect.



Yeah.  Imagine if DMDFE were written in D; how big would those modules
have to be?


The current organization of DMDFE is totally inconducive to D's module 
system, which I find ironic.


Re: DMD 1.038 and 2.022 releases

2008-12-22 Thread Christopher Wright

John Reimer wrote:

Hello Derek,

Just thinking out aloud ...

If two modules import each other and this can be 'fixed' by instead
having both modules as a single module, what is stopping the compiler
from just pretending that they are a single module for compilation
purposes?

This does assume that they are to be compiled at the same time rather
than one-file-at-a-time.




Interesting idea. :)

Maybe there would be issues with module ctors and __FILE__/__LINE__ 
expressions too?

Also it may mess up module info, debug, and other object attributes.

-JJR


This would work with two modules.

How would it work with more than that? You'd have to come up with a 
complete import graph (which you already need, I assume), search it for 
cycles, then, for each cycle, resolve it by combining static constructors.


It should work.


Re: Descent 0.5.3 released

2008-12-22 Thread Christopher Wright

Tim M wrote:
I dont think the allround ide is a problem anymore with eclipse 
available. Whats missing is a good gui builder. If you know of one other 
than entice though can you please reply with the links.


No top-posting, please.

I use Glade. It works reasonably well for small projects.


Re: Descent 0.5.3 released

2008-12-22 Thread Christopher Wright

BCS wrote:

Reply to Ary,


And a question: what would you like to see next in Descent?



Better template support. I now have 2 libs that are just flat uneditable 
under descent (scrapple.units and scrapple.dparse) both bring it down to 
a stand still if not crash and hand it out right. I'd love to see it 
just work at all for those files even if it doesn't support any template 
specific goodies.


I agree entirely. Using templates turns Descent into a very large text 
editor. I still use Descent for any application or library level 
development. (When I use D as a scripting language, I still use vim.)


Dunit 0.2

2008-11-08 Thread Christopher Wright

Introducing DUnit 0.2, with even more inconsistent capitalization!

Wow, it's been ages. I've been working off trunk so long I didn't 
realize there was a 0.1 release.


Wow.

We've come a long way in the past eight months. About as long as I could 
have come in two weeks, if I were paying attention mostly to dunit.


It's mostly been minor fixes to formatting, stability, that sort of 
thing. That old bug where interfaces don't implicitly cast to Object 
caused a fair number of headaches. But that's all water under the bridge 
(for now).


I've added junit-esque xml output. If I can wade through the acre-feet 
of XML required to create a build script that CruiseControl can handle, 
dunit will have CC integration. I'd rather use CruiseControl.NET, but it 
doesn't run well on Mono.


Dunit's assertions have improved a bit since our last release. Or so I 
imagine. I can't recall at the moment exactly how.


And in the past day or so, with the talk of what people find lacking in 
D's unittest{} blocks, I've been addressing a couple of the lacking 
features in Dunit. For instance, you can get a list of tests that are 
defined (useful for IDE integration -- like that'll ever happen) and 
filter out tests based on a regular expression (or rather, filter them in).


So, yeah, check out the documentation, give it a spin, what have you. 
The documentation's new and improved. Some longer examples would be 
nice, I grant.


Anyway, here it is:
http://dsource.org/projects/dmocks/wiki/DUnit -- wiki
http://dsource.org/projects/dmocks/browser/downloads/dunit.0.2.zip?format=raw 
-- direct download link