Re: Specifying C++ symbols in C++ namespaces

2014-04-03 Thread Robert Clipsham

On Thursday, 3 April 2014 at 03:48:08 UTC, Walter Bright wrote:
Alternatively you can use another module for the other 
namespace.


Forcing C++ code that exists in a single file to be split up 
among multiple D files is inflicting unnecessary punishment on 
the poor guy trying to justify migrating to D.


A solution could be to allow this:


module foo {
module bar {
// equivalent to foo/bar.d
}
}
extern(C++) module bar {
// Equivalent to namespace bar {} in C++
}


Note that Rust does something similar to this to allow multiple 
modules to be defined in a single file (though Rust also doesn't 
have the correspondence between filesystem location and module 
like D does - perhaps this is acceptable with the introduction of 
package.d?)


Robert


Re: Safe Navigation Operator “?.” for D2 ?

2014-02-27 Thread Robert Clipsham
On Thursday, 27 February 2014 at 17:25:22 UTC, Chris Williams 
wrote:

just(myObject).method1().method2().method3()


You can't do that. You're reducing your example code - which 
was several dozen lines and only applied to objects for which 
you had added the special handler code - to the end result. 
After you've laid the framework for doing this, yes, you can do 
it. But there's a bunch of work that has to go into it before 
you get to that point. (Also, your implementation is far less 
efficient than something which rewrites the code as a bunch of 
nested "if (not null)" checks.)


If your argument was that there are more important things for 
the compiler team to work on, or that the syntax of the 
language was already large enough without adding more things 
for people to remember, then sure. But if we lived under the 
premise that there's no reason to add features to a compiler 
that abstract code down into a simpler syntax, then we'd have 
never developed variables or functions.


Most of the code I posted would be hidden away in a library, and 
will work with any type with methods or UDFs. I'll admit it is 
incomplete (no implicit casting to the original return types for 
example), but it is possible. End user code would be exactly as 
that line is. I haven't checked the assembly, but given the 
simplicity of the generated code I'm fairly certain it will 
optimise to the same as the if/else chain (feel free to prove me 
wrong :)).


Robert


Re: Safe Navigation Operator “?.” for D2 ?

2014-02-27 Thread Robert Clipsham
On Thursday, 27 February 2014 at 16:32:18 UTC, Chris Williams 
wrote:
On Thursday, 27 February 2014 at 16:08:26 UTC, Robert Clipsham 
wrote:
D doesn't need this, you can implement monadic null checking 
in the library:


By that argument, I can implement anything that D can do in 
assembler, hence I don't need D.


I'm not sure I understand your point. I'm simply stating that in 
D, right now, without adding any complexity to the language, you 
can do:


just(myObject).method1().method2().method3()

Which would have the same effect as:

myObject?.method1()?.method2()?.method3()

in C#. Is a special operator really needed for this?

Robert


Re: Safe Navigation Operator “?.” for D2 ?

2014-02-27 Thread Robert Clipsham

On Thursday, 27 February 2014 at 13:27:14 UTC, Remo wrote:


Apparently C# will get it in the next version.
http://blogs.msdn.com/b/jerrynixon/archive/2014/02/26/at-last-c-is-getting-sometimes-called-the-safe-navigation-operator.aspx

What do you think how well would this work in D2 ?


D doesn't need this, you can implement monadic null checking in 
the library:


http://forum.dlang.org/post/kcrqyvddilteyhyyg...@forum.dlang.org

There's no need for a special operator for this. See the other 
posts in that thread for more information.


Robert


Re: Probable C# 6.0 features

2013-12-11 Thread Robert Clipsham
On Tuesday, 10 December 2013 at 23:53:25 UTC, Ary Borenszweig 
wrote:

On 12/10/13 5:35 PM, Namespace wrote:
I love Monadic null checking. Would be great if D would have 
it.


What does a monad have to do with that?

(just out of curiosity... BTW, the other day I friend tried to 
explain me monads and he realized couldn't understand them 
himself)


Monads suffer from the same problem algebra, templates and many 
other things do in that they have a scary name and are often 
poorly explained.


They way I like to think of monads is simply a box that performs 
computations. They have two methods, bind and return. return lets 
you put a value into the box, and bind lets you call some 
function with the value that's in the box. Probably the simplest 
example is the maybe monad ("monadic null checking"). The idea is 
to let you change something like this:


auto a = ...;
if (a != null) {
auto b = a.foo();
if (b != null) {
b.bar();
// And so on
}
}

Into:

a.foo().bar();


Here, the bind and return methods might look something like:

// "return" function
Maybe!Foo ret(Foo f) {
return just(f);
}
auto bind(Maybe!Foo thing, Foo function(Foo) fn) {
if(thing) {
return ret(fn(thing));
}
return nothing();
}

There are two functions here for getting instances of maybe - 
nothing and just. Nothing says "I don't have a value" and just 
says "I have a value". The bind method then simply says "if I 
have a value, call the function, otherwise just return nothing". 
The code above would be used as follows:


bind(bind(a, &foo), &bar);

With a bit of magic you can get rid of the overhead of function 
pointers and allow it to work with other function types, but it 
shows the general concept - wrap up the values, then use bind to 
chain functions together.


The ?. operator mentioned in the article is simply some syntactic 
sugar for a monad, hence "monadic null checking".


Re: Probable C# 6.0 features

2013-12-11 Thread Robert Clipsham

On Tuesday, 10 December 2013 at 20:35:08 UTC, Namespace wrote:

I love Monadic null checking. Would be great if D would have it.


Doesn't need to be a language feature - you can implement it as a 
library type. Here's a quick hacked together maybe monad:



import std.stdio;

struct Maybe(T)
{
private T val = null;

this(T t)
{
val = t;
}

auto opDispatch(string method, U...)(U params)
{
alias typeof(mixin("val." ~ method ~ "(params)")) retType;
if (val) {
mixin("return Maybe!(" ~ retType.stringof ~ ")(val." 
~ method ~ "(params));");

}
return nothing!retType();
}
}

Maybe!T just(T)(T t)
{
return Maybe!T(t);
}

Maybe!T nothing(T)()
{
return Maybe!T();
}

class Foo
{
Bar retNull()
{
writeln("foo null");
return null;
}

Bar notNull()
{
writeln("foo not null");
return new Bar();
}
}

class Bar
{
Foo retNull()
{
writeln("bar null");
return null;
}

Foo notNull()
{
writeln("bar not null");
return new Foo();
}
}

void main()
{
auto maybe = just(new Foo);
maybe.notNull().notNull().notNull().retNull().notNull();
}




Re: [OT] Which IDE / Editor do you use?

2013-09-14 Thread Robert Clipsham

