Re: dmd 1.047 and 2.032 releases

2009-09-06 Thread Graham St Jack
Its great to see so many bugs being sorted out.

However, I am having all kinds of trouble with shared, which up until 
now I have been able to fairly easily sidestep. Here is a cut-down 
example of what I am trying to do, which is to have one thread acquiring 
data and passing it on to another thread via a queue which uses 
appropriate synchronization mechanisms to make things thread-safe. The 
data passed through is immutable, so theoretically everything should be 
fine.

This kind of thing is very routine in multi-threaded programs, and should 
be easy to pull off. I find I have to do heaps of nasty casting to get 
past the compiler (the immutable assignment thing is a side issue).

Is there a neater syntax for this? How about being able to say shared 
immutable class Message {...} (or just shared or just immutable or just 
const), and then all instances (new, local, parameter, return) would 
automatically be shared and immutable?


class Message {
int data_;
this(int value) {
data_ = value;
}
int get() immutable {
return data_;
}
}

// queue-like synchronized container
class Queue {
immutable(Message) msg_;

this() {
msg_ = null;
}

synchronized void add(immutable(Message) msg) {
Message * tmp = cast(Message *) msg_;
*tmp = cast(Message) msg;
}
synchronized immutable(Message) remove() {
return msg_;
}
}


int main(string args[]) {
// pretend to be one thread queueing an object
auto queue = cast(shared) new Queue();
auto message = cast(immutable) cast(shared) new Message(1);
queue.add(message);

// pretend to be another thread taking the data and working with it
return queue.remove.get;
}



Re: Compiled dmd2.032 in VC++ 2009!

2009-09-06 Thread Jeremie Pelletier
Rainer Deyke Wrote:

 Jeremie Pelletier wrote:
  bearophile Wrote:
  - if(de.name[$-2 .. $] == .c) is a bit unsafe, (...)
  I don't see how unsafe that is in this context.
 
 Potential buffer underrun.
 http://www.digitalmars.com/d/1.0/arrays.html: A program may not rely on
 array bounds checking happening
 
 
 -- 
 Rainer Deyke - rain...@eldwood.com

Oh yeah, didn't think about that one here. I usually test for the string length 
before slicing it.


D on the Objective-C runtime?

2009-09-06 Thread Jacob Carlborg
I've been thinking for a while what it would take to get D running on 
the Objective-C runtime, in other words a D object will actually be an 
objc object, kind of like MacRuby but for D. How difficult it would be, 
how much work, what needs to change, both the runtime and the compiler? 
And if it would be worth the trouble.


The reason for this is to make it easier to interface with Mac OS X 
system libraries like Cocoa.



/Jacob Carlborg


Re: D on the Objective-C runtime?

2009-09-06 Thread Michel Fortin

On 2009-09-06 06:10:03 -0400, Jacob Carlborg d...@me.com said:

I've been thinking for a while what it would take to get D running on 
the Objective-C runtime, in other words a D object will actually be an 
objc object, kind of like MacRuby but for D. How difficult it would be, 
how much work, what needs to change, both the runtime and the compiler? 
And if it would be worth the trouble.


The reason for this is to make it easier to interface with Mac OS X 
system libraries like Cocoa.


It certainly could be done, but first you'd need a way to handle the 
differences between Objective-C and D methods:


- Objective-C methods are of the form setObject:forKey:, which is 
difficult to map to D.

- Objective-C methods do not support overloading.
- Objective-C class methods (equivalent to D static member functions) 
are virtual, this is used within Cocoa
- Objective-C 2.0 allows a default method implementation in protocols 
(equivalent to D interfaces).

- Templates, exceptions?

If all you wanted was to make D work using the Objective-C runtime 
(with overloading), you could apply some special name mangling rules, 
but that would make it pretty incompatible with anything really in 
Objective-C.


On the other side, you could change the D method syntax to disallow 
overloading, use that colon-separated-multiple-part syntax, depend on 
static methods being virtual (this pattern is used at some places in 
Cocoa) and add the capability to interfaces to have default 
implementations. but then it wouldn't really be D.


Another approach is my D/Objective-C bridge: 
http://michelf.com/projects/d-objc-bridge/, which allows you to write 
a bridged class like below. It needs D1 and is not multithreaded, only 
can do classes (no protocols, no categories for now), but it works 
quite well for what it does.


class AppController : NSObject {

/** Counter for window title in openWindow. */
uint windowCount;

this() {
super();
}

/** Open this application's website. */
void openWebsite(Object sender) {
auto a = NSAlert.alert(Cannot open web site., OK, null, 
null,
The D/Objective-C bridge doesn’t have access to NSWorkspace 
yet, 
so we cannot open a website. Displaying an alert works 
though. ;-));
a.runModal;
}

/** Open a new window and put it on the center of the screen. */
void openWindow(Object sender) {
auto window = new NSWindow(NSMakeRect(20, 20, 300, 200),
			NSTitledWindowMask + NSClosableWindowMask + 
NSMiniaturizableWindowMask + NSResizableWindowMask,

NSBackingStoreType.BUFFERED, false);
window.title = untitled ~ std.string.toString(++windowCount);
window.center();
window.makeKeyAndOrderFront(this);
}

// Objective-C binding for IB actions.
mixin IBAction!(openWindow);
mixin IBAction!(openWebsite);


// Overrides from NSApplication delegate.

bool openUntitledFile(NSApplication sender) {
openWindow(sender);
return true;
}

bool shouldTerminateAfterLastWindowClosed(NSApplication sender) {
return true;
}

// Objective-C bindings for the above delegate methods.
	mixin ObjcBindMethod!(openUntitledFile, bool, 
applicationOpenUntitledFile:, NSApplication);
	mixin ObjcBindMethod!(shouldTerminateAfterLastWindowClosed, bool, 
applicationShouldTerminateAfterLastWindowClosed:, NSApplication);


}

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



Error: mixin is not defined (dmd v2.032)

2009-09-06 Thread Tyro
the following appears on line 876 of control.d in the DFL package: 
mixin OpApplyAddIndex!(opApply, Control); 

Attempting to compile it results in the following error message: 
control.d(876): Error: mixin is not defined 

I've compiled my copy of DFL with every release of dmd starting with v2.021 
only encountering this problem with the release of v2.032. 

Here is another problem that cropped up with this release: 
control.d(783): Error: identifier 'HWND' is not defined 

I'm not too worried about that one because it was easily resolved with: 
private import std.c.windows.windows: HWND; 

Any ideas?


Re: Error: mixin is not defined (dmd v2.032)

2009-09-06 Thread Denis Koroskin

On Sun, 06 Sep 2009 15:15:14 +0400, Tyro nos...@home.com wrote:


the following appears on line 876 of control.d in the DFL package:
mixin OpApplyAddIndex!(opApply, Control);

Attempting to compile it results in the following error message:
control.d(876): Error: mixin is not defined

I've compiled my copy of DFL with every release of dmd starting with  
v2.021 only encountering this problem with the release of v2.032.


Here is another problem that cropped up with this release:
control.d(783): Error: identifier 'HWND' is not defined

I'm not too worried about that one because it was easily resolved with:
private import std.c.windows.windows: HWND;

Any ideas?


A bug was reported a while ago that states that some imports are being  
ignored by DMD 2.032. I guess your behavior has something to do with that  
bug.


Re: D on the Objective-C runtime?

2009-09-06 Thread Jacob Carlborg

On 9/6/09 12:51, Michel Fortin wrote:

On 2009-09-06 06:10:03 -0400, Jacob Carlborg d...@me.com said:


I've been thinking for a while what it would take to get D running on
the Objective-C runtime, in other words a D object will actually be an
objc object, kind of like MacRuby but for D. How difficult it would
be, how much work, what needs to change, both the runtime and the
compiler? And if it would be worth the trouble.

The reason for this is to make it easier to interface with Mac OS X
system libraries like Cocoa.


It certainly could be done, but first you'd need a way to handle the
differences between Objective-C and D methods:

- Objective-C methods are of the form setObject:forKey:, which is
difficult to map to D.


I was thinking you sill have to create bindings and use objc_msgSend and 
friends. Or something like extern (Objc) void foo (int arg1, int 
arg2); would automatically be converted to objc_msgSend(this, 
sel_registerName(foo:arg2), arg1, arg2);.



- Objective-C methods do not support overloading.


void foo (int arg1, int arg2) could be transformed to foo:arg2 or 
similar.



- Objective-C class methods (equivalent to D static member functions)
are virtual, this is used within Cocoa


This would be a problem.


- Objective-C 2.0 allows a default method implementation in protocols
(equivalent to D interfaces).
- Templates, exceptions?


D would use the the objc exceptions and add new exception classes where 
necessary. Templates would probably be disallowed.



If all you wanted was to make D work using the Objective-C runtime (with
overloading), you could apply some special name mangling rules, but that
would make it pretty incompatible with anything really in Objective-C.

On the other side, you could change the D method syntax to disallow
overloading, use that colon-separated-multiple-part syntax, depend on
static methods being virtual (this pattern is used at some places in
Cocoa) and add the capability to interfaces to have default
implementations. but then it wouldn't really be D.


I do not want the colon-separated-multiple-part syntax. I don't want to 
modify the compiler too much, I sill want it to be D but virtual static 
methods could be an acceptable modification for example.



Another approach is my D/Objective-C bridge:
http://michelf.com/projects/d-objc-bridge/, which allows you to write
a bridged class like below. It needs D1 and is not multithreaded, only
can do classes (no protocols, no categories for now), but it works quite
well for what it does.


Yes I know about your D/objc bridge.


class AppController : NSObject {

/** Counter for window title in openWindow. */
uint windowCount;

this() {
super();
}

/** Open this application's website. */
void openWebsite(Object sender) {
auto a = NSAlert.alert(Cannot open web site., OK, null, null,
The D/Objective-C bridge doesn’t have access to NSWorkspace yet, 
so we cannot open a website. Displaying an alert works though. ;-));
a.runModal;
}

/** Open a new window and put it on the center of the screen. */
void openWindow(Object sender) {
auto window = new NSWindow(NSMakeRect(20, 20, 300, 200),
NSTitledWindowMask + NSClosableWindowMask + NSMiniaturizableWindowMask +
NSResizableWindowMask,
NSBackingStoreType.BUFFERED, false);
window.title = untitled ~ std.string.toString(++windowCount);
window.center();
window.makeKeyAndOrderFront(this);
}

// Objective-C binding for IB actions.
mixin IBAction!(openWindow);
mixin IBAction!(openWebsite);


// Overrides from NSApplication delegate.

bool openUntitledFile(NSApplication sender) {
openWindow(sender);
return true;
}

bool shouldTerminateAfterLastWindowClosed(NSApplication sender) {
return true;
}

// Objective-C bindings for the above delegate methods.
mixin ObjcBindMethod!(openUntitledFile, bool,
applicationOpenUntitledFile:, NSApplication);
mixin ObjcBindMethod!(shouldTerminateAfterLastWindowClosed, bool,
applicationShouldTerminateAfterLastWindowClosed:, NSApplication);

}





Re: D on the Objective-C runtime?

2009-09-06 Thread Michel Fortin

On 2009-09-06 07:52:27 -0400, Jacob Carlborg d...@me.com said:


On 9/6/09 12:51, Michel Fortin wrote:

On 2009-09-06 06:10:03 -0400, Jacob Carlborg d...@me.com said:


I've been thinking for a while what it would take to get D running on
the Objective-C runtime, in other words a D object will actually be an
objc object, kind of like MacRuby but for D. How difficult it would
be, how much work, what needs to change, both the runtime and the
compiler? And if it would be worth the trouble.

The reason for this is to make it easier to interface with Mac OS X
system libraries like Cocoa.


It certainly could be done, but first you'd need a way to handle the
differences between Objective-C and D methods:

- Objective-C methods are of the form setObject:forKey:, which is
difficult to map to D.


I was thinking you sill have to create bindings and use objc_msgSend 
and friends. Or something like extern (Objc) void foo (int arg1, int 
arg2); would automatically be converted to objc_msgSend(this, 
sel_registerName(foo:arg2), arg1, arg2);.


That doesn't scale very well. Overloading allows both foo(int arg1, 
int arg2) and foo(int arg1, float arg2) to exist in the same scope, 
both would become foo:arg2:.




- Objective-C methods do not support overloading.


void foo (int arg1, int arg2) could be transformed to foo:arg2 or similar.


Yeah, but what if you have foo(int a) and foo(float a)? Then you need 
some kind of name mangling:


   foo(int a)becomes  - fooInt:(int)a
   foo(float a)  becomes  - fooFloat:(int)a

and now the two can exist at the same time in the same class.



- Objective-C class methods (equivalent to D static member functions)
are virtual, this is used within Cocoa


This would be a problem.




- Objective-C 2.0 allows a default method implementation in protocols
(equivalent to D interfaces).
- Templates, exceptions?


D would use the the objc exceptions and add new exception classes where 
necessary. Templates would probably be disallowed.


So now the base exception class is NSException?



If all you wanted was to make D work using the Objective-C runtime (with
overloading), you could apply some special name mangling rules, but that
would make it pretty incompatible with anything really in Objective-C.

On the other side, you could change the D method syntax to disallow
overloading, use that colon-separated-multiple-part syntax, depend on
static methods being virtual (this pattern is used at some places in
Cocoa) and add the capability to interfaces to have default
implementations. but then it wouldn't really be D.


I do not want the colon-separated-multiple-part syntax. I don't want to 
modify the compiler too much, I sill want it to be D but virtual static 
methods could be an acceptable modification for example.


Hum, I think if someone wanted to have Objective-C compatibility it'd 
be better to just add a different syntax for declaring Objective-C 
classes than to try to fit them within D classes, much like with 
Objective-C++.


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



Bug with patch

2009-09-06 Thread Michel Fortin
I submitted a Phobos bug with a patch. Now I wonder: should I signal it 
to someone or just leave it lying there until it's found and applied by 
someone?


(Here's the bug: http://d.puremagic.com/issues/show_bug.cgi?id=3298.)

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



Re: Bug with patch

2009-09-06 Thread Christopher Wright

Michel Fortin wrote:
I submitted a Phobos bug with a patch. Now I wonder: should I signal it 
to someone or just leave it lying there until it's found and applied by 
someone?


(Here's the bug: http://d.puremagic.com/issues/show_bug.cgi?id=3298.)


If it were assigned to someone, you should just wait for that person to 
handle it.


Andrei seems to handle most Phobos development, so I'd assign it to him. 
The worst that happens is that he reassigns it.


Re: D on the Objective-C runtime?

2009-09-06 Thread Christopher Wright

Michel Fortin wrote:
Another approach is my D/Objective-C bridge: 
http://michelf.com/projects/d-objc-bridge/, which allows you to write 
a bridged class like below. It needs D1 and is not multithreaded, only 
can do classes (no protocols, no categories for now), but it works quite 
well for what it does.

snip

/** Open a new window and put it on the center of the screen. */
void openWindow(Object sender) {
}

// Objective-C binding for IB actions.
mixin IBAction!(openWindow);
mixin IBAction!(openWebsite);


Off topic, but this would be a good place for user-defined attributes. 
Then you could write something like:


@IBAction void openWindow(Object sender) {}


Re: Compiled dmd2.032 in VC++ 2009!

2009-09-06 Thread bearophile
Jeremie Pelletier:
I usually test for the string length before slicing it.

Me too, but:
- mammals aren't perfect, and sometimes they forget things, etc. A compiler, 
once well programmed, will not forget such tests.
- such tests added by me and you slow down code a little (but a good compiler 
can remove some of them, GCC and LLVM are able to). This may mean that the time 
saved by D slices being non-saturating (unlike Python ones) may be spent anyway 
by tests added manually by the programmer. If this is true (and I think it may 
be true, I'd like to instrument LDC to run a slicing-heavy D program with and 
without saturation in slice bounds to test if I am right here) then the 
saturating nature of Python slices is better under all points of view, nearly 
efficiency-neutral too :-)

Bye,
bearophile


Re: D on the Objective-C runtime?

2009-09-06 Thread Michel Fortin

On 2009-09-06 08:32:43 -0400, Christopher Wright dhase...@gmail.com said:

Off topic, but this would be a good place for user-defined attributes. 
Then you could write something like:


@IBAction void openWindow(Object sender) {}


Indeed... although IBAction isn't so bad as a mixin, it gets much worse 
with ObjcMethod where it is necessary to list all the argument types to 
allow resolving overloaded functions:


void doOneAndTwo(int i, int j) {}

mixin ObjcMethod(void, doOneAndTwo, doOne:andTwo:, int, int);

Compare to what could be done with a parametrized attribute:

@ObjcMethod(doOne:andTwo:) void doOneAndTwo(int i, int j);

That'd would be a lot more convenient, especially with interfaces for 
which none of the mixin above can work (they insert some static struct 
member to store the attributes).



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



Re: Error: mixin is not defined (dmd v2.032)

2009-09-06 Thread div0
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Denis Koroskin wrote:
 On Sun, 06 Sep 2009 15:15:14 +0400, Tyro nos...@home.com wrote:
 
 the following appears on line 876 of control.d in the DFL package:
 mixin OpApplyAddIndex!(opApply, Control);

 Attempting to compile it results in the following error message:
 control.d(876): Error: mixin is not defined

 I've compiled my copy of DFL with every release of dmd starting with
 v2.021 only encountering this problem with the release of v2.032.

 Here is another problem that cropped up with this release:
 control.d(783): Error: identifier 'HWND' is not defined

 I'm not too worried about that one because it was easily resolved with:
 private import std.c.windows.windows: HWND;

 Any ideas?
 
 A bug was reported a while ago that states that some imports are being
 ignored by DMD 2.032. I guess your behavior has something to do with
 that bug.

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

- --
My enormous talent is exceeded only by my outrageous laziness.
http://www.ssTk.co.uk
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFKo7S2T9LetA9XoXwRAmMcAKCeMC/Mk8LiRdY20IWIBrXCWqdRSACcCxY4
j0qfRSVkOhwxBQ1bj5+vjt4=
=yoMz
-END PGP SIGNATURE-


Re: Compiled dmd2.032 in VC++ 2009!

2009-09-06 Thread div0
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Jeremie Pelletier wrote:
 div0 Wrote:
 Jeremie Pelletier wrote:
 snip

 Sweet. If dmd can compile w/ VS outa the box, I'll start poking around
 in it. Hey you can knock mirco-soft all you like, but VS is the nuts.
 
 Yeah, I side with you here. I may not be a fan of the business model 
 Microsoft uses, but their IDE is oh so sweet. I wish D had such a powerful 
 and full-featured IDE. I use Descent on Ubuntu and Poseidon on Windows; both 
 have their pros and cons yet I don't feel at home like I do in VS in either 
 of them. Poseidon is simple, light and fast, but doesn't have that many 
 features, although the customizable syntax highlighter, project manager and 
 very simple build process are awesome. Descent on the other hand has a very 
 nice syntax analyzer and tons of features, but requires eclipse which is too 
 heavy for my tastes (thanks to java), has no syntax customization so new 
 keywords are marked as errors, and the build process is a pain to setup, even 
 with ant.
 
 Anywho, I've sent my patch for VC++ compatibility to Walter, hopefully the 
 changes will get into the next dmd release.

Nice.
How about the project files? They going to be in as well or at least
dl-able from somewhere?

 - --
 My enormous talent is exceeded only by my outrageous laziness.
 http://www.ssTk.co.uk
 
 I've seen that quote in a comment on slashdot a few weeks ago!

It's not a quote. It's original to myself; I've only ever used it in
this NG from a couple of years back. Though it wouldn't surprise me if
somebody else came up with it as well. Seems like an obvious one...

I staring reading slashdot back when it was called Chips and technology,
but the signal to noise ratio dropped too low for my liking. It started
going downhill the day they added user comments and accelerated once
that open source company got involved. I had a div0 account there, but I
don't recall ever making a comment. Haven't been back there in years.

Nick Sabalausky asked if he could appropriate it a while back,
maybe he posts on slashdot.

- --
My enormous talent is exceeded only by my outrageous laziness.
http://www.ssTk.co.uk
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFKo7fdT9LetA9XoXwRAq/1AKCB50IWA64eUN4QNXsWW5GKNNGsNACfSdLQ
xrnIzw6PjGLnrTriH5Viq6o=
=AClk
-END PGP SIGNATURE-


Re: Bug with patch

2009-09-06 Thread Andrei Alexandrescu

Michel Fortin wrote:
I submitted a Phobos bug with a patch. Now I wonder: should I signal it 
to someone or just leave it lying there until it's found and applied by 
someone?


(Here's the bug: http://d.puremagic.com/issues/show_bug.cgi?id=3298.)


I can't test on OSX for the time being but I'll apply your changes a 
l'aveugle.


Andrei


Re: Compiled dmd2.032 in VC++ 2009!

2009-09-06 Thread Andrei Alexandrescu

Jeremie Pelletier wrote:

Rainer Deyke Wrote:


Jeremie Pelletier wrote:

bearophile Wrote:

- if(de.name[$-2 .. $] == .c) is a bit unsafe, (...)

I don't see how unsafe that is in this context.

Potential buffer underrun.
http://www.digitalmars.com/d/1.0/arrays.html: A program may not rely on
array bounds checking happening


--
Rainer Deyke - rain...@eldwood.com


Oh yeah, didn't think about that one here. I usually test for the string length 
before slicing it.


Probably the way I'd recommend to carry the test is de.name.endsWith(.c).

Andrei


Re: Compiled dmd2.032 in VC++ 2009!

2009-09-06 Thread Jeremie Pelletier
div0 Wrote:
 Jeremie Pelletier wrote:
  div0 Wrote:
  Jeremie Pelletier wrote:
  snip
 
  Sweet. If dmd can compile w/ VS outa the box, I'll start poking around
  in it. Hey you can knock mirco-soft all you like, but VS is the nuts.
  
  Yeah, I side with you here. I may not be a fan of the business model 
  Microsoft uses, but their IDE is oh so sweet. I wish D had such a powerful 
  and full-featured IDE. I use Descent on Ubuntu and Poseidon on Windows; 
  both have their pros and cons yet I don't feel at home like I do in VS in 
  either of them. Poseidon is simple, light and fast, but doesn't have that 
  many features, although the customizable syntax highlighter, project 
  manager and very simple build process are awesome. Descent on the other 
  hand has a very nice syntax analyzer and tons of features, but requires 
  eclipse which is too heavy for my tastes (thanks to java), has no syntax 
  customization so new keywords are marked as errors, and the build process 
  is a pain to setup, even with ant.
  
  Anywho, I've sent my patch for VC++ compatibility to Walter, hopefully the 
  changes will get into the next dmd release.
 
 Nice.
 How about the project files? They going to be in as well or at least
 dl-able from somewhere?

I also mailed them to Walter.

  - --
  My enormous talent is exceeded only by my outrageous laziness.
  http://www.ssTk.co.uk
  
  I've seen that quote in a comment on slashdot a few weeks ago!
 
 It's not a quote. It's original to myself; I've only ever used it in
 this NG from a couple of years back. Though it wouldn't surprise me if
 somebody else came up with it as well. Seems like an obvious one...
 
 I staring reading slashdot back when it was called Chips and technology,
 but the signal to noise ratio dropped too low for my liking. It started
 going downhill the day they added user comments and accelerated once
 that open source company got involved. I had a div0 account there, but I
 don't recall ever making a comment. Haven't been back there in years.
 
 Nick Sabalausky asked if he could appropriate it a while back,
 maybe he posts on slashdot.
 

Well it's a great quote, made me laugh out loud the first time I saw it :)


Re: D naming style?

2009-09-06 Thread Stewart Gordon

Michel Fortin wrote:
snip

Here it is: http://www.digitalmars.com/d/2.0/dstyle.html.


My style more or less resembles this, except:

- Each indentation level is a tab character (by far the most sensible 
way to do things)
- Usually one blank line between class methods, and two between 
module-level declarations

- I nearly always use /+ ... +/ or // to comment out code
- I've variously used UpperCamelCase or ALL_CAPS for enum names, though 
for enum value names it's always ALL_CAPS.  (Phobos breaks both these 
rules in places, e.g. FileMode.Out.)


I've also written a guide on how to name things, but, as far as I know, 
nobody is following it at the moment. Hopefully it can be improved and 
serve as the basis for naming things in Phobos (although I'm beginning 
to be skeptical about that). See 
http://prowiki.org/wiki4d/wiki.cgi?DProgrammingGuidelines.


1. That page contradicts itself - first
`Accessor functions can be nouns, adjectives, or third-person verbs with 
an object.`

then
`Boolean properties should start with is, has, or a modal verb such 
as can and should.`


even giving enabled as an example in each case.

2. `[should we allow some exceptions here? sin(x) comes to mind] `
What is this supposed to mean?

3. One-letter parameter names are, IMO, OK for property setters and 
maybe other cases where the nature of the parameter is obvious from the 
function name.  And when they're the likes of 'x' and 'y' for Cartesian 
coordinates and what they're the coordinates of is obvious.  But 
otherwise, I agree that they ought to be avoided.


4. Maybe you could add something on the question of what to name the 
internal variable that keeps track of a property's value, in order to 
distinguish it from the property itself.  I personally tend to use the 
property name prefixed by an underscore.



Stewart.


Derelict+Tango

2009-09-06 Thread Kamil Dabrowski
Well, I'm trying to compile Derelict with Tango and I see the following output 
from dmd: 

warning - io.File functionality has migrated to static functions within 
io.device.File 
buildme.d(176): Error: class buildme.Builder D compiler and phobos' object.d 
are mismatched 
buildme.d(248): Error: class buildme.BudBuilder D compiler and phobos' object.d 
are mismatched

I use it like that: 
dmd -run buildme.d

with the PATH set and sc.ini file with content: 
[Version] 
version=7.51 Build 020 

[Environment] 
li...@p%\..\..\tango\lib 
DFLAGS=-version=Tango  -...@p%\..\..\tango\import 
-defaultlib=tango-base-dmd.lib -debuglib=tango-base-dmd-d.lib 
-L+tango-user-dmd.lib 

My dmd1 folder lies near tango folder. DMD is the latest 1.047 version and 
derelict r377 (also latest). 


I have also read that Tango environment can be compiled only using Rebuild. So 
I do:

rebuild buildme.d

but results are similiar, in exception that these errors are in a larger number:

warning - io.File functionality has migrated to static functions within 
io.device.File 
buildme.d(176): Error: class buildme.Builder D compiler and phobos' object.d 
are mismatched 
buildme.d(248): Error: class buildme.BudBuilder D compiler and phobos' 
object.dare mismatched 
warning - io.File functionality has migrated to static functions within 
io.device.File 
E:\programming\DCIDE\DCIDE_package\dmd1\bin\..\..\tango\import\tango\io\File.d(37):
 Error: class tango.io.File.File D compiler and phobos' object.d are mismatched 
E:\programming\DCIDE\DCIDE_package\dmd1\bin\..\..\tango\import\tango\io\device\File.d(133):
 Error: class tango.io.device.File.File D compiler and phobos' object.d are 
mismatched 
E:\programming\DCIDE\DCIDE_package\dmd1\bin\..\..\tango\import\tango\io\device\Device.d(29):
 Error: class tango.io.device.Device.Device D compiler and phobos' object.d are 
mismatched 
E:\programming\DCIDE\DCIDE_package\dmd1\bin\..\..\tango\import\tango\io\device\Conduit.d(39):
 Error: class tango.io.device.Conduit.Conduit D compiler and phobos' object.d 
are mismatched 
E:\programming\DCIDE\DCIDE_package\dmd1\bin\..\..\tango\import\tango\io\device\Conduit.d(293):
 Error: class tango.io.device.Conduit.InputFilter D compiler and phobos' 
object.d are mismatched 
E:\programming\DCIDE\DCIDE_package\dmd1\bin\..\..\tango\import\tango\io\device\Conduit.d(409):
 Error: class tango.io.device.Conduit.OutputFilter D compiler andphobos' 
object.d are mismatched 
Assertion failure: 'classinfo-structsize == CLASSINFO_SIZE' on line 859 in 
file 'toobj.c' abnormal program termination 
E:\programming\DCIDE\DCIDE_package\dmd1\bin\..\..\tango\import\tango\sys\Process.d(148):
 Error: class tango.sys.Process.Process D compiler and phobos' object.d are 
mismatched 
E:\programming\DCIDE\DCIDE_package\dmd1\bin\..\..\tango\import\tango\sys\Process.d(1949):
 Error: class tango.sys.Process.ProcessCreateException D compiler and phobos' 
object.d are mismatched 
E:\programming\DCIDE\DCIDE_package\dmd1\bin\..\..\tango\import\tango\sys\Process.d(1967):
 Error: class tango.sys.Process.ProcessForkException D compiler and phobos' 
object.d are mismatched 
E:\programming\DCIDE\DCIDE_package\dmd1\bin\..\..\tango\import\tango\sys\Process.d(1978):
 Error: class tango.sys.Process.ProcessKillException D compiler and phobos' 
object.d are mismatched 
E:\programming\DCIDE\DCIDE_package\dmd1\bin\..\..\tango\import\tango\sys\Process.d(1990):
 Error: class tango.sys.Process.ProcessWaitException D compiler and phobos' 
object.d are mismatched 
E:\programming\DCIDE\DCIDE_package\dmd1\bin\..\..\tango\import\tango\io\Console.d(57):
 Error: class tango.io.Console.Console.Input D compiler and phobos' object.d 
are mismatched 
E:\programming\DCIDE\DCIDE_package\dmd1\bin\..\..\tango\import\tango\io\Console.d(214):
 Error: class tango.io.Console.Console.Output D compiler and phobos' object.d 
are mismatched 
E:\programming\DCIDE\DCIDE_package\dmd1\bin\..\..\tango\import\tango\io\Console.d(407):
 Error: class tango.io.Console.Console.Conduit D compiler and phobos' object.d 
are mismatched 
E:\programming\DCIDE\DCIDE_package\dmd1\bin\..\..\tango\import\tango\io\stream\Buffered.d(57):
 Error: class tango.io.stream.Buffered.BufferedInput D compiler and phobos' 
object.d are mismatched 
E:\programming\DCIDE\DCIDE_package\dmd1\bin\..\..\tango\import\tango\io\stream\Buffered.d(835):
 Error: class tango.io.stream.Buffered.BufferedOutput D compiler and phobos' 
object.d are mismatched 
E:\programming\DCIDE\DCIDE_package\dmd1\bin\..\..\tango\import\tango\sys\Pipe.d(32):
 Error: class tango.sys.Pipe.PipeConduit D compiler and phobos' object.d are 
mismatched 
E:\programming\DCIDE\DCIDE_package\dmd1\bin\..\..\tango\import\tango\sys\Pipe.d(144):
 Error: class tango.sys.Pipe.Pipe D compiler and phobos' object.d are 
mismatched 
E:\programming\DCIDE\DCIDE_package\dmd1\bin\..\..\tango\import\tango\io\FilePath.d(64):
 Error: class tango.io.FilePath.FilePath D compiler and phobos' object.dare 
mismatched 

Re: D on the Objective-C runtime?

2009-09-06 Thread Jacob Carlborg

On 9/6/09 15:12, Michel Fortin wrote:

On 2009-09-06 08:32:43 -0400, Christopher Wright dhase...@gmail.com said:


Off topic, but this would be a good place for user-defined attributes.
Then you could write something like:

@IBAction void openWindow(Object sender) {}


Indeed... although IBAction isn't so bad as a mixin, it gets much worse
with ObjcMethod where it is necessary to list all the argument types to
allow resolving overloaded functions:

void doOneAndTwo(int i, int j) {}

mixin ObjcMethod(void, doOneAndTwo, doOne:andTwo:, int, int);


That is actually not necessary. It would be sufficient with a template 
taking an alias to the method (most of the times). Then you can build a 
selector string out of the method name and the parameter names. To get 
the types of the method you can use traits templates/functions available 
both in phobos and tango. You would probably also need a template taking 
an alias and a selector string when the above doesn't work.


This would work best with new methods when you can control the method 
and parameter names and not with existing methods.



Compare to what could be done with a parametrized attribute:

@ObjcMethod(doOne:andTwo:) void doOneAndTwo(int i, int j);

That'd would be a lot more convenient, especially with interfaces for
which none of the mixin above can work (they insert some static struct
member to store the attributes).






Re: Derelict+Tango

2009-09-06 Thread Moritz Warning
On Sun, 06 Sep 2009 13:30:08 -0400, Kamil Dabrowski wrote:

 Well, I'm trying to compile Derelict with Tango and I see the following
 output from dmd:
[..]
I have also read that Tango environment can be compiled only using
Rebuild. So I do:
 rebuild buildme.d

I had a quick look.
buildme.d isn't quite up-to-date.

You need to apply some changes:

Line 44, from
import tango.io.File;
to
import tango.io.device.File;

line 258, from
scope f = new File(name);
return cast(char[])f.read();
to
return cast(char[]) File.get(name);

Then you can compile it with:
dmd buildme.d

Line 474, from:
scope f = new File(name);
f.write(cast(void[])contents);
to:
File.set(name, contents);

Now you can do:
dmd buildme.d

No rebuild rebuild required for this step.


Re: Derelict+Tango

2009-09-06 Thread Moritz Warning
On Sun, 06 Sep 2009 18:54:06 +, Moritz Warning wrote:
[..]
 
 No rebuild rebuild required for this step.

On a second look,
I see that buildme.d uses bud (some older build tool for D).

I can tell you how I install derelict by hand:

- download the trunk (zip archive is at http://www.dsource.org/projects/
derelict/browser/trunk)

- create an derelict directory

- move the contents from all trunk/Derelict*/derelict/* 
  directories into the new derelict directory we created before

- put the derelict directory next to your main.d

- add the code at the end of this post into your main.d

- rebuild main.d or xfbuild main.d



import derelict.sdl.sdl;
import derelict.sdl.image;
import derelict.opengl.gl;
import derelict.opengl.glu;


static this()
{
DerelictGL.load();
DerelictGLU.load();
DerelictSDL.load();
DerelictSDLImage.load();

if (SDL_Init(SDL_INIT_EVERYTHING)  0)
{
throw new Exception(Failed to initialize SDL:  ~ 
fromStringz(SDL_GetError()));
}

// Enable key repeat so the player can keep a key down for moving
if (SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, 
SDL_DEFAULT_REPEAT_INTERVAL))
{
throw new Exception(Failed to set key repeat:  ~ 
fromStringz(SDL_GetError()));
}
}

static ~this()
{
SDL_Quit();
// release GL, GLU and SDL's shared libs
DerelictGLU.unload();
DerelictGL.unload();
DerelictSDL.unload();
}


Re: Derelict+Tango

2009-09-06 Thread Nick Sabalausky
Kamil Dabrowski namecza...@gmail.com wrote in message 
news:h80rj0$2kf...@digitalmars.com...
 Well, I'm trying to compile Derelict with Tango and I see the following 
 output from dmd:

 My dmd1 folder lies near tango folder. DMD is the latest 1.047 version and 
 derelict r377 (also latest).

 buildme.d(176): Error: class buildme.Builder D compiler and phobos' 
 object.d are mismatched
 buildme.d(248): Error: class buildme.BudBuilder D compiler and phobos' 
 object.dare mismatched

I don't know about the other issues (other than that something is trying to 
use Tango 0.99.7 and needs to be updated for 0.99.8+, but I think Moritz 
already addressed that), but if you use DMD 1.044 or later, then Tango 
0.99.8 won't work, and you'll have to use Tango trunk (until Tango 9.99.9 
comes out). 




Re: Derelict+Tango

2009-09-06 Thread Jacob Carlborg

On 9/6/09 21:05, Moritz Warning wrote:

On Sun, 06 Sep 2009 18:54:06 +, Moritz Warning wrote:
[..]


No rebuild rebuild required for this step.


On a second look,
I see that buildme.d uses bud (some older build tool for D).

I can tell you how I install derelict by hand:

- download the trunk (zip archive is at http://www.dsource.org/projects/
derelict/browser/trunk)

- create an derelict directory

- move the contents from all trunk/Derelict*/derelict/*
   directories into the new derelict directory we created before

- put the derelict directory next to your main.d

- add the code at the end of this post into your main.d

- rebuild main.d or xfbuild main.d



import derelict.sdl.sdl;
import derelict.sdl.image;
import derelict.opengl.gl;
import derelict.opengl.glu;


static this()
{
DerelictGL.load();
DerelictGLU.load();
DerelictSDL.load();
DerelictSDLImage.load();

if (SDL_Init(SDL_INIT_EVERYTHING)  0)
{
throw new Exception(Failed to initialize SDL:  ~
fromStringz(SDL_GetError()));
}

// Enable key repeat so the player can keep a key down for moving
if (SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY,
SDL_DEFAULT_REPEAT_INTERVAL))
{
throw new Exception(Failed to set key repeat:  ~
fromStringz(SDL_GetError()));
}
}

static ~this()
{
SDL_Quit();
// release GL, GLU and SDL's shared libs
DerelictGLU.unload();
DerelictGL.unload();
DerelictSDL.unload();
}


Or just using dsss: in the derelict directory run dsss build  dsss 
install


/Jacob Carlborg


Re: Derelict+Tango

2009-09-06 Thread Daniel Keep


Kamil Dabrowski wrote:
 Well, I'm trying to compile Derelict with Tango and I see the following 
 output from dmd: 
 
 warning - io.File functionality has migrated to static functions within 
 io.device.File 
 buildme.d(176): Error: class buildme.Builder D compiler and phobos' object.d 
 are mismatched 
 buildme.d(248): Error: class buildme.BudBuilder D compiler and phobos' 
 object.d are mismatched
 
 ...
 
 Well, what's wrong? 

Well, since Moritz and Jacob have already covered io.File (which isn't
actually a compilation error; just a warning), let's look at the actual
error here:

you're trying to use either the current stable or an old trunk version
of Tango.  This doesn't work.  If you're using DMD 1.045+ you need a
recent Tango trunk that you'll have to build yourself OR you'll have to
patch and build Tango 0.99.8 from source.

That or downgrade to pre DMD 1.045.


Re: Derelict+Tango

2009-09-06 Thread Sam
To Jacob: 

Just wanna know whether you have upgraded your copy of DFL to dmd2032?If 
yes,can I ask for a copy again?

Regards,
Sam


dmg for Snow Leopard x86_64 ?

2009-09-06 Thread simon
Was just wondering if there were plans to create a Snow Leopard build of D 2.0?


Re: Derelict+Tango

2009-09-06 Thread Robert Jacques

On Sun, 06 Sep 2009 20:36:22 -0400, Sam samhudotsa...@gmail.com wrote:


To Jacob:

Just wanna know whether you have upgraded your copy of DFL to dmd2032?If  
yes,can I ask for a copy again?


Regards,
Sam


Hi Sam,
I've upgraded my copy of DFL to DMD 2.032:

Here's the patch
https://jshare.johnshopkins.edu/xythoswfs/webui/_xy-3842113_1-t_VRRBqZAG

Here's my copy of DFL
https://jshare.johnshopkins.edu/xythoswfs/webui/_xy-3615403_1-t_VRRBqZAG

I hope this helps.


Re: Derelict+Tango

2009-09-06 Thread Sam
Silly me.I asked another ppl here wrongly asked you,Sorry!


Re: Derelict+Tango

2009-09-06 Thread Sam
Hi Robert, 

Thank you so much!

I compiled the dfl.lib and dfl_debug.lib successfully just by ran makelib2.bat( 
altered to my d path accordinly).Now the 2 lib files were there right in 
dmd\windows\lib,the src files were in dmd\import.With below code snippet:
module d2;
//: -dfl
import dfl.all;

class MyForm : Form{

this(){
text= DFL form;
auto btn= new Button;
with(btn){
parent  = this;
text= Click;
click   ~= click1;
}
auto box= new TextBox;
with(box){
parent  = this;
}
}

void click1(Object sender, EventArgs ea){
msgBox(Form is cliked!);
}

}

void main(){
Application.run(new MyForm);
}

I built with 
dmd -O -release -L/exet/nt/su:windows:4.0 -L+dfl.lib d2.d
result in a lot of errors :
F:\DLang\Dtwo\dmd\windows\bin\..\..\import\dfl\control.d(783): Error: 
identifier 'HWND' is not defined
F:\DLang\Dtwo\dmd\windows\bin\..\..\import\dfl\control.d(783): Error: HWND is 
used as a type
F:\DLang\Dtwo\dmd\windows\bin\..\..\import\dfl\control.d(783): Error: cannot 
have parameter of type void
F:\DLang\Dtwo\dmd\windows\bin\..\..\import\dfl\control.d(875): Error: mixin is 
not defined
F:\DLang\Dtwo\dmd\windows\bin\..\..\import\dfl\control.d(1123): Error: 
identifier 'EventArgs' is not defined
F:\DLang\Dtwo\dmd\windows\bin\..\..\import\dfl\control.d(1123): Error: 
EventArgs is used as a type
F:\DLang\Dtwo\dmd\windows\bin\..\..\import\dfl\control.d(1123): Error: cannot 
have parameter of type void
F:\DLang\Dtwo\dmd\windows\bin\..\..\import\dfl\control.d(1135): Error: 
identifier 'Color' is not defined
F:\DLang\Dtwo\dmd\windows\bin\..\..\import\dfl\control.d(1135): Error: Color is 
used as a type
F:\DLang\Dtwo\dmd\windows\bin\..\..\import\dfl\control.d(1135): Error: cannot 
have parameter of type void
F:\DLang\Dtwo\dmd\windows\bin\..\..\import\dfl\control.d(1150): Error: 
identifier 'Color' is not defined
F:\DLang\Dtwo\dmd\windows\bin\..\..\import\dfl\control.d(1150): Error: Color is 
used as a type
F:\DLang\Dtwo\dmd\windows\bin\..\..\import\dfl\control.d(1172): Error: 
identifier 'Rect' is not defined
F:\DLang\Dtwo\dmd\windows\bin\..\..\import\dfl\control.d(1172): Error: Rect is 
used as a type
F:\DLang\Dtwo\dmd\windows\bin\..\..\import\dfl\control.d(1172): Error: cannot 
have parameter of type void
F:\DLang\Dtwo\dmd\windows\bin\..\..\import\dfl\control.d(1178): Error: 
identifier 'Rect' is not defined
F:\DLang\Dtwo\dmd\windows\bin\..\..\import\dfl\control.d(1178): Error: Rect is 
used as a type
F:\DLang\Dtwo\dmd\windows\bin\..\..\import\dfl\control.d(1323): Error: 
identifier 'EventArgs' is not defined
F:\DLang\Dtwo\dmd\windows\bin\..\..\import\dfl\control.d(1323): Error: 
EventArgs is used as a type
F:\DLang\Dtwo\dmd\windows\bin\..\..\import\dfl\control.d(1323): Error: cannot 
have parameter of type void
F:\DLang\Dtwo\dmd\windows\bin\..\..\import\dfl\control.d(1343): Error: 
identifier 'Rect' is not defined
F:\DLang\Dtwo\dmd\windows\bin\..\..\import\dfl\control.d(1343): Error: Rect is 
used as a type
F:\DLang\Dtwo\dmd\windows\bin\..\..\import\dfl\control.d(1358): Error: 
identifier 'Size' is not defined
F:\DLang\Dtwo\dmd\windows\bin\..\..\import\dfl\control.d(1358): Error: Size is 
used as a type
F:\DLang\Dtwo\dmd\windows\bin\..\..\import\dfl\control.d(1364): Error: 
identifier 'Size' is not defined
F:\DLang\Dtwo\dmd\windows\bin\..\..\import\dfl\control.d(1364): Error: Size is 
used as a type
F:\DLang\Dtwo\dmd\windows\bin\..\..\import\dfl\control.d(1364): Error: cannot 
have parameter of type void
F:\DLang\Dtwo\dmd\windows\bin\..\..\import\dfl\control.d(1411): Error: 
identifier 'EventArgs' is not defined
F:\DLang\Dtwo\dmd\windows\bin\..\..\import\dfl\control.d(1411): Error: 
EventArgs is used as a type
F:\DLang\Dtwo\dmd\windows\bin\..\..\import\dfl\control.d(1411): Error: cannot 
have parameter of type void
F:\DLang\Dtwo\dmd\windows\bin\..\..\import\dfl\control.d(1418): Error: 
identifier 'ContextMenu' is not defined
F:\DLang\Dtwo\dmd\windows\bin\..\..\import\dfl\control.d(1418): Error: 
ContextMenu is used as a type
F:\DLang\Dtwo\dmd\windows\bin\..\..\import\dfl\control.d(1418): Error: cannot 
have parameter of type void
F:\DLang\Dtwo\dmd\windows\bin\..\..\import\dfl\control.d(1432): Error: 
identifier 'ContextMenu' is not defined
F:\DLang\Dtwo\dmd\windows\bin\..\..\import\dfl\control.d(1432): Error: 
ContextMenu is used as a type
F:\DLang\Dtwo\dmd\windows\bin\..\..\import\dfl\control.d(1486): Error: 
identifier 'EventArgs' is not defined
F:\DLang\Dtwo\dmd\windows\bin\..\..\import\dfl\control.d(1486): Error: 
EventArgs is used as a type
F:\DLang\Dtwo\dmd\windows\bin\..\..\import\dfl\control.d(1486): Error: cannot 
have parameter of type void

Re: DDL should become official part of DMD

2009-09-06 Thread BLS

JPF wrote:

BLS wrote:

c topic.. what do you think ?

IMO : this could be a D killer feature.


I don't know how complicated that would be (licensing issues, ...), but
as a developer / user I would really like it: It's needed to implement
stuff like addins in a convenient way. And it would be great if we could
finally use statically loaded shared libraries instead of static
compilation of everything (I guess that needs compiler integration, so
it's a good reason to include DDL with dmd ;-)). Also, if you look at
http://www.digitalmars.com/d/1.0/dll.html#Dcode the current way to do D
DLLs for use with D code is not very developer friendly. Exporting flat
functions like getMyClass just doesn't feel right. Now compare that with
DDLs features: http://www.dsource.org/projects/ddl/wiki/AboutDDL .DDL
clearly wins. By the way, I guess most of you know that already, but
http://h3.team0xf.com/devlog/?p=12 has an updated version of DDL with a
new linker.


I can hear you , but it seems that we are pretty alone.
License ?
The compiler deps stuff is coming out of the same developer house... 
...without trouble..


... now DMD comes along with such a license MIX nobody really 
understands but W. insist that everything else has to be public domain.

That stinks 



Re: Derelict+Tango

2009-09-06 Thread Robert Jacques

On Sun, 06 Sep 2009 22:10:28 -0400, Sam samhudotsa...@gmail.com wrote:

Hi Robert,

Thank you so much!

I compiled the dfl.lib and dfl_debug.lib successfully just by ran  
makelib2.bat( altered to my d path accordinly).Now the 2 lib files were  
there right in dmd\windows\lib,the src files were in dmd\import.With  
below code snippet:

module d2;
//: -dfl
import dfl.all;

class MyForm : Form{

this(){
text= DFL form;
auto btn= new Button;
with(btn){
parent  = this;
text= Click;
click   ~= click1;
}
auto box= new TextBox;
with(box){
parent  = this;
}
}

void click1(Object sender, EventArgs ea){
msgBox(Form is cliked!);
}

}

void main(){
Application.run(new MyForm);
}

I built with
dmd -O -release -L/exet/nt/su:windows:4.0 -L+dfl.lib d2.d
result in a lot of errors :
F:\DLang\Dtwo\dmd\windows\bin\..\..\import\dfl\control.d(783): Error:  
identifier 'HWND' is not defined

[snip]


So was I missing something again?
Thanks again for your help!

Regards,
Sam


Yes, checking against my copy of DFL, line 783 (the first error you  
listed) is a blank line. 'HWND' is first mentioned on line 791. So I think  
you are somehow importing the old DFL and not my patched version. Let me  
know if checking your import statements doesn't help.


D 2.00 official spec

2009-09-06 Thread Justin Johansson
Having trolled all over DM site in search for an official D 2.0 spec similar to 
that as exists for D 1.0 (spec_DMD_1.00.pdf), I seem to be out of luck.

Does such a document exist and would someone please point me to it?

Thanks for all help.



Re: D 2.00 official spec

2009-09-06 Thread Jeremie Pelletier
Justin Johansson Wrote:

 Having trolled all over DM site in search for an official D 2.0 spec similar 
 to that as exists for D 1.0 (spec_DMD_1.00.pdf), I seem to be out of luck.
 
 Does such a document exist and would someone please point me to it?
 
 Thanks for all help.
 

D2 is still in development, therefore there is no spec yet.


Re: DDL should become official part of DMD

2009-09-06 Thread Tim_M
BLS Wrote:

 JPF wrote:
  BLS wrote:
  c topic.. what do you think ?
 
  IMO : this could be a D killer feature.
  
  I don't know how complicated that would be (licensing issues, ...), but
  as a developer / user I would really like it: It's needed to implement
  stuff like addins in a convenient way. And it would be great if we could
  finally use statically loaded shared libraries instead of static
  compilation of everything (I guess that needs compiler integration, so
  it's a good reason to include DDL with dmd ;-)). Also, if you look at
  http://www.digitalmars.com/d/1.0/dll.html#Dcode the current way to do D
  DLLs for use with D code is not very developer friendly. Exporting flat
  functions like getMyClass just doesn't feel right. Now compare that with
  DDLs features: http://www.dsource.org/projects/ddl/wiki/AboutDDL .DDL
  clearly wins. By the way, I guess most of you know that already, but
  http://h3.team0xf.com/devlog/?p=12 has an updated version of DDL with a
  new linker.
 
 I can hear you , but it seems that we are pretty alone.

I didn't want to say much but I actually would like this a lot.

I can't see how this will negatively effect anything else unlike language 
features so it is kind of on the level of the patch for build tools integrated 
in 2.031 IIRC.

I guess if someone other than Walter could do the development then he probably 
wouldn't mind applying the patches.





Re: delegate !is null

2009-09-06 Thread Saaa

Steven Schveighoffer schvei...@yahoo.com wrote in message 
news:op.uzqxxo1neav...@localhost.localdomain...
 On Fri, 04 Sep 2009 14:33:12 -0400, Saaa em...@needmail.com wrote:

 class C
 {
   private int i;
   int method()
   {
 return i;
   }
 }

 class D
 {
   private int delegate(void) _deleg;
   this(int delegate(void) d)
   {
 _deleg = d;
   }
   void write()
   {
 if(_deleg !is null)
 }
   writef(_deleg());
 }
   }
 }
 C c = null;
 D d = new d;
 d.function(c.method());
 //This fails, as method is not availible for null.
 d.function({return c.method();});
 //This works but now I can't check whether c is null or not.
 d.write(); //will fail.

 Any suggestions?

 Maybe you could rephrase your question in english.  I can't really 
 understand what you are trying to do with this code.

 i.e. I want to be able to tell whether a delegate is null or not, how do 
 I do that.  But you do that just like you said -- dg !is null.

 -Steve

(unexpected visit this weekend)
Erm, like this.. ?
I'd like to set D's delegate to a method which is not yet available (like 
c.method).
I solved this by encapsulating the method within a function literal, but I 
also need to know whether
the method is available or not when calling the delegate.
I could do this by making the function literal include the null-checking 
code, but is there maybe a better solution to this problem?
The delegate is supposed to change a variable within the D class.
Hope you understand it :)





[Issue 3298] std.file.read on OSX: Memory allocation failed

2009-09-06 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3298


Andrei Alexandrescu and...@metalanguage.com changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
 CC||and...@metalanguage.com
 AssignedTo|nob...@puremagic.com|and...@metalanguage.com


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3298] std.file.read on OSX: Memory allocation failed

2009-09-06 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3298


Andrei Alexandrescu and...@metalanguage.com changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED


--- Comment #3 from Andrei Alexandrescu and...@metalanguage.com 2009-09-06 
09:06:42 PDT ---
Please get from svn and test to make sure I pasted it right. Thanks!

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3298] std.file.read on OSX: Memory allocation failed

2009-09-06 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3298



--- Comment #4 from Michel Fortin michel.for...@michelf.com 2009-09-06 
15:14:58 EDT ---
I can't see any trace of a recent change to std.file. The web interface doesn't
have it either:

http://www.dsource.org/projects/phobos/browser/trunk/phobos/std/file.d

Am I looking at the right place?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3298] std.file.read on OSX: Memory allocation failed

2009-09-06 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3298



--- Comment #5 from Andrei Alexandrescu and...@metalanguage.com 2009-09-06 
12:28:10 PDT ---
(In reply to comment #4)
 I can't see any trace of a recent change to std.file. The web interface 
 doesn't
 have it either:
 
 http://www.dsource.org/projects/phobos/browser/trunk/phobos/std/file.d
 
 Am I looking at the right place?

Sorry, checking mishap. Please try again.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3301] Undefined identifier error dependent on order of imports when a circular import is involved

2009-09-06 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3301


Brad Roberts bra...@puremagic.com changed:

   What|Removed |Added

   Priority|P2  |P1
 CC||bra...@puremagic.com


--- Comment #7 from Brad Roberts bra...@puremagic.com 2009-09-06 13:36:20 PDT 
---
Bumping up to a P1 bug.  Walter, this needs to be at least commented upon asap.
 It's a rather nasty regression.

For the rest of you, a standalone repro case would likely help.  The one from
the original problem description requires importing std.c.windows.windows which
itself is rather huge.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3298] std.file.read on OSX: Memory allocation failed

2009-09-06 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3298



--- Comment #6 from Michel Fortin michel.for...@michelf.com 2009-09-06 
16:43:40 EDT ---
Patched Phobos from SVN working fine, bug fixed. Thanks.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3301] Undefined identifier error dependent on order of imports when a circular import is involved

2009-09-06 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3301



--- Comment #8 from Stewart Gordon s...@iname.com 2009-09-06 16:39:24 PDT ---
I'm not sure how trimming it down can be that difficult

- bz3301.d -
public import bz3301a;
public import bz3301b;
- bz3301a.d -
public import bz3301; 
HRESULT hresult;
- bz3301b.d -
alias int HRESULT;
--
C:\Users\Stewart\Documents\Programming\D\Tests\bugsdmd -c bz3301.d
bz3301a.d(2): Error: identifier 'HRESULT' is not defined
bz3301a.d(2): Error: HRESULT is used as a type
bz3301a.d(2): Error: variable bz3301a.hresult voids have no value
--
(1.047)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---