Re: Using the llvm D-bindings [solved]

2010-10-06 Thread mwarning
On Wed, 06 Oct 2010 16:57:09 +0200, Manuel König wrote:

 LLVM_LIBS=`llvm-config --libs | sed 's/-l/-L-l'`

typo detected, you need:
sed 's/-l/-L-l/g'

:)


Re: DWT2 updated to latest compiler and Tango

2010-09-16 Thread mwarning
On Thu, 16 Sep 2010 16:56:24 +0200, Jacob Carlborg wrote:

 Just a note: I've updated DWT2 to work on the latest compiler and with
 the latest Tango. Both windows and linux ports are updated. No update
 for D2 yet, I notice that the language is not ready yet, I hit too many
 bugs.
 
 Link to DWT project page: http://dsource.org/projects/dwt Link to DWT2
 Mercurial repository: http://hg.dsource.org/projects/dwt2

Thanks! :)


Re: D examples

2010-08-16 Thread mwarning
On Mon, 16 Aug 2010 07:48:11 +0200, Borneq wrote:

 Użytkownik Leandro Lucarella l...@llucax.com.ar napisał w wiadomości
 news:20100815212755.gd5...@llucax.com.ar...
 LDC doesn't use LLVM infrastructure for garbage collection.
 
 Garbage Collector is in Tango library?

Yes, it's in the runtime part of the Tango library.


Re: D examples

2010-08-13 Thread mwarning
On Fri, 13 Aug 2010 22:36:01 +0200, Borneq wrote:

 Where can I find D example programs, especially for LDC ?

Since ldc only supports D1/Tango, you can find examples on the Tango site:

http://dsource.org/projects/tango


import tango.io.Stdout;

void main()
{
  Stdout(Hello World).newline;
}


Re: D examples

2010-08-13 Thread mwarning
On Fri, 13 Aug 2010 22:36:01 +0200, Borneq wrote:

 Where can I find D example programs, especially for LDC ?

I assume you want a 64bit D compiler.
Apart from LDC, there is gdc (http://bitbucket.org/goshawk/gdc/wiki/Home).
But I can't tell you how good gdc works yet.


Re: LDC can't import std.stdio

2010-08-12 Thread mwarning
On Thu, 12 Aug 2010 23:21:15 +0200, Borneq wrote:

 I install ldc under Ubuntu. When I compile import std.stdio show error:
 first.d(1): Error: module stdio cannot read file 'std/stdio.d'

LDC doesn't support D2 or Phobos, but D1/Tango (dsource.org/projects/
tango):

try this:

import tango.io.Stdout;

void main()
{
  Stdout(Hello World!).newline;
}


Re: Andrei's Google Talk

2010-08-06 Thread mwarning
On Thu, 05 Aug 2010 22:34:34 +, mwarning wrote:

 On Thu, 05 Aug 2010 13:55:40 -0700, Walter Bright wrote:
 
 Adam Ruppe wrote:
 To abandon DMD for that is language suicide.
 
 Well, one reason (certainly not the only one) I keep with the current
 dmd back end is that I don't need to spend time convincing some other
 organization to fix/improve/customize it for better D support. I can
 just get it done.
 
 Being in control of the toolchain has a lot of benefits.
 
 For example, look at gdb, and trying to get it to support D - not for
 the patches themselves, but getting them accepted into the standard
 gdb.
 
 Thanks for the clarification.
 Imho, doing/checking everything already has taken years and will
 continue to take many years. I don't think it's a very viable concept.

.. but I hope it works out well. :)


Re: Andrei's Google Talk

2010-08-05 Thread mwarning
On Thu, 05 Aug 2010 03:23:25 +, BCS wrote:

 For a number of IP/legal reasons, Walter CAN'T work on LLVM or LDC.

Hi,

can you please elaborate a bit?
I remember that statement has appeared before,
but I can't remember the reason that was given.


Re: Andrei's Google Talk

2010-08-05 Thread mwarning
On Wed, 04 Aug 2010 22:19:02 -0400, Adam Ruppe wrote:

 On 8/4/10, bearophile bearophileh...@lycos.com wrote:
 I am sorry to say this, but I think porting the current back-end to 64
 bit is a waste of time because it will not be used for professional
 usages. I think LLVM will be the main back-end for professional usages
 of D2
 
 Get back to me when LDC starts to actually /work/. It is *completely
 unusable* in its current state and its developers don't seem to care.
 
 I don't understand what you see in it.

LDC for llvm 2.7 doesn't have debug support because the LDC debug info 
code only works for llvm 2.6. I assume that's what you call unusable?
There are bugs as well, sure. But nothing too serious from what I know 
about.

LDC is developed on a personal by need/interest basis.
Atm. the original developers don't have time or much interest in LDC.
It's a volunteer effort from the beginning and everyone is invited to 
work on ldc.


Re: Andrei's Google Talk

2010-08-05 Thread mwarning
On Thu, 05 Aug 2010 16:39:19 -0400, Adam Ruppe wrote:

 On 8/5/10, mwarning moritzwarn...@web.de wrote:
  I assume that's what you call unusable?
 
 I mean unusable in the literal sense: $ ./ldc
 ./ldc: error while loading shared libraries: libelf.so.0: cannot open
 shared object file: No such file or directory
Google might help.

 
 I hear it also doesn't do D2 at all, which is unacceptable, and that it
 doesn't do exceptions in Windows - thus meaning it doesn't work there at
 all for any real programs - which is unacceptable AND unforgivable.
...

 AFAIK, the Windows unusability is in LLVM itself.
Yes, llvm doesn't support exception handling on windows.

 Honestly, I'd be surprised if there's a single person on the planet who
 uses a D LLVM compiler professionally today given its limitations.
There are.

 LDC is garbage, and that's all that actually exists. To abandon DMD for 
 that is language suicide.
O.o


Re: Andrei's Google Talk

2010-08-05 Thread mwarning
On Thu, 05 Aug 2010 13:55:40 -0700, Walter Bright wrote:

 Adam Ruppe wrote:
 To abandon DMD for that is language suicide.
 
 Well, one reason (certainly not the only one) I keep with the current
 dmd back end is that I don't need to spend time convincing some other
 organization to fix/improve/customize it for better D support. I can
 just get it done.
 
 Being in control of the toolchain has a lot of benefits.
 
 For example, look at gdb, and trying to get it to support D - not for
 the patches themselves, but getting them accepted into the standard gdb.

Thanks for the clarification.
Imho, doing/checking everything already has taken years and will continue 
to take many years. I don't think it's a very viable concept.


Re: Andrei's Google Talk

2010-08-05 Thread mwarning
On Thu, 05 Aug 2010 19:29:05 -0400, Adam Ruppe wrote:

 On 8/5/10, mwarning moritzwarn...@web.de wrote:
 Google might help.
 
 I know what it is, but I have /zero/ respect for people who shove their
 dependencies on me. It shouldn't be my problem.
It shouldn't be the problem of the user, I agree.
But that happens and it's definitely not intentional (afaik).
What file have you downloaded? What distribution you use?

 One of the reasons I went with Digital Mars early on is that DMC just
 works when you unzip it. DMD continues that tradition, and it is very
 nice.
 
 I'm spoiled.
Yes you are ;)


Re: A confusing expression?

2010-08-01 Thread mwarning
On Sun, 01 Aug 2010 19:22:42 -0400, bearophile wrote:

 Turning 'x / y * z' into a D syntax error (as done in bug 
 http://d.puremagic.com/issues/show_bug.cgi?id=4077 ) looks excessive to
 me. A warning seems enough, but Walter is not a lover of warnings (and
 sometimes I agree, I'd like to turn three D warnings into errors). What
 do you think?

Turning it into a syntax error sounds to be the right way to do to me.
From a mathematical syntax pov, it's undefined behavior.


Re: LDC, GDC for D2

2010-07-01 Thread mwarning
On Thu, 01 Jul 2010 18:44:55 +0100, Robert Clipsham wrote:

 On 30/06/10 22:06, mwarning wrote:
 On Wed, 30 Jun 2010 18:14:47 +, dsimcha wrote:

 Now that Andrei's book is out and the D2 spec is (fairly) stable, is
 there going to be any serious effort to port LDC to D2?  Also,
 regarding GDC, I've noticed that no D2-related checkins have happened
 in a long time.

 In both cases, is there any good technical reason for the lack of
 focus on D2, or is it just that D2 has stabilized very recently and
 given the limited resources of these projects, D1 is considered a
 higher priority?

 The contributors so far don't have time any more or just lost interest.
 It's probably no big issue to give ppl svn access when they want to
 give it a try to work on ldc.
 
 I was maintaining LDC 2, unfortunately I became rather busy which
 hindered my efforts. I had an email a couple of days ago from someone
 who seemed interested in reviving it, I'm not sure how committed he was
 to it though. Should he offer some good patches D2 wise I'm sure there'd
 be no issue with giving him commit access.
 

Thanks for the confirmation Robert!


Re: Interesting to see (for geeks)

2010-06-30 Thread mwarning
On Wed, 30 Jun 2010 09:44:30 -0700, Walter Bright wrote:

 Bane wrote:
 http://www.youtube.com/watch?v=fzza-ZbEY70
 
 I generally do not watch anonymous youtube videos because I don't want
 to spend several minutes just to see if it is something I'd want to see.
 
 So, for the sake of people like me, can you add a summary of what this
 is about?

I hope you had not to endure the trololo (anti-troll) video I sneaked 
onto the ng some time ago. g


Re: LDC, GDC for D2

2010-06-30 Thread mwarning
On Wed, 30 Jun 2010 18:14:47 +, dsimcha wrote:

 Now that Andrei's book is out and the D2 spec is (fairly) stable, is
 there going to be any serious effort to port LDC to D2?  Also, regarding
 GDC, I've noticed that no D2-related checkins have happened in a long
 time.
 
 In both cases, is there any good technical reason for the lack of focus
 on D2, or is it just that D2 has stabilized very recently and given the
 limited resources of these projects, D1 is considered a higher priority?

The contributors so far don't have time any more or just lost interest.
It's probably no big issue to give ppl svn access when they want to give 
it a try to work on ldc.


Calling C function with static array includes length and pointer

2010-06-21 Thread mwarning
Hi,

I try to pass a static array to a variadic C function.
Looks like the array is passed by values as expected,
but the length and pointer are prepended, too.
Is this intentional or a bug?

http://pastebin.com/6ejFF37j


Re: Calling C function with static array includes length and pointer

2010-06-21 Thread mwarning
On Mon, 21 Jun 2010 14:38:50 -0700, Ali Çehreli wrote:

 mwarning wrote:
 Hi,
 
 I try to pass a static array to a variadic C function. Looks like the
 array is passed by values as expected, but the length and pointer are
 prepended, too. Is this intentional or a bug?
 
 http://pastebin.com/6ejFF37j
 
 Fixed sized arrays don't have ptr and length members:
 
 import std.stdio;
 
 void main()
 {
  int[5] array;
  writeln(array.sizeof);   // prints 20 writeln(array.ptr, '
  ', array); // prints the save value
 }
Hm? You just have proved that they have. :
But those are not members of a struct/pair instance (as for dynamic 
arrays). They are compile time values.
Whatever, it's me nitpicking. :)

 The code you've pasted has this:
 
 extern(C) void* foo(uint x, ...)
 {
  Stdout(x: )(x).nl;
  Stdout(y: )(*(x + 1)).nl; //outputs 64! return null;
 }
 
 The expression *(x + 1) is undefined behavior, because (x + 1) is not
 valid, i.e. not specified to be accessible by the language.
 
 Ali
True, the D spec doesn't specify the memory layout.
But the C calling convention does (depending on the platform).

Anyway, the D spec says:
Static arrays are value types, but as in C static arrays are passed to 
functions by reference and cannot be returned from functions.
(http://www.digitalmars.com/d/1.0/arrays.html#static-arrays)

It seems that D does a little more then just pass by value. It includes 
the pointer and length value as well.

Btw.: smth. told me workaround/solution: wrap the static array in a 
struct.



Re: Calling C function with static array includes length and pointer

2010-06-21 Thread mwarning
On Tue, 22 Jun 2010 00:00:27 +0200, torhu wrote:

 On 21.06.2010 23:30, mwarning wrote:
 Hi,

 I try to pass a static array to a variadic C function. Looks like the
 array is passed by values as expected, but the length and pointer are
 prepended, too. Is this intentional or a bug?

 http://pastebin.com/6ejFF37j
 
 I believe this works as intended.  And arrays in D 1 are *not* passed by
 value, ie. the data is not copied.
 
  From www.digitalmars.com/d/1.0/arrays.html:
 
 a string literal is passed as a (length,pointer) combination to
 variadic parameters
Thanks, I missed that section!

 In other words, use stack.ptr if you want just the pointer.
I wrap it into a struct, that will do it.