On Friday, 13 September 2013 at 21:00:14 UTC, H. S. Teoh wrote:
On Fri, Sep 13, 2013 at 01:40:02PM -0700, Andrei Alexandrescu 
wrote:
Syntax highlighting hurts my eyes. I've been using vim in 
black-on-white
for more than a decade now. (Well, more accurately, black on an 
almost

fully saturated off-white, but that's irrelevant.)


T


Have you taken a look at solarized? I used to find my eyes 
straining after a few hours with syntax highlighting until I 
started using it, now I can stare for days at a time without 
issue.


http://ethanschoonover.com/solarized

Unfortunately it's a bit of a pain to set up for command line vim 
since you need to configure your terminal emulator too - well 
worth the time though! If you have gvim installed that's probably 
the easiest way to try it out and see how you feel about it 
before committing and setting it up properly.


Relevant lines for your .vimrc:

syntax on
" You can set it to dark too for a light-on-dark different theme
" I use dark - I figured light would be most similar to what you
" currently have with black-on-white. You can see samples of
" each on the page linked above
set background=light
colorscheme solarized


Re: Variadic grouping

2013-07-29 Thread Robert Clipsham

On Monday, 29 July 2013 at 14:46:02 UTC, Robert Clipsham wrote:

You can achieve this like so:

template Outer(T...) {
template Inner(U...) {
// Do something with T and U
}
}
Outer!(a, b, c).Inner!(d, e, f);


You can see an example of it in action here (type tuple 
intersection):

https://github.com/mrmonday/misc/blob/master/misc/misc.d#L5

Robert


What would be more interesting would be to have the ability to
have variadic variadics, so you could use something like:

template Outer(T...) {
 template Inner(U... ...) {
 // Do something with T, U[0], U[1], U[2..$]
 }
}
Outer!(a, b, c).Inner!(d, e, f).Inner!(g, h, i); // Etc

Of course that raises the question of variadic variadic variadics
and variadic variadic variadic variadics and so on, and my
proposed syntax is already silly


Re: Variadic grouping

2013-07-29 Thread Robert Clipsham

On Monday, 29 July 2013 at 13:23:23 UTC, JS wrote:
Sometimes it's nice to be able to have groups of variadic 
parameters:


template t(T1..., T2...)

...

t!(a, b, c; d, e, f);

so that a,b,c are for T1 and d,e,f are for T2.

This can be done by making a symbol and breaking up a single 
variadic but is messy.


I doubt such a feature will ever get added but who knows...


You can achieve this like so:

template Outer(T...) {
template Inner(U...) {
// Do something with T and U
}
}
Outer!(a, b, c).Inner!(d, e, f);


You can see an example of it in action here (type tuple 
intersection):

https://github.com/mrmonday/misc/blob/master/misc/misc.d#L5

Robert


Re: blocks with attributes vs inlined lambda

2013-06-18 Thread Robert Clipsham

On Saturday, 8 June 2013 at 14:57:17 UTC, monarch_dodra wrote:
My beef though is that the syntax is a bit opaque, and not 
really idiomatic. It looks more like a hacker's trick than a 
real language feature. It's not something you'd do "naturally". 
At least, I know a beginner may not feal comfortable with this.


Given that users are now actually doing this, that we have 
proof it works and is a useful feature, shouldn't we push to 
have actual blocks with attributes in the language?


I think we should... Thoughts?


Here's my go at cleaning up the syntax a bit:

auto block(string attr)() {
static struct Blk {
mixin(q{
void opBinary(string op:"in", T)(T dg) } ~ attr ~ q{
if (is(typeof(() } ~ attr ~ q{ { dg(); }))) {
dg();
}
void opBinary(string op:"in", T)(T dg) if 
(!is(typeof(() } ~ attr ~ ` { dg(); }))) {
static assert(false, "Provided delegate is not " 
~ "` ~ attr ~ `");

}
`);
}
return Blk();
}

void main() {
// Works
block!"nothrow" in {
// Doesn't throw
};

// Fails
block!"nothrow" in {
throw new Exception("");
};
}

Downsides are the required semicolon (needed for your method too) 
and abuse of operator overloading.


Re: Path as an object in std.path

2013-06-06 Thread Robert Clipsham

On Thursday, 6 June 2013 at 15:36:17 UTC, Walter Bright wrote:

On 6/4/2013 11:27 PM, Dylan Knutson wrote:
I'd like to open up the idea of Path being an object in 
std.path. I've submitted
a pull 
(https://github.com/D-Programming-Language/phobos/pull/1333) 
that adds a
Path struct to std.path, "which exposes a much more palatable 
interface to path

string manipulation".



I've succumbed to the temptation to do this several times over 
the years.


I always wind up backing it out and going back to strings.


As another data point: Java 7 introduces new Path and Paths 
objects:


http://docs.oracle.com/javase/7/docs/api/java/nio/file/Paths.html

So they clearly think using an object(s) for it is useful.

-

Without even thinking about the API, just using it, all the code 
I've written in the past couple of weeks looks something like 
this:


Path p = Paths.get(someDir, someOtherDir);
p = p.subpath(otherPath, p.getNameCount());
Path file = p.resolve(someFile);
print(file.toString());
file.toFile().doSomething();

ie. All my code is converting to/from a Path object purely for 
dealing with Windows and Posix / vs \ differences and doing 
sub-paths. Seems a bit pointless when we could just use free 
functions in my opinion.


Re: Arch AUR DMD missing?

2013-06-02 Thread Robert Clipsham

On Sunday, 2 June 2013 at 14:04:51 UTC, simendsjo wrote:

What happened to the DMD package in Arch AUR?
New name or something? Does anyone have a link to the package?


It's in [community] now:
https://www.archlinux.org/packages/?sort=&q=dmd&maintainer=&flagged=


Re: auto ref and non-templated functions

2012-12-24 Thread Robert Clipsham
On Monday, 24 December 2012 at 17:40:54 UTC, Jonathan M Davis 
wrote:
This has probably been discussed before, so someone has 
probably already
explained why this is a bad idea, but I can't remember why that 
would be, so

I'm going to ask:

Why can't we simply make auto ref work with non-templated 
functions by making
it automatically generate both the ref and non-ref versions? 
So, if I do


auto foo(auto ref S s) { /*do stuff*/ }


Is:

auto foo()(auto ref S e) { /* do stuff */ }

So hard to write?

(It's Christmas Eve, and I can't be bothered giving real 
arguments against right now - I suppose someone else will do this 
later... Merry Christmas!)


Robert



Re: D-based internships in the UK

2012-12-01 Thread Robert Clipsham

On Saturday, 1 December 2012 at 15:13:55 UTC, Faux Amis wrote:

How about the Netherlands ?


I could be tempted, however it may not be viable due to 
transportation costs, finding somewhere to stay, and the language 
barrier.


I forgot to mention in my post, feel free to contact me privately 
if you don't want to post on the newsgroups.


Thanks,

Robert


D-based internships in the UK

2012-12-01 Thread Robert Clipsham

Hey all,

Out of curiosity, I was wondering if anyone knew of any UK based 
companies were using D (or thinking about it) and looking for 
interns? I'm investigating my options for next summer, I figured 
I'd ask here and see if anything was going.


I've been using D for about 5 years now and plenty of experience 
with other languages and environments, I can give provide a full 
list on request.


Thanks,

Robert


Re: Function pointers/delegates default args were stealth removed?

2012-08-28 Thread Robert Clipsham

On Tuesday, 28 August 2012 at 06:53:15 UTC, Jacob Carlborg wrote:

On 2012-08-27 22:53, Walter Bright wrote:

The language design requires a 1:1 mapping of mangling to 
types. Hence
the compiler design to use the mangling as a hashmap key of 
types. The
failure of that approach in this case points to a problem in 
the

language design, not a bug in the compiler.


How does this then work when the body of the anonymous 
functions are different? How will they be identified?


The body of the function has nothing to do with its type.


Re: Function pointers/delegates default args were stealth removed?

2012-08-27 Thread Robert Clipsham

On Monday, 27 August 2012 at 10:32:28 UTC, Manu wrote:
Because the two types were considered to be the same, only 
different.


And how was that a problem? They never interacted in the 
example, the
assignments were totally separate, they shouldn't have been 
confused.
Just speculating, but it just looks like the type was 
misrepresented when
it was looked up from a map by name or something, and matched 
the wrong

cached definition... or something along those lines.
It looks like a bug exposed from implementation detail, I can't 
see
anything in the bug report that shouldn't theoretically work 
fine.


I seem to recall I looked at this issue myself at one point. It 
goes something like:


auto foo = (int a = 1) { return a; };
auto bar = (int a) { return a; };

int function(int) is mangled exactly the same as int function(int 
= 1) as default args aren't used for mangling. dmd does semantic 
analysis on the type of foo, which returns int function(int = 1), 
which is mangled as int function(int) and stored in dmd's hashmap 
of types (default args aren't mangled). When the semantic 
analysis of bar is done it checks the hashmap, sees that the type 
is already there (has the same name mangling) and does not repeat 
semantic analysis. If you switch the order of declarations then 
the opposite happens - the default arg is ignored.


Re: Made a Rage-Comic about D

2012-06-23 Thread Robert Clipsham

On Saturday, 23 June 2012 at 23:37:11 UTC, Jonathan M Davis wrote:

On Saturday, June 23, 2012 13:46:51 David wrote:
The cool thing is, I wasn't able to track it down until now, 
since line
numbers are completly messed up because of a heavy use of 
mixin() and CTFE.


Which is why I _never_ put newlines in string mixins.

- Jonathan M Davis


#line is a godsend when working with string mixins.

mixin(`#line ` ~ (30_000 + __LINE__).stringof ~ `
// Some really long code here
// The line numbers will be correct but plus 30_000
// Making it fairly simple to debug.
`);

--
Robert
http://octarineparrot.com/


Re: Made a Rage-Comic about D

2012-06-23 Thread Robert Clipsham

#line is a godsend when working with string mixins.

mixin(`#line ` ~ (30_000 + __LINE__).stringof ~ `
// Some really long code here
// The line numbers will be correct but plus 30_000
// Making it fairly simple to debug.
`);

--
Robert
http://octarineparrot.com/


Actually, add another 1 to that, my bad!

--
Robert
http://octarineparrot.com/


Re: GitHub for Windows

2012-05-25 Thread Robert Clipsham

On 25/05/2012 20:06, Walter Bright wrote:

I use putty every day, it is indispensible. But it doesn't work in the
other direction - I cannot ssh from Linux into Windows.


I've set up an ssh server with bash/unix utilities on Windows before 
now. It was a massive hassle to do, but the end result was awesome. 
There's also a way of setting it up to use powershell or cmd.exe if 
you'd prefer... No idea why you would though :)


--
Robert
http://octarineparrot.com/


Re: C linkage is fun

2012-05-24 Thread Robert Clipsham

On 24/05/2012 13:06, Alex Rønne Petersen wrote:

Just a little gotcha I ran into today:

import core.memory;

extern (C) void gc_collect()
{
assert(false, "nope!");
}

void main()
{
GC.collect();
}



I believe this is by design - the linker will only look for gc_collect() 
in a library if it isn't found in object files you provide.


This can be quite useful if you ever need to replace an internal 
function of something, it can easily go wrong though if your build 
process changes for some reason (or any number of other reasons!)


--
Robert
http://octarineparrot.com/


Re: deprecating std.stream, std.cstream, std.socketstream

2012-05-16 Thread Robert Clipsham

On 16/05/2012 15:38, Steven Schveighoffer wrote:

On Wed, 16 May 2012 09:50:12 -0400, Walter Bright
 wrote:


On 5/15/2012 3:34 PM, Nathan M. Swan wrote:

I do agree for e.g. with binary data some data can't be read with
ranges (when
you need to read small chunks of varying size),


I don't see why that should be true.


How do you tell front and popFront how many bytes to read?

-Steve


A bit ugly but:

// Default to 4 byte chunks
auto range = myStream.byChunks(4);
foreach (chunk; range) {
   // Set the next chunk is 3 bytes
   // Chunk after is 4 bytes
   range.nextChunkSize = 3;

   // Next chunk is always 5 bytes
   range.chunkSize = 5;
}


--
Robert
http://octarineparrot.com/


Re: XOMB operating system

2012-05-15 Thread Robert Clipsham

On 15/05/2012 03:36, Tyro[17] wrote:

On Tuesday, 15 May 2012 at 02:06:24 UTC, tim krimm wrote:


Ping: Are there any XOMB developers out there reading this?


Jarrett Billingsley, Brian Madden, and Kelly Wilson all
contributed to the XOMB project. I haven't seen anything from
them for years now. Don't know if they just lurk in the shadows
or have completely given up on D.


Probably not, but you could try and contact them. You can get a list of 
them here:


https://github.com/xomboverlord/xomb

Doesn't look like it's been updated in a year or so though - there may 
be a more recent branch somewhere though. Note it's written in D1.


--
Robert
http://octarineparrot.com/


Re: deprecating std.stream, std.cstream, std.socketstream

2012-05-13 Thread Robert Clipsham

On 13/05/2012 22:38, Walter Bright wrote:

This discussion started in the thread "Getting the const-correctness of
Object sorted once and for all", but it deserved its own thread.

These modules suffer from the following problems:

1. poor documentation, dearth of examples & rationale

2. toHash(), toString(), etc., all need to be const pure nothrow, but
it's turning out to be problematic for doing it for these classes

3. overlapping functionality with std.stdio

4. they should present a range interface, not a streaming one


I make use of std.stream quite a lot... It's horrible, it has to go.

I'm not too bothered if replacements aren't available straight away, as 
it doesn't take much to drop 10 lines of replacement in for the 
functionality I use from it until the actual replacement appears.


--
Robert
http://octarineparrot.com/


Re: Growing pains

2012-05-07 Thread Robert Clipsham

On 03/05/2012 15:50, Andrei Alexandrescu wrote:

Just letting you all know we're working on the frustrating and
increasingly frequent "Load at xx.xx, try again later" errors when
reading this forum through NNTP. They are caused by a significant growth
spurt in newsgroup readership that occurred in recent times. We are
working with our provider to fix these issues.

Thanks,

Andrei


I've gotta say... These have been a lot more frequent for me since you 
posted this message!


--
Robert
http://octarineparrot.com/


Re: luajit-ffi

2012-05-01 Thread Robert Clipsham

On 01/05/2012 16:24, so wrote:

http://luajit.org/ext_ffi.html
https://github.com/malkia/ufo

How awesome is Mike Pall?
I didn't dive into details of the code, but if he can do this with a
dynamic language, why on earth D still need manual C bindings while
having ABI compatibility? So luajit comes with a C compiler?


Note that you can't just drop any C header file in there for that to 
work (as far as I can tell), you still have to bring out individual 
post-processed function declarations.


Also, someone has written a libffi binding for D, which could probably 
be adapted to work in a similar manor:


https://github.com/lycus/libffi-d

--
Robert
http://octarineparrot.com/


Re: More bugs...

2012-05-01 Thread Robert Clipsham

On 01/05/2012 02:00, Mehrdad wrote:

Some ICE for y'all.

void filter(R)(scope bool delegate(ref BAD!R) func) { }
void main() { filter(r => r); }


Is this in bugzilla? It can't get fixed if no one knows about it! (Make 
sure to give it the ice keyword once you've submitted so it gets bumped 
to the top of the queue!)


--
Robert
http://octarineparrot.com/


Re: Does D have too many features?

2012-04-29 Thread Robert Clipsham

On 28/04/2012 20:22, Dmitry Olshansky wrote:

3. with statement (?). I kind of like it but bleh it's too boggy and it
doesn't seem to pull its weight. (pointers? class references? a lot of
stuff to go wrong) Fluent interfaces solve a good portion of its
benefits to be specific.


My primary use case for the with() statement is with final switch:

final switch(something) with(MyEnumWithAPrettyLongName)
{
case A: // Save repeating myself everywhere
break;

. . .

}

--
Robert
http://octarineparrot.com/


Re: Does D have too many features?

2012-04-29 Thread Robert Clipsham

On 29/04/2012 19:08, Manu wrote:

current module/package


http://dlang.org/phobos/std_traits#packageName

http://dlang.org/phobos/std_traits#moduleName

--
Robert
http://octarineparrot.com/


Is this a bug?

2012-04-20 Thread Robert Clipsham
I've been staring blankly at this for a while now and want some input 
from others:



void foo(T, U...)(bool arg)
{
if (arg)
{
assert(T.tupleof.length == U.length);
assert(arg); /* Line 6 */
// Or some other code here
}
}
struct A {}
void main()
{
foo!(A, int)(false);
}


When compiled with warnings:

$ dmd -w test.d
test.d(6): Warning: statement is not reachable

So what appears to be happening here is that dmd is constant folding 
T.tupleof.length == U.length to false, then assert(arg) can never 
happen, so the warning is given.


It is obvious, however, that the assertion will never be executed 
anyway. Has anyone else run into this situation? The compile time 
parameters only need to match based on the runtime value provided (other 
branches in the code don't have such strict requirements for the compile 
time parameters).


Is there some way around this? (other than compiling without -w)
I can't help but feel what I'm doing isn't right some how.

Apologies if this makes no sense, I'm rather tired.

--
Robert
http://octarineparrot.com/


Re: [off-topic] Sony releases PS Vita SDK

2012-04-20 Thread Robert Clipsham

On 20/04/2012 15:49, Manu wrote:

On 20 April 2012 17:28, Sean Kelly mailto:s...@invisibleduck.org>> wrote:

For what it's worth, Mikola Lysenko did a talk on coroutines in D at
a D conference a few years ago. It's on video, if you're interested
in looking for it.


Awesome , I certainly am. Did he have a working implementation?


http://prowiki.org/wiki4d/wiki.cgi?Videos

Video: http://vimeo.com/1873969
Slides: 
http://replay.waybackmachine.org/20081010074222/http://team0xf.com/conference/fibers.pdf


It's been a couple of years since I watched the video, I'm pretty sure 
it's what you can find in core.thread.Fiber that he's talking about (it 
used to be part of Tango).


--
Robert
http://octarineparrot.com/


Re: repro cases for optlink crashes

2012-04-20 Thread Robert Clipsham

On 19/04/2012 06:42, Benjamin Thaut wrote:

What is the ideal repro case for a optlink crash?
Are the object files enough or is a reduced sourcecode repro case
preferred?
If a reduced sourcecode is required, is there a way to make optlink
crash with a console message instead of the usual popup window? The
popup window makes it difficult to reduce the crash.



From what I recall, the object files are enough, however source that 
reproduces it may also be of use (I have no idea if that's the case).


If you want to reduce the source/size of object files that reproduce it, 
you can use DustMite: https://github.com/CyberShadow/DustMite


There's instructions for how to reduce an optlink crash here:
https://github.com/CyberShadow/DustMite/wiki/Reducing-OPTLINK%27s-Message-Box-of-Death

(General instructions for using DustMite are here - 
https://github.com/CyberShadow/DustMite/wiki ).


Of course once you're happy you should file a bug report at:
http://d.puremagic.com/issues/ with the link-failure keyword.

Hope this helps!

--
Robert
http://octarineparrot.com/


Re: compiler support added for precise GC

2012-04-18 Thread Robert Clipsham

On 18/04/2012 17:31, Jacob Carlborg wrote:

On 2012-04-18 13:06, Steven Schveighoffer wrote:

On Tue, 17 Apr 2012 02:50:02 -0400, Jacob Carlborg  wrote:



Can you explain why .NET types are not by default serializable? All of
them have full runtime reflection AFAIK.

I'm not using that as an argument, I'm genuinely interested.


I'm wondering that as well.



From my quick google I couldn't find a definitive answer, but:

http://stackoverflow.com/questions/4408909/why-classes-are-not-serializable-by-default-in-net

http://en.wikipedia.org/wiki/Serialization (reasons listed under Java)

--
Robert
http://octarineparrot.com/


Re: compiler support added for precise GC

2012-04-18 Thread Robert Clipsham

On 18/04/2012 02:11, Nick Sabalausky wrote:

Can't you just query compile-time information to see what classes inherit
from Base? Then you could just try downcasting to them.


Last time I checked there was no way to do that (I doubt that will have 
changed). It's impossible to know all the subclasses until link-time, so 
you'll get different results depending on how you compile your project. 
The only way around this that I've found is to put a mixin in all 
subclasses to register them with the base class... That's a complete 
hack though.


Example:

// a.d
class Base { /* whatever magic to get derived classes */ }
// b.d
import a;
class Derived : Base {}
void main() {}

$ dmd -c a.d

dmd does not know about b.d when compiling a.d. The only way this could 
work is to allow link-time code generation.


--
Robert
http://octarineparrot.com/


Re: Is the use of .di depreceated ?

2012-04-18 Thread Robert Clipsham

On 18/04/2012 09:18, "Erèbe" wrote:

Hi,

I recently discovered that D support file interface .di, but through my
past reads I never seen someone using it. The std don't do usage of it
(compile time issue maybe ?) and most of D project are in the same case.

Is this feature depreceated ?

I'm from a C++ background, I agree on the fact that keeping declarations
and implementaions sync across two files is tedious, but when I have to
read code, I like a clean interface to summarize the thing.

Dmd doc is there to replace the need of an clean interface ?


You can find a list of deprecated features here:

http://dlang.org/deprecate

.di files are not deprecated, just rarely used. This is for a few reasons:
 * There is no requirement to use them
 * They severely limit the capabilities of CTFE 
(http://dlang.org/function#interpretation)
 * DMD is really fast - the speed gain from using .di files isn't 
noticeable for a lot of projects
 * If you want them, they're very easy to generate yourself (use the 
-Dd and -Df compiler switches)
 * For the purposes of reading APIs, DDoc is normally used - 
alternatively, all good editors and IDEs provide code folding to hide 
implementations



--
Robert
http://octarineparrot.com/


Re: std.algorithms filter and string[]

2012-04-11 Thread Robert Clipsham

On 11/04/2012 14:55, Russel Winder wrote:

I am having a dumb n00b moment, but I need to solve this 10 mins ago ;-)

immutable files = ( selector == 0 ) ? [ "." ] : filter ! ( ( string x ) 
{ return x.isFile ; } ) ( sliceOfStrings ) ;

gives me the error:

  Error: incompatible types for ((["."]) ? (filter(sliceOfStrings))):
'string[]' and 'Result'

which in one universe is fine, but in my universe is a problem as I
cannot see a way of properly creating a Result instance based on the
array literal.

(I have a workaround, but I'd prefer to know the proper D idiom for
this.

Thanks.



I don't know that there's an easy way to do array -> arbitrary range as 
you ask (or more specifically, Result), however you can use array() from 
std.array to go the other way (range -> array).


--
Robert
http://octarineparrot.com/


Transfering CTFE classes to runtime

2012-03-31 Thread Robert Clipsham

Hi all,

I recently had a need to use some classes from CTFE so I made a couple 
of helper methods to do just that:


https://github.com/mrmonday/misc/blob/master/transfer.d

Basic usage:

enum prepared = prepare(new MyClass);

auto transferred = transfer!MyClass(prepared);


It's rather rough and under-documented, could be of use though.

Known issues:
* Classes which have member variables of class types don't work
* Classes must have a default constructor
* transfer() requires the type parameter to be of the same class as used 
at compile time - super classes won't work.


They shouldn't be too hard to resolve for the most part though.

--
Robert
http://octarineparrot.com/


Re: DIP16: Transparently substitute module with package

2012-03-30 Thread Robert Clipsham

On 30/03/2012 15:46, Andrei Alexandrescu wrote:

Starting a new thread from one in announce:

http://prowiki.org/wiki4d/wiki.cgi?LanguageDevel/DIPs/DIP16

Please comment, after which Walter will approve. Walter's approval means
that he would approve a pull request implementing DIP16 (subject to
regular correctness checks).


Destroy!

Andrei


The proposal doesn't say what happens when package.d is not found but 
foo/bar/ exists.


Given that a lot of people will just use public import foo.bar.*; in 
that file, would it make sense for package.d missing to imply import 
foo.bar.*? That would save typing out every single file in there. Of 
course it would also be annoying if you wanted to import everything 
except one file, as you'd then have to type out every single import anyway.


The other option is to error, which is probably a more sane option.

--
Robert
http://octarineparrot.com/


Re: Inheritance of purity

2012-02-24 Thread Robert Clipsham

On 24/02/2012 10:43, Walter Bright wrote:

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.


You're probably thinking of Scratch, though there are such languages not 
aimed at kids, see Android App Inventor -


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

Having used both of these (and a couple of others if I recall) I'd 
happily take a text only language any day!


But then... I prefer a command line + text editor over GUI/IDE too ;)

--
Robert
http://octarineparrot.com/


Re: DustMite updated

2012-02-23 Thread Robert Clipsham

On 23/02/2012 13:05, Vladimir Panteleev wrote:

On Thursday, 23 February 2012 at 11:52:17 UTC, Trass3r wrote:

Unfortunately plenty of 64Bit errors again :/


I can't test for these easily (I wish DMD on Windows had -m64 working
with -o-).


Fixed - https://github.com/CyberShadow/DustMite/pull/7

--
Robert
http://octarineparrot.com/


Re: The Right Approach to Exceptions

2012-02-19 Thread Robert Clipsham

On 18/02/2012 23:13, Andrei Alexandrescu wrote:

On 2/18/12 4:26 PM, Jonathan M Davis wrote (abridged):
GetOptException
FlagArgumentMissingException
InvalidFlagArgumentException
UnknownFlagException
FileException
FileNotFoundException
NotFileException
NotDirException
AccessDeniedException

I died inside a little.

Andrei


Perhaps something like:

class PhobosException : Exception
{
this(string _module, uint flags) { ... }
}

try
{
doSomething();
}
catch(PhobosException e)
{
// An exception was thrown by phobos
if (e.moduleOf == "file") {
// An exception was thrown by std.file
if (e.flags & FileException.NotFound) {
// File wasn't found
}
} else if (e.moduleOf == "stdio") {
// An exception was thrown by std.stdio
}
// We only want to handle file and stdio exceptions, rethrow
throw e;
}

Some pros/cons:
 * Catch-all for all phobos exceptions
 * No binary bloat from having lots of exception classes
 * Can still handle specific exceptions
 * e.flags isn't type-safe
 * It's not particularly pretty
 * Can only have up to 32 different "exceptions" in a module (64 if you 
make it a ulong)
 * It looks stupid if you come from an OOP language like java and 
you're used to having 5000 catch blocks
 * No need to decide on any exception hierarchy, just throw a 
PhobosException


--
Robert
http://octarineparrot.com/


Thoughts about private aliases now working

2012-02-01 Thread Robert Clipsham

Hi all,

I had to skip dmd 2.057 due to various bugs, so in the hopes that I'll 
be able to use my codebase with 2.058 I'm testing it early. Due to some 
fixes with private imports, some code I was previously using no longer 
works. It looks a little like this:


a.d

private alias string[string] SS;
mixin template Func()
{
SS someFunc(SS s)
{
return s;
}
}


b.d

import a;
mixin Func;


Now that private aliases work, this errors as expected (SS shouldn't be 
visible in b.d). What this does mean however is that I have to do one of:


 * Type out the type in full in Func (I'm not actually using 
string[string] in my code, it's a rather longer named type)

 * Make the alias public so it's available to all modules that import Func.

As it's an implementation detail, I'd rather not have it appear in user 
code, which rules out the latter, and typing out the full type makes a 
simple declaration use up several lines (or one obscenely long line!)


Are there any other options I'm missing? Is there some way to make the 
alias visible within the mixin but not elsewhere?


Thanks,

--
Robert
http://octarineparrot.com/


Re: dmd2

2012-01-29 Thread Robert Clipsham

On 29/01/2012 16:24, Chad J wrote:

Hey guys,

I know this is a bit late given the deprecation of D1 and all, but why
did we name the D2 compiler dmd instead of dmd2?

It's rather annoyed me when trying to work with multiple D projects of
mixed kind in the same environment. Using the same compiler name for two
different programming languages seems like a Bad Idea.

- Chad


Check out dvm, it's really useful in this kind of situation.

https://bitbucket.org/doob/dvm/wiki/Home

You can simply do:

dvm use 1.072
dvm use 2.057

etc to switch to the relevant toolchain.

--
Robert
http://octarineparrot.com/


Re: CTFE attribute

2012-01-28 Thread Robert Clipsham

On 28/01/2012 15:13, Manu wrote:

Sweet, I'll do that for now.
You mean static if() right?


No, I mean if().

__ctfe is a magic variable, and during CTFE it is true, at run time it 
is false. As it is a variable and not a constant, it cannot be read at 
compile time, so static if() won't work.


See also:
http://dlang.org/function ctrl+f for __ctfe

--
Robert
http://octarineparrot.com/


Re: CTFE attribute

2012-01-28 Thread Robert Clipsham

On 28/01/2012 14:50, Manu wrote:

This has come up lots of times before.. I just wanted to effectively +1
this request.

I have some templates, and some reasonably complex functions I use
strictly via CTFE to produce enums and evaluate conditions within the
templates.
When I build my code, I notice that the CTFE functions, which are never
referenced in any runtime code, are still present in the object file.
Additionally, one of these functions requires I import std.string, which
is only used in CTFE code, and is otherwise a pointless import.

I'd certainly like to be able to mark these functions CTFE to be sure no
runtime code will ever be generated for them, and also, what can I do
about CTFE imports? I don't want that import in my binary...


There are a couple of things you can do. The first is to make the 
imports function local, the second is:


http://www.digitalmars.com/d/archives/digitalmars/D/Incremental_compilation_with_DMD_96138.html#N96337

You'll notice that thread mentions a pragma(ctfe) patch for DMD, that's 
another option, though would require a patched compiler. I can't seem to 
find a link to that patch, a bit of googling should help though.


Another idea I've just had:

T myComplexFuntion()
{
  if (__ctfe)
  {
 // Implement here
  }
  else
  {
assert(0);
  }
}

This should allow the function to be inlined to assert(0); if it's 
called at runtime, so while it will still exist in the binary, it won't 
introduce lots of additional bloat.


--
Robert
http://octarineparrot.com/


[OT] Programming language WATs

2012-01-20 Thread Robert Clipsham

Just came across this amusing 4 minute video:

https://www.destroyallsoftware.com/talks/wat

Anyone have any other WATs you can do in other languages? Bonus points 
for WATs you can do in D.


--
Robert
http://octarineparrot.com/


Re: Biggest Issue with D - Definition and Versioning

2012-01-15 Thread Robert Clipsham

On 15/01/2012 14:26, Daniel Murphy wrote:

"Michel Fortin"  wrote in message
news:jetbld$23qt$1...@digitalmars.com...

Looks good in theory, but in practice this approach hasn't worked very
well for pull request number 3.



I may have mentioned this before, but there are a couple of things that make
me think pull 3 shouldn't be merged as is. (Even if it was made merge-ready)

1. The patch tries (and in some places, doesn't try) to match implicit
conversion and template deduction behaviour for pointers and arrays which
are badly defined and in some cases don't make any sense.  I'd prefer to get
those sorted out before adding a third referencey TypeNext to dmd.

2. The addition of head() means a huge amount of changes that aren't really
necessary.  Most of the changes are insertions of calls to this function,
which introduces quite a bit of mess and potential for easy bugs if someone
forgets to use it.

I don't know if Walter has a similar list of reservations he's keeping to
himself, or just hasn't gotten around to it yet.  Hopefully I'll find some
time to work on these issues (or somebody else will).


Might be worth adding this as a comment on the pull request!

--
Robert
http://octarineparrot.com/


Re: Biggest Issue with D - Definition and Versioning

2012-01-13 Thread Robert Clipsham

On 13/01/2012 06:08, Walter Bright wrote:

I'm sorry about that, but I'm running as fast as I can, along with the
help of a number of prolific contributors. As you can see by the
changelog, there are a zillion issues that do get resolved every month.


Would it be useful if the pull auto tester set up its own git repository 
you could pull from? You'd do something to mark pull requests which look 
good, then the pull tester could queue them up to be merged, and merge 
as many as it can while still passing the testsuite... Then you can pull 
from there and get more requests tried and tested.


This is slightly advantageous as you don't have to spend time waiting to 
see if the test suite passes for each pull request, you can set them off 
before you go to bed and pull lots in the morning (the ones that worked).


Of course this requires some work to get it working in the first place...

--
Robert
http://octarineparrot.com/


Re: CURL question on ubuntuforums.org

2012-01-06 Thread Robert Clipsham

On 06/01/2012 20:35, Nick Sabalausky wrote:

Did you mean that last line to be "dmd a.obj b.obj"?


Uuurrr, oops. Yes I did, sorry about that.

--
Robert
http://octarineparrot.com/


Re: CURL question on ubuntuforums.org

2012-01-06 Thread Robert Clipsham

On 06/01/2012 13:58, Jacob Carlborg wrote:

The only time pragma(lib) works is when the file it's in is provided on
the command line. rdmd can work around this as it invokes dmd twice,
there's not a lot that can be done otherwise though.



You mean it doesn't work for .di files, I'm aware of that.

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


dmd -c a.d
dmd -c b.d
dmd a.d b.d

...

Cue linker errors if A or B has a pragma(lib) in it and relevant extern 
declarations.


--
Robert
http://octarineparrot.com/


Re: Compiler for multiple languages, including D

2012-01-05 Thread Robert Clipsham

On 05/01/2012 16:04, Andrei Alexandrescu wrote:

http://l33ts.org/forum/Thread-my-online-multiple-language-compiler?pid=575304#pid575304


Andrei


Dunno about anyone else, but I wouldn't trust anyone "compiling" code 
for you then letting you download it. How can you be sure they're not 
injecting malicious code into the binaries?


Even if they're not, what if someone hacks the site some how, they could 
inject malicious code.


--
Robert
http://octarineparrot.com/


Re: CURL question on ubuntuforums.org

2012-01-05 Thread Robert Clipsham

On 05/01/2012 13:41, Jacob Carlborg wrote:

On 2012-01-05 11:00, Nick Sabalausky wrote:

"Joshua Reusch" wrote in message
news:je26q8$19oo$1...@digitalmars.com...


OT: Why does dmd ignore the pragma(lib, ...) in the etc.c.curl module
while rdmd seems to recognize it?


What I think is happening:

The pragma(lib, ...) causes DMD's -deps=filename option to include the
library file in the dependency list that gets output. RDMD takes that
list
and sends everything in it back to DMD on the command line.
Apperently, DMD
is only forwarding libs to the linker when it receives them on the
command
line (though I don't know why, sounds like a bug to me).


Isn't that what it's supposed to do, just forward the lib to the linker?



The only time pragma(lib) works is when the file it's in is provided on 
the command line. rdmd can work around this as it invokes dmd twice, 
there's not a lot that can be done otherwise though.


--
Robert
http://octarineparrot.com/


Re: ACCU and D

2012-01-03 Thread Robert Clipsham

On 03/01/2012 19:10, Nick Sabalausky wrote:

In a partially related note, the ACCU has gradually been publishing the
entries for the D article contest in its C Vu magazine...


Mine will be in the January edition if you're interested




I don't suppose there's a way to get ahold of, or at least view, back-issues
somehow?


You need to be an ACCU member to get them. I assume you're looking for 
your article? I just had a look and it doesn't seem to have been 
published yet (only Jonathan and David's articles have been). I got a 
emailed by Steve before they started putting together the magazine to 
ask for a bio, I assume you will too.


Steve seemed to be OK with sending a digital and paper copy without 
membership given that my article was in there, he should be able to do 
the same for you (admittedly, I joined the ACCU as it's pretty cheap for 
students).


--
Robert
http://octarineparrot.com/


Re: ACCU and D

2012-01-03 Thread Robert Clipsham

On 03/01/2012 10:46, Russel Winder wrote:

My proposal for a talk at ACCU 2012 showing that D and Go prove that the
C++11 standard may well be the eulogy for C++ has been accepted.
http://accu.org/index.php/conferences/accu_conference_2012/accu2012_sessions#Go,
 D, C++ and the Multicore revolution.

If you are in Oxford 2012-04-24 to 2012-04-28 feel free to come to the
conference.  This year there is much more of a C++ and Java feel to it,
probably due to C++11 and Java 7.  More hecklers required :-)

http://accu.org/index.php/conferences/accu_conference_2012


In a partially related note, the ACCU has gradually been publishing the 
entries for the D article contest in its C Vu magazine...



Mine will be in the January edition if you're interested


--
Robert
http://octarineparrot.com/


Re: ACCU and D

2012-01-03 Thread Robert Clipsham

On 03/01/2012 10:46, Russel Winder wrote:

My proposal for a talk at ACCU 2012 showing that D and Go prove that the
C++11 standard may well be the eulogy for C++ has been accepted.
http://accu.org/index.php/conferences/accu_conference_2012/accu2012_sessions#Go,
 D, C++ and the Multicore revolution.

If you are in Oxford 2012-04-24 to 2012-04-28 feel free to come to the
conference.  This year there is much more of a C++ and Java feel to it,
probably due to C++11 and Java 7.  More hecklers required :-)

http://accu.org/index.php/conferences/accu_conference_2012




I'd love to go (I may even be free to go too), it's so expensive though D;

--
Robert
http://octarineparrot.com/


Re: dmd and C++11

2011-12-31 Thread Robert Clipsham

On 29/12/2011 16:16, Trass3r wrote:

On Thursday, 29 December 2011 at 16:00:47 UTC, Vladimir Panteleev wrote:

On Thursday, 29 December 2011 at 15:58:55 UTC, Trass3r wrote:

What's the stance on using C++11 features in the dmd source code in
the future?


Well, how many C++11 features does DMC support?


*sigh*
Totally forgot about that. Can't we finally get rid of that crappy
toolchain :'(
btw, wasn't there a patch to make dmd compile with VisualStudio cl?


http://www.digitalmars.com/ctg/CPP0x-Language-Implementation.html

--
Robert
http://octarineparrot.com/


Re: Could we use something better than zip for the dmd package?

2011-12-21 Thread Robert Clipsham

On 20/12/2011 19:57, Trass3r wrote:

The ftp is not the fastest one and 7z reduces the size by 40%.


The size doesn't bother me at all. What bothers me is how long it takes 
to download... The digitalmars server is incredibly slow.


There's no excuse for that, there are quite literally hundreds of sites 
that will host packages for you, including github.


--
Robert
http://octarineparrot.com/


Re: auto testing

2011-12-17 Thread Robert Clipsham

On 17/12/2011 06:40, Brad Roberts wrote:

On 12/16/2011 1:29 PM, Brad Anderson wrote:

On Thu, Dec 15, 2011 at 6:43 PM, Brad 
Robertsmailto:bra...@puremagic.com>>  wrote:


 Left to do:

  1) deploy changes to the tester hosts (it's on 2 already)


done


  2) finish the ui


very ugly but minimally functional: 
http://d.puremagic.com/test-results/pulls.ghtml


  3) trigger pull rebuilds when trunk is updated


partly implemented, but not being done yet


Idea: I noticed most pull requests were failing when I looked at it, due 
to the main build failing - that's a lot of wasted computing time. 
Perhaps it would be a good idea to refuse to test pulls if dmd HEAD 
isn't compiling? This would be problematic for the 1/100 pull requests 
designed to fix this, but would save a lot of testing.


An alternative method could be to test all of them, but if the pull 
request previously passed, then dmd HEAD broke, then the pull broke, 
stop testing until dmd HEAD is fixed.


--
Robert
http://octarineparrot.com/


Bug Prediction at Google

2011-12-15 Thread Robert Clipsham
I just read this pretty interesting article on the Google Engineering 
Tools website, thought it might interest some people here:


http://google-engtools.blogspot.com/2011/12/bug-prediction-at-google.html

( http://goo.gl/2O6YT <= a short link in case the above one gets wrapped)

It basically describes a new process in place at Google whereby each 
file within a project is assigned a rating saying how likely the given 
file is to have a bug in it compared to everything else. This can be 
used by code reviewers so they can take extra care when reviewing 
certain changes.


I really think github needs built in review tools (more advanced than 
just pull requests) to allow things like the auto-tester to be run, or 
algorithms like this to be used for manual review and so on.


--
Robert
http://octarineparrot.com/


Re: D1 to be discontinued on December 31, 2012

2011-12-15 Thread Robert Clipsham

On 15/12/2011 00:32, Jakob Bornecrantz wrote:

On Wednesday, 14 December 2011 at 18:55:23 UTC, Walter Bright wrote:

On 12/14/2011 10:28 AM, Jakob Bornecrantz wrote:

I don't know where the D1 community is, or even if it exists anymore.


I'm here!


Thanks for speaking up.


np.


Anyways couldn't you just do releases less often or only when there
is something to release? Like every other D2 release to
lessen the burden?


Can I turn that around and ask what issues there are with migrating
your code base to D2?


In short it can be answered with the questions "Can you
guarantee it work?" and "Can I justify the amount of work I have
to put in for the gain?", the thing is I have a had a lot of
problems with D1 toolchain, I have fixed or worked around these
issues and I'm wondering if I have to work around those or other
again. I am currently supporting 3 platforms (Mac, Linux &
Windows), so that factors in as well (me having fixed some
issues on Mac for D1).

My current code base is 40Kloc's where about 8Kloc of those
are library bindings, on top of that it also includes a couple
of C projects sources (expat, lua and some other misc
libraries). So I would have to convert all that code to D2 and
also fix any issues that might arise from that conversion.
That said I think that it would mostly running the code
through dmd2 and just fix any cases where it complains. But it
probably wouldn't be a trivial amount of work.


Having migrated a far smaller codebase from D1/Tango to D2/Phobos, here 
are some tips/things I encountered:


* Most of the effort in porting was dealing with the lack of features in 
phobos, this sounds like it wouldn't be an issue for you though since 
you're using D1/Phobos.
* Make sure all your code is thoroughly unittested - my code had a 
reasonable amount of unittests, but I was still discovering subtle bugs 
months later that were caused by the transition
* Do it all in one go, and DO NOT GET DISTRACTED. The moment you start 
trying to clean up code as well as finish porting it you introduce lots 
of issues
* Some things will inevitably have to change to get them working... 
Don't make the changes while you're porting, just drop in a /* TODO: 
 */ comment and come back to it later. 
Get it compiling first, then go through and sort things out later.


Hope this helps, should you decide to transition :)

--
Robert
http://octarineparrot.com/


Re: D1 to be discontinued on December 31, 2012

2011-12-14 Thread Robert Clipsham

On 14/12/2011 08:13, Andrei Alexandrescu wrote:

On 12/14/11 1:35 AM, Jacob Carlborg wrote:

No. It's not so much about the result (because I know basically everyone
would vote to discontinue the D1 support), it's more about the attitude
and the way it's handled.


How would you have handled the situation if you were in our place?


"
...
It is for these reasons we are planning to discontinue D1 support on 
December 31, 2012. Does anyone have any reasons why D1 support should be 
continued after these dates, or is there anything we've not thought about?


For those of you still using D1, what can we do to make a transition 
more tempting and as pain-free as possible?"


The result would almost certainly been the same, but you would have a 
better idea of what's missing in D2 that D1 has, and this would seem 
like more of a community decision.


Obviously I'm not suggesting that either you or Walter should spent time 
working on things you have little or no interest in, but this was 
incredibly sudden, and had no community input.


Side note: If you'd done the above and worded it correctly, you may have 
found someone to take over maintenance of D1 until support ends, thus 
reducing Walter's workload even sooner (just to clarify, this is just 
speculation and opinion, I'm not saying it would have happened).


--
Robert
http://octarineparrot.com/


Re: D1 to be discontinued on December 31, 2012

2011-12-14 Thread Robert Clipsham

On 14/12/2011 09:46, Andrei Alexandrescu wrote:

On 12/14/11 2:30 AM, Don wrote:

On 14.12.2011 05:37, Andrei Alexandrescu wrote:

There is no abandonment. Also, where is that 50/50 estimate from? Just
curious.


The D2 community is definitely bigger than the D1 community. But how
much more?


I presume it's quite a bit larger. But then both are small, and we're
interested in the potential and the rate of adoption.


It's hard to be sure, but the Tango users used to be 75% of the
community, based on a few polls that were held, but they never had much
representation on the ng. I guess between half and 2/3 are gone now.


That seems a reasonable assessment. Possibly even more left.


I don't think the entire D community is as big as it was back then
(based on number of public repositories).


That is also entirely possible.


Additionally, the number of contributors, and level of activity, in
Tango, was higher than Phobos has ever had.


Agreed.

But this is all missing the mark - why would we cry over spilled milk.
The point is assessing the state of affairs the minute before the
announcement. How active was Tango? How active were the Tango forums?
Where were other forums of the D1 community? In this day and age, I'd be
hard-pressed to think of an active programming language community that
has no online presence whatsoever.

To add to that, there was no trickle of bug reports or pull requests for
D1, although clearly D1 does have its bugs and issues. I haven't
followed Tango closely, but if D1 had a large active community, Tango
would receive a lot of attention from its users as it's the de facto
standard library for D1. Yet the last post
(http://www.dsource.org/projects/tango/forums/topic/903) dates from
March 30. The intervals between changes to the trunk
(http://www.dsource.org/projects/tango/changeset/5691/) are measured in
months.

I hope you'll agree that one would be hard-pressed to infer from the
evidence there is that there's a large, active, and thriving D1 community.


Many of the active contributors to Tango and other D1 projects (millions 
of lines of code in total) have completely abandoned D now, moving back 
to C, C++, Java, and other languages.


Why?

See the many posts at: http://h3.gd/devlog/
And also: http://www.jfbillingsley.com/blog/?p=53

These issues are why they left D. Notice how they're not just D1 
problems, for the most part, they still exist with D2 (progress has been 
made with some of the issues). Some issues I've pulled out (by no means 
all of them, see the above posts for more info):


* OPTLINK/OMF/The horrific windows situation
* The GC
* .di files
* forward references/cyclic imports
* Long standing bugs with patches, lots of votes and no fix applied
* Decisions being made with NO community input. Cough.

Things have been changing rapidly since the move to github, and many 
things that drove them away are being worked on, but still... They 
didn't migrate to D2 because it wasn't remotely stable, and D1 still 
wasn't (isn't!) finished. D2 still isn't stable/complete, and has 
inherited many issues from pre-D1.


I really hope it is before you kill off D1.

--
Robert
http://octarineparrot.com/


Re: D kicks ass.

2011-12-12 Thread Robert Clipsham

On 12/12/2011 20:08, Iain Buclaw wrote:

Bigger == Better.   :o)


Biggest rock is best rock.

http://www.youtube.com/watch?v=i_APoSfCYwU

--
Robert
http://octarineparrot.com/


Re: If I had my way

2011-12-12 Thread Robert Clipsham

On 12/12/2011 03:58, Walter Bright wrote:

On 12/11/2011 10:34 AM, Paulo Pinto wrote:

In my experience programming embedded systems in highly constrained
environments
usually means assembly or at most a C compiler using lots
of compiler specific extensions for the target environment.

I fail to see how D without GC could be a better tool in such
enviroments.


For a system with a tiny amount of memory, D probably is the wrong tool.
My suggestion would be:

0..64K assembler
64K..1M C


enum there = areALotOfCoolThingsInDThatDontNeedGC();

It'd be nice if D was an option here too.


1M+ D

The larger your program is, the more D starts to pull ahead.



--
Robert
http://octarineparrot.com/


Re: A new web newsreader

2011-12-08 Thread Robert Clipsham

On 08/12/2011 14:06, Vladimir Panteleev wrote:

On Thursday, 8 December 2011 at 13:51:21 UTC, Robert Clipsham wrote:

* Support syntax highlighting for blocks enclosed with --- like DDoc
does, maybe other types of blocks too such as {{{}}} that trac uses,
or whatever github uses.


I'm not very excited about the idea of introducing formatting features
that only users of this web interface will see. Frequent use of such
features would annoy users of other interfaces, and there's the risk of
accidentally activating them.


I've seen quite a few people using it for code snippets anyway, and it's 
only a minor thing - I wouldn't want to go any further and allow for 
bold/italic/smileys/etc. Accidentally activating them would be a 
problem, I think that's a minor risk for this though. Not a major thing, 
just something I've always wanted to see ;)



* Does the mailing list have the same restriction as gmane has (no
posting)?


Yes. Clicking on "Create thread" or "Reply" will display a message with
a link to the Mailman page. I could probably implement posting if Brad
says it's OK, but focused discussion groups such as development mailing
lists might actually benefit from a high barrier to entry.


That's a shame, it really annoys me that I can't reply in the same place 
as I read currently :(



* Thundrbird has a "mark read" function for
threads/messages/newsgroups - that'd be really useful.


"Mark thread as [un]read" keys should be easy to add. It would also be
possible to mark all posts as read, but not on a per-group basis.


Awesome! Can't wait!


* In the horizontal-split view if you scroll down too far in the
thread you can't see the current thread title, it would be good to
make that sticky until you reach the next thread so you can see where
you're up to


This isn't possible with just CSS. A JavaScript implementation might be
possible. I'll think about it.


Some of us don't have the same reservations as Nick about not using 
javascript ;) If it can't be done in CSS it would still be really nice 
to have.



Maybe we should just reverse the thread sort order, like for the
"threaded" view?



There could be a "Sort by" option to allow it to be sorted however the 
user wants it?




Another one - log in using OpenID so I don't have to remember another
username/password ;)


I'd be happy to if you provide a D OpenID implementation :)

(Last I checked, implementing OpenID from scratch was quite hard)


I doubt I'll get chance in the near future unfortunately. Last time I 
looked it didn't seem to hard, I didn't look too in depth though.


--
Robert
http://octarineparrot.com/


Re: A new web newsreader

2011-12-08 Thread Robert Clipsham

On 08/12/2011 13:51, Robert Clipsham wrote:

On 08/12/2011 10:55, Vladimir Panteleev wrote:

As mentioned previously, I've been working on a web frontend for the
DigitalMars NNTP server. I collected ideas and inspiration from the
several threads on this topic in the last few weeks, and now I think
that the result is ready for beta testing and general use.

The current (temporary) URL is:



Here are the highlights:

* Written in D, pull requests are welcome.
https://github.com/CyberShadow/DFeed

* It remembers which posts you've seen on an individual post basis.
By default, read post history is stored in a compressed cookie.

* Optionally, you can register an account, which will store your
preferences and read post history in the server database. There is no
e-mail confirmation etc.


Oooh, it's almost ready enough to let me replace my Thunderbird usage!

A couple of feature requests (some I've already mentioned on IRC):

* Support syntax highlighting for blocks enclosed with --- like DDoc
does, maybe other types of blocks too such as {{{}}} that trac uses, or
whatever github uses.
* Does the mailing list have the same restriction as gmane has (no
posting)?
* Thundrbird has a "mark read" function for threads/messages/newsgroups
- that'd be really useful.
* In the horizontal-split view if you scroll down too far in the thread
you can't see the current thread title, it would be good to make that
sticky until you reach the next thread so you can see where you're up to


Another one - log in using OpenID so I don't have to remember another 
username/password ;)


--
Robert
http://octarineparrot.com/


Re: A new web newsreader

2011-12-08 Thread Robert Clipsham

On 08/12/2011 10:55, Vladimir Panteleev wrote:

As mentioned previously, I've been working on a web frontend for the
DigitalMars NNTP server. I collected ideas and inspiration from the
several threads on this topic in the last few weeks, and now I think
that the result is ready for beta testing and general use.

The current (temporary) URL is:



Here are the highlights:

* Written in D, pull requests are welcome.
https://github.com/CyberShadow/DFeed

* It remembers which posts you've seen on an individual post basis.
By default, read post history is stored in a compressed cookie.

* Optionally, you can register an account, which will store your
preferences and read post history in the server database. There is no
e-mail confirmation etc.


Oooh, it's almost ready enough to let me replace my Thunderbird usage!

A couple of feature requests (some I've already mentioned on IRC):

 * Support syntax highlighting for blocks enclosed with --- like DDoc 
does, maybe other types of blocks too such as {{{}}} that trac uses, or 
whatever github uses.
 * Does the mailing list have the same restriction as gmane has (no 
posting)?
 * Thundrbird has a "mark read" function for 
threads/messages/newsgroups - that'd be really useful.
 * In the horizontal-split view if you scroll down too far in the 
thread you can't see the current thread title, it would be good to make 
that sticky until you reach the next thread so you can see where you're 
up to




--
Robert
http://octarineparrot.com/


Re: rt_finalize WTFs?

2011-12-05 Thread Robert Clipsham

On 05/12/2011 01:46, dsimcha wrote:

I'm at my traditional passtime of trying to speed up D's garbage
collector again


Have you thought about pushing for the inclusion of CDGC at all/working 
on the tweaks needed to make it the main GC?


--
Robert
http://octarineparrot.com/


Re: Website message overhaul, pass 2

2011-11-21 Thread Robert Clipsham

On 21/11/2011 05:31, Andrei Alexandrescu wrote:

On 11/20/11 2:40 AM, Andrei Alexandrescu wrote:

Thanks to all who provided feedback! I read again the entire thread,
then made one more pass:

http://d-programming-language.org/new/


I made one more pass and improved the homepage in a number of ways.
(Learned about  more than I ever wanted to know...)

* The news column is now on the right.


Something that's just annoyed me thoroughly now you've done this (though 
it didn't before for some reason) - my eyes have to look all over the 
place to see everything on the screen. Please use something like:


body {
max-width: 1300px;
margin: 0px auto;
}

This won't be noticeable for smaller screens, but on larger screens it 
makes the page a lot more readable.



* Border is thinner

* The page behaves better when shrinking laterally


On my laptop's screen (1280x800, not the smallest) the title doesn't fit 
on one line. Titles should not be so long!



* Footer is better integrated

* Copyright text is smaller


Andrei



--
Robert
http://octarineparrot.com/


Re: Website message overhaul, pass 2

2011-11-21 Thread Robert Clipsham

On 21/11/2011 00:13, Jonathan M Davis wrote:

On Sunday, November 20, 2011 23:47:42 Robert Clipsham wrote:

On 20/11/2011 21:49, Vladimir Panteleev wrote:

The D Programming Language: Modern Convenience, Modeling Power, Native
Efficiency


I'm not sure about the capitalization


Too many capitals!

The D Programming Language: Modern convenience, modeling power, native
efficiency.

The - Start of a sentence
D Programming Language - a noun.
Modern - comes after a colon.


I completly disagree. It's the title. You're _supposed_ to capitalize there.
It looks just plain wrong to not capitalize those words. If it were in a
sentence, that would be one thing, but titles follow different rules of
capitalization.

- Jonathan M Davis


It's a title?! Oh yeah, scrap then, capitalise it all.

--
Robert
http://octarineparrot.com/


Re: Website message overhaul, pass 2

2011-11-20 Thread Robert Clipsham

On 20/11/2011 21:49, Vladimir Panteleev wrote:

The D Programming Language: Modern Convenience, Modeling Power, Native
Efficiency


I'm not sure about the capitalization


Too many capitals!

The D Programming Language: Modern convenience, modeling power, native 
efficiency.


The - Start of a sentence
D Programming Language - a noun.
Modern - comes after a colon.

--
Robert
http://octarineparrot.com/


Re: Website message overhaul, pass 2

2011-11-20 Thread Robert Clipsham

On 20/11/2011 19:55, Andrei Alexandrescu wrote:

On 11/20/11 7:09 AM, Robert Clipsham wrote:

- The code sample at the top is terrible, the equivalent C is only a
couple of lines longer and it doesn't show off any of what makes D
better! Admittedly you're limited in what you can do here as the code
needs to be fairly understandable by non-D programmers, but what's there
is... Not good at all.


I'd be curious how with only a couple of lines more you address in C
lines of arbitrary length and proper error handling. Same goes about C++
(in addition to the speed issue) - code that does the right thing and is
not very slow is quite subtle and I doubt two out of five C++
programmers know how to write it.


I don't have time to write up an example, however a C/C++ programmer 
reading that code would have no idea any error handling was happening.



I like that the main message is small enough to allow formatting in
large font.


I personally don't find it very readable with it all being on one line, 
I feel breaking it into two looks far nicer (I did try).



- convinience -> convenience


Where?


No idea! :D


- I can't really fault the bullet points, they're a huge improvement.
- I have a reasonably large screen and can't see the news section
without scrolling. To me this means there is no news ;)


I'm considering moving the news on the right-hand side.


I think it would be quite good to put it in the already existent sidebar 
- as I've already mentioned, I don't see the sidebar unless I really 
look for it (it looks too much like it's part of the background)... With 
a bit of tweaking I think you could make it more noticeable (without 
being intrusive) and have the twitter feed in there (thus saving 
horizontal space for those with small screens).


--
Robert
http://octarineparrot.com/


Re: Website message overhaul, pass 2

2011-11-20 Thread Robert Clipsham

On 20/11/2011 08:40, Andrei Alexandrescu wrote:

Thanks to all who provided feedback! I read again the entire thread,
then made one more pass:

http://d-programming-language.org/new/

I didn't make technical/aesthetic changes (JS/noJS, placement of news,
links to secondary pages etc) so when providing additional feedback
please focus on the core message.

There are significant changes of content: some keywords are different,
text is shorter, no more "community" section (probably it'll go on a
different page).

There's a prominent example at the top. I'm thinking to rotate that
randomly, and pick examples out of an always-running contest.


Thanks,

Andrei


This is a huge improvement! Ignoring the broken +Example links:

 - The code sample at the top is terrible, the equivalent C is only a 
couple of lines longer and it doesn't show off any of what makes D 
better! Admittedly you're limited in what you can do here as the code 
needs to be fairly understandable by non-D programmers, but what's there 
is... Not good at all.
 - Rotating the example is a brilliant idea, particularly if powered by 
a continuous contest.
 - This is less about the message, but how about an "explain this" link 
in the corner of examples with little hints for C/C++/Java programmers, 
so when clicked additional comments appear in the code or bubbles appear 
above on hover or something, they would include small bits of text like 
"auto can be used in place of a type to infer the type from what is 
being assigned"... But better worded of course.
 - Maybe it's just me, but I don't like the title being so long. I 
think "The D Programming Language" on its own is fine. The rest of it 
may still have a place, but it needs to be elsewhere in my opinion (even 
if it just moves to the line below).
 - Your summary sentence at the start reads "It pragmatically combines 
efficiency, control, and modeling power, with safety and programmer 
productivity." You then go on to talk about convinience, power and 
efficiency... http://en.wikipedia.org/wiki/Topic_sentence The sentence 
needs to be changed to reflect what you go on to detail below - 
currently you're making statements without backing them up (note that 
you do back up most of it, not all of it though, and the subheadings 
don't make it obvious where you can find out more about the claims).

 - convinience -> convenience
 - I can't really fault the bullet points, they're a huge improvement.
 - I have a reasonably large screen and can't see the news section 
without scrolling. To me this means there is no news ;)


I'm starting to nit-pick, it must be getting better.

--
Robert
http://octarineparrot.com/


Re: Website message overhaul

2011-11-15 Thread Robert Clipsham

On 15/11/2011 07:26, Jacob Carlborg wrote:

As I'm already a D user I'm looking first for Library reference and
Language reference. I mean, if I am a D user I most likely already have
a compiler installed and doesn't have to look for that as much as the
points.


I used an ordered list because I was planning to refer to individual 
points later, I ended up not doing it though... They weren't in any 
particular order!


The reason for download links being there is for new compiler versions.

--
Robert
http://octarineparrot.com/


Re: Website message overhaul

2011-11-14 Thread Robert Clipsham

On 14/11/2011 01:50, Andrei Alexandrescu wrote:

Walter and I have been working on the website for a while. We want to
crystallize a clear message of what the D programming language is.

Please take a look at http://d-programming-language.org/new/. The work
is content-only (no significant changes in style, though collapsible
examples and twitter news are a new style element).

Feedback is welcome.


Thanks,

Andrei


Another point, partially based on things others have said that I've now 
read:


As I mentioned in another post, myself (and many, many others I'm sure) 
have the ability to look at a page and automatically find what we want 
without reading anything. People visiting dpl.org will be in one of two 
groups:


 - Potential D users
 - D users

What they want to see:

= Potential D users
 i  ) Sample code
 ii ) Reasons to use D
 iii) Download/try/setup links
 iv ) How to find out more

= D users
 v   ) Download links
 vi  ) How to get help
 vii ) Language reference
 viii) Library reference
 ix  ) News/things of interest
 x   ) Current version (Do I have the latest and greatest? This will be 
less important as the language continues to mature)

 xi  ) Changelog (see above, less important with time)
 xii ) How to get involved.

This is a lot of information to get onto one page, but it can easily be 
simplified with a simple bit of knowledge - D users have seen the page 
before.


Related note: I can't find any of these by looking at the D front page, 
despite having seen it hundreds of times (yes, I know most of it is in 
the sidebar, that's not something I see without thinking about it 
though, I automatically assume it's just part of the background).


--
Robert
http://octarineparrot.com/


Re: Website message overhaul

2011-11-14 Thread Robert Clipsham

On 14/11/2011 20:12, Andrei Alexandrescu wrote:

On 11/14/11 11:04 AM, Robert Clipsham wrote:

- From the first look at the page it's a big block of text with no
code. Very off putting from a programming language home page.


I think the current page with a big block of code is quite unappealing,
too.


Well neither is ideal! It'll probably take some fine-tuning to get the 
right balance.



- My advise here would be to *just* show the key bullet points,
click for more information.


Duly noted.


I always found this really annoying (though it seems to work well for a 
lot of things) - having an automatic scroll through the bullet points 
showing them in more detail could work though.



- It's covered in buzz words. Are you trying to appeal to managers or
programmers?


Programmers. Of the language sites I looked at, scala-lang.org looked
the most corporate-y.

We are trying to convey the key advantages of D in few words. If we used
weaker words, the message would be, well, weak. The point is that we
really have something to show under each "buzzword".


few words + little code = big impact

At least in my opinion. I know this differs a lot, but most of my 
generation don't read more than a few words on screen unless they have 
to, their eyes jump almost immediately to what they want to see. Having 
some code and some text is probably the best way to simplify this.



- "See example." is actually show/hide example, the text should
reflect this.


Hm, that should change when expanded. More work for me, sigh.


It's only a couple of lines of code ;)


- Community
- Maybe mention the IRC channel #D on freenode.


Yah, forgot


- There's no need for the "Walter Bright" name-drop, particularly in
a community section (Walter is not the community!)


Walter is the most prominent member of the community. I think the
mention is entirely appropriate. In particular, we noted that the old
site doesn't mention Walter as the creator of D, and that many people
don't know who invented D.


I challenge you to find a programming language website that mentions the 
creator on the front page. It's not that I don't think Walter deserves 
credit for his work, just that I don't deem it such an important detail 
that it needs to be on the homepage.


Also, should D gain popularity I foresee Walter being bombarded with 
direct questions rather than them coming to the community who are just 
as qualified to answer a lot of them - having his name on the front page 
won't help this :)


--
Robert
http://octarineparrot.com/


Re: Website message overhaul

2011-11-14 Thread Robert Clipsham

On 14/11/2011 01:50, Andrei Alexandrescu wrote:

Walter and I have been working on the website for a while. We want to
crystallize a clear message of what the D programming language is.

Please take a look at http://d-programming-language.org/new/. The work
is content-only (no significant changes in style, though collapsible
examples and twitter news are a new style element).

Feedback is welcome.


Thanks,

Andrei


 - From the first look at the page it's a big block of text with no
   code. Very off putting from a programming language home page.
- My advise here would be to *just* show the key bullet points,
  click for more information.
 - It's covered in buzz words. Are you trying to appeal to managers or
   programmers?
 - "See example." is actually show/hide example, the text should
   reflect this.
 - Community
- Maybe mention the IRC channel #D on freenode.
- There's no need for the "Walter Bright" name-drop, particularly in
  a community section (Walter is not the community!)
 - Contribute
- First thing I see is a bullet pointed list of compilers, DMD is
  not listed, perhaps the surrounding text needs to be re-worded
- inconsistent capitalization of (C|c)ompiler
- Definitely needs a "Fork us on github" banner of some sort

A key thing I find missing is code - the first thing I want to see when 
I visit the home page of a new language is sample code.


My advise here would be to always have a code section on one side, then 
have more information on the other, describing what the code is 
demonstrating. Something like http://imgur.com/QL619 where the right 
hand side would have code, the left hand side your 3 key points.


--
Robert
http://octarineparrot.com/


Re: 64 bit version?

2011-09-25 Thread Robert Clipsham

On 22/09/2011 21:12, Trass3r wrote:

or ldc, I thought that could also compile d2


LLVM still doesn't support SEH, though it's being worked on.


The latest development code does for Win64.

--
Robert
http://octarineparrot.com/


Re: Formal Review of region allocator begins

2011-09-07 Thread Robert Clipsham

On 07/09/2011 15:10, dsimcha wrote:

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

On 9/7/11 8:45 AM, Michel Fortin wrote:

Every time I read std.regionallocator, I read "regional locator" and I
find it hillarious. :-)

Yes. That is part of my upcoming review. region_allocator please.
Andrei


I was thinking std.allocators.region.


+1

--
Robert
http://octarineparrot.com/


Re: (Un)justified justification

2011-09-03 Thread Robert Clipsham

On 02/09/2011 20:15, Vladimir Panteleev wrote:

On Fri, 02 Sep 2011 22:07:29 +0300, Nick Sabalausky  wrote:


Don't know why I never brought this up until now, but...

I know how much Andrei loves justified text, but maybe, just maybe,
it's not
such a great idea on the website's sidebar menu?:

http://www.semitwist.com/download/img/shots/dpl--justified-is-pretty-and-easy-to-read.png



I think (based on my understanding of Andrei's vision of the website)
that text should have had soft hyphens inserted inside its words by a
JavaScript script (which doesn't work correctly in all browsers), but I
guess you have JS off :)



Javascript for this? D: CSS CAN DO THAT! D:

word-break: hyphenate !important;
word-wrap: break-word;

The !important and second line are only required for firefox/opera 
compatibility, they won't use hyphens though.


--
Robert
http://octarineparrot.com/


Re: NotNull pointers

2011-08-31 Thread Robert Clipsham

On 31/08/2011 22:01, Steven Schveighoffer wrote:

You can catch sigsegv on linux. It takes one call to signal to register
a handler.


Are you sure? I could have sworn it didn't work? If it does work, what 
is the purpose of this library:


http://libsigsegv.sourceforge.net/

--
Robert
http://octarineparrot.com/


Re: NotNull pointers

2011-08-31 Thread Robert Clipsham

On 31/08/2011 21:02, Walter Bright wrote:

On 8/31/2011 4:46 AM, Steven Schveighoffer wrote:

Seg faults are not as useful as asserts. It's a fact.


You might be surprised, then, that I'll often temporarily replace an
assert with a HLT instruction so I can use a debugger on it :-)


What's wrong with 'b _d_assert'? (for gdb at least)

You still get back traces, the ability to inspect variables etc.

--
Robert
http://octarineparrot.com/


Re: NotNull pointers

2011-08-31 Thread Robert Clipsham

On 31/08/2011 21:19, Steven Schveighoffer wrote:

It's also possible for the program to have its own seg fault handler
that reads its own symbolic debug info and generates a line number and
stack trace. There was a patch to Phobos that did this a while back.


This would also be a valid option. I have no idea why that wasn't
included. Do you?


It's not easy to catch SIGSEGV on linux, there's a library that'll do it 
but it's GPL (iirc), an equivalent would need writing from scratch if it 
were to be included in druntime/phobos.


--
Robert
http://octarineparrot.com/


Automatic reference counting

2011-08-29 Thread Robert Clipsham

Hey all,

For those of you that doesn't know, Objective-C primarily uses reference 
counting to manage memory. With the latest releases of clang, it also 
supports automatic reference counting, whereby the compiler 
automatically inserts retain/release messages ("calls" if you don't know 
Obj-C) into the code.


There's a complete spec for it at:
http://clang.llvm.org/docs/AutomaticReferenceCounting.html

My main reason for posting is curiosity - how feasible would it be to 
have something like this in D?


There are obviously a few issues that would need looking at, a way of 
marking weak references for example.


--
Robert
http://octarineparrot.com/


Re: How does pragma(lib) work?

2011-08-27 Thread Robert Clipsham

On 27/08/2011 16:59, dsimcha wrote:

When I add the directive:

pragma(lib, "foo");

to a file called "bar.d" and then do:

dmd -c bar.d

does the object file bar.o or bar.obj contain a directive that reflects
the pragma, or does pragma(lib) only work when compiling and linking in
one step, e.g. dmd bar.d?


pragma(lib) only works with one step compilation - it's useless if you 
want one-at-a-time compilation, hence why rebuild and other tools had 
pragma(link).


--
Robert
http://octarineparrot.com/


Re: [OT] Threading (Was: bug covering other bug)

2011-08-27 Thread Robert Clipsham

On 27/08/2011 15:34, Andrej Mitrovic wrote:

As for using NG clients, I would do that if they offered the same view
mode as gmail. There's actually a thunderbird plugin that makes the
messages appear just like in gmail, however it is painfully slow, so
I'm not using thunderbird.


Funny, I hate gmails interface when it comes to newsgroups! I wish it 
had a proper threaded interface like thunderbird... That way I could 
remove one of the few remaining apps I use on a daily basis.


--
Robert
http://octarineparrot.com/


Re: Chances of D getting proper runtime reflection?

2011-08-21 Thread Robert Clipsham

On 21/08/2011 14:13, Vladimir Panteleev wrote:

On Sun, 21 Aug 2011 15:16:11 +0300, Jacob Carlborg  wrote:


Yes, I know. But the point is to be able to do it without the use of
mixins. It needs to work with third party types, otherwise there no
use. It also needs to work when the static type is Object.

You're already paying for the class info, which already contains
getMembers. But this methods always returns an empty array and as far
as I can see, it's not possible to set/get fields or call methods via
these member instances.


I think the best way to do this is to improve compile-time reflection to
the point where it'd be possible to enumerate all declarations in a
module and create run-time reflection information for them - then you'd
just need to specify the modules for which you'd like run-time
reflection. One thing to note is that there are use cases where more
run-time information about a program's internals may not be desired,
e.g. with commercial closed-source applications, so this would need to
be optional.



I completely agree. I'd love to get rid of classinfo while we're at it 
to be honest, that's a heck of lot of bloat that isn't needed/can be 
done in a far nicer way.


--
Robert
http://octarineparrot.com/


Re: Chances of D getting proper runtime reflection?

2011-08-21 Thread Robert Clipsham

On 21/08/2011 16:05, Jacob Carlborg wrote:

This is for a serialization library where third party types need to be
serializable. I don't like the idea of annotate everything that should
be serializable.


You don't need to annotate it:

void serialize(T)(T something);

You have access to all the CT reflection stuff, and can generate the 
necessary runtime reflection with that.


--
Robert
http://octarineparrot.com/


Re: Chances of D getting proper runtime reflection?

2011-08-21 Thread Robert Clipsham

On 21/08/2011 11:55, Jacob Carlborg wrote:

What are the chances of D getting proper runtime reflection? Something
like this:

class Foo
{
private int a;

private void bar (int i)
{
a = i;
}
}

auto foo = new Foo;
Object o = foo;
o.setInstanceVariable("a", 3);
assert(foo.a == 3);

This would be useful as well:

o.send("bar", 5);
assert(foo.a == 5);
assert(foo.a == o.getInstanceVariable("a"));

Currently I have most use of the first example. These example should
work regardless if the fields/methods are private, protected or public.

As far as I know this wouldn't require any changes to the language, only
the compiler and runtime would need to be modified. To me, it doesn't
look that complicated to implement, the runtime just needs to store an
associative arrays that maps names of instance variables and methods to
their addresses. This could probably be stored in the ClassInfo.
Something like this:

Foo.classinfo.setInstanceVariable(foo, "a", 3);

And this could be shorted to:

o.setInstanceVariable("a", 3);

"setInstanceVariable" could just forward the call to the class info.



You can actually do all of this now (albeit using a mixin), there's just 
no standard way of doing it. All you need to do is use compile time 
reflection to pull out all the fields/methods then store them for use at 
runtime. It would be good to get this functionality into phobos so 
there's a standard way of doing it though. The plus side to having to 
use a mixin is you don't get loads of bloat from classes you never want 
to reflect at runtime.


--
Robert
http://octarineparrot.com/


Re: llvm's SAFECode bounds checking algorithm

2011-08-21 Thread Robert Clipsham

On 20/08/2011 16:40, Walter Bright wrote:

http://llvm.org/pubs/2006-05-24-SAFECode-BoundsCheck.pdf

What it does is rewrites the program to install runtime checks on
pointers to ensure no array bounds overflows.

It indicates to me the effort being poured into C to try to make it
memory safe, and how memory safety has become a huge issue in
programming. We are on the right track with D with our focus on making D
proveably memory safe.




Given that a large part of D should be writable using @safe, perhaps we 
should look into making @safe default and having to explicitly write 
@system or @trusted for a function? This is obviously a no-go in D's 
current state (most of phobos/druntime aren't appropriately annotated 
and I believe there are a good few things that @safe forbids but 
could/should permit), but it would be cool to say "D is memory safe by 
default, the programmer has to explicitly state if it's not". Perhaps 
this could be done with a compiler switch for now to see how well it 
works in the real world/evaluate whether it's actually doable/what needs 
doing to make it doable.




--
Robert
http://octarineparrot.com/


Re: Should unreachable code be considered an error?

2011-08-18 Thread Robert Clipsham

On 18/08/2011 13:38, Bernard Helyer wrote:

Faramir on the Ars forums makes an excellent point:

"With the c preprocessor, both theoretically and as it is used in
practice, you can easily get dead code in certain compile paths that is
live in others."

I think template mixins can achieve the same sort of shenanigans. I think
warning it is.


Definitely a warning, I get a lot of dead code during development - 
making it an error would be annoying, I only care about the dead code 
when it gets to release/commit time and I'm cleaning the code up.


--
Robert
http://octarineparrot.com/


Re: Switch: Case Range Syntax

2011-08-17 Thread Robert Clipsham

On 17/08/2011 20:35, Jacob Carlborg wrote:

D should have a built-in range type.


+1 or maybe +2 if I get an extra vote ;)


One that supports syntax for both
including and excluding the last element:

auto a = 3 .. 5
auto b = 3 ... 5





Then we wouldn't need a special range syntax for switch statements. You
could store ranges in variables and pass them to functions. opSlice
probably wouldn't be needed, instead opIndex could be used and you would
declare the method to take a range instead of two integers.


--
Robert
http://octarineparrot.com/


Re: CTFE - compiling other languages inside D

2011-08-10 Thread Robert Clipsham

On 10/08/2011 21:32, Marco Leise wrote:

For starters, how about this?:
static string someExternalText = __ctfeReadFile("external.txt");
static byte[] chipInitialState = __ctfeReadFile("initial_state.bin");
Every external file used in compiling a source file would be added to
the list of files to check for their modification date in relation to
the resulting object file. This ensures that the object is recreated
when either of the sources change. The list can be in a separate file
per each D source using this feature.

This offers:
- no execution of arbitrary commands
- usual compile-if-newer logic doesn't reinvent the wheel
- compile-time conversion of C headers
- add snippets in domain specific languages by their own respective
source files
- include microcode blobs and other binary data in your modules if desired

Personally I think this idea rocks, but YMMV :p .


You can already do that!

enum _ = import("someFile");

Then when compiling, use the -J switch (required) to specify the include 
directory.


--
Robert
http://octarineparrot.com/


Re: path tracing benchmark

2011-08-10 Thread Robert Clipsham

On 10/08/2011 17:43, Trass3r wrote:

Am 10.08.2011, 18:16 Uhr, schrieb Robert Clipsham
:

On 10/08/2011 14:49, Trass3r wrote:

Had a quick look at the source, no indications that -O4 and O5 do
anything more than -O3.


They don't, there's no way to do LTO built into LDC. I seem to recall
some conversation about adding it, I may just be remembering this
thread though *g*


Why is there no way?


Patches welcome ;)


Can't LDC be modified to support gold+plugin just like clang?


Of course it can - I said "built into", not "in". The only reason it's 
not there is because no one has written support for it.


--
Robert
http://octarineparrot.com/


Re: path tracing benchmark

2011-08-10 Thread Robert Clipsham

On 10/08/2011 14:49, Trass3r wrote:

LDC does have -O4 and -O5 switches but they probably don't work?!


Had a quick look at the source, no indications that -O4 and O5 do
anything more than -O3.


They don't, there's no way to do LTO built into LDC. I seem to recall 
some conversation about adding it, I may just be remembering this thread 
though *g*


--
Robert
http://octarineparrot.com/


Re: DB ORM

2011-08-09 Thread Robert Clipsham

On 09/08/2011 08:30, Jonas Drewsen wrote:

Just stumbled upon this db orm for c++ that uses the gcc frontend to
rewrite c++ code to make classes suitable for database access.

http://www.codesynthesis.com/products/odb/

They are using pragmas to accomplish this. I guess an equally good
implementation in D would use custom attributes for this once (if) they
are supported.

/Jonas


How ugly! My (far from complete, but good enough to demonstrate what D 
can do) ORM is far simpler than that:


https://github.com/mrmonday/serenity (actually a web framework, includes 
an incomplete ORM)



struct Post
{
   ulong id;
   DateTime dt;
   string title;
   string content;
}
Persister!Post posts;

// Append a post
posts ~= Post(0, someDateTime, "A title", "Some content");

foreach (post; posts[0..5])
{
   // Iterate over the first 5 posts
}
post[3] = posts[2];


All SQL is generated at compile time, and the backend database is called 
directly - that's less overhead than you'd get from a typical scripting 
language accessing a database directly (no need to convert between types 
first).


--
Robert
http://octarineparrot.com/


Re: Does the 'package' protection attribute not work?

2011-08-08 Thread Robert Clipsham

On 08/08/2011 02:10, Jonathan M Davis wrote:

Ah. Then package is horribly broken at the moment. Lovely. I guess that that
just goes to show that it's not used heavily or there would be a lot more
complaints about it.


Another possibility is it's not used because it doesn't work - that's my 
current situation, and I don't bother complaining about it as these 
problems have been known since long before D1.0 was released, let alone D2.


--
Robert
http://octarineparrot.com/


Re: macro keyword taken?

2011-08-07 Thread Robert Clipsham

On 07/08/2011 23:59, Andrej Mitrovic wrote:

So I wanted to make myself a template called "macro", but it turns out
it's a keyword:

template macro()
{
}

test.d(7): TemplateIdentifier expected following template
test.d(7): Declaration expected, not 'macro'

Is there something planned with this keyword?


It was originally going to be used in D2 for AST macros, however it was 
found that string mixins (an already existing feature) were already as 
powerful as the proposed AST macros. As such, the keyword is reserved 
for future use, possibly in D3 once the details have been reconsidered.


There's a video lying around somewhere of Walter presenting what would 
have been macros somewhere if you're interested.


--
Robert
http://octarineparrot.com/


Re: Does the 'package' protection attribute not work?

2011-08-07 Thread Robert Clipsham

On 07/08/2011 22:18, Jonathan M Davis wrote:

Personally, I don't see much point in using the package specifier when you're
not actually using a package hierarchy (you're just making it so that
everything but stuff which actually uses a hierarchy can use the function - it
would be a really weird distinction to make). So, it wouldn't entirely
surprise me if this is completely by design. It might be a bug though.


Except package is ~100% useless if you use an *actual* package 
hierarchy[1][2][3] (not like phobos which just drops everything in a 
top-level package).




- Jonathan M Davis


[1] http://d.puremagic.com/issues/show_bug.cgi?id=143
[2] http://d.puremagic.com/issues/show_bug.cgi?id=2529
[3] http://d.puremagic.com/issues/buglist.cgi?quicksearch=package


--
Robert
http://octarineparrot.com/


Re: Run Microsoft Analyzer over dmd source code

2011-08-07 Thread Robert Clipsham

On 07/08/2011 18:34, Walter Bright wrote:

On 8/7/2011 7:23 AM, Vladimir Panteleev wrote:

2979 warnings with code analysis with the "Microsoft Minimum
Recommended Rules"
ruleset.
http://dump.thecybershadow.net/2e0571641194d945869a1b12b29aacdc/DMD.log


Thanks, this is what I was looking for!



I'll see if I can get it in a more readable format (something like the
HTML
files clang's scan-build outputs).


clang's format is more readable, but it's actually rather agonizing to
go through because it takes upwards of a minute for each report to load.
When there are hundreds to look at, you're looking at hours of waiting.


It's actually instant[1], the only reason it seemed so slow for you is 
because the html is on my (wireless) home server, and you were 
connecting to my web server which was proxying all the content with no 
caching (yay quick hacks) - so you had to put up with my slow upload 
speeds and slow wireless as well as the proxying.


[1] This is based on me accessing it locally or across my home network.

--
Robert
http://octarineparrot.com/


  1   2   3   4   5   >