Re: I Did It! Calling D Library from Objective C in XCode on OSX

2015-12-16 Thread John Colvin via Digitalmars-d-learn
On Wednesday, 16 December 2015 at 07:46:53 UTC, Jacob Carlborg wrote: On 2015-12-15 15:43, John Colvin wrote: I have no idea how you got something in /Library/D, but it doubt it was from homebrew. The native installer installs into /Library/D. Well that probably explains the problem then.

Segfault while compiling simple program

2015-12-16 Thread Saurabh Das via Digitalmars-d-learn
struct xlref { ushort rwFirst; ushort rwLast; ubyte colFirst; ubyte colLast; } struct xlmref { ushort count; xlref reflist; } Mac OS X (dmd 2.069.0) === dmd dprob.d Segmentation fault: 11 Windows (dmd 2.069.2) == dmd -v -m64 dprob.d binar

Re: Segfault while compiling simple program

2015-12-16 Thread John Colvin via Digitalmars-d-learn
On Wednesday, 16 December 2015 at 09:26:33 UTC, Saurabh Das wrote: struct xlref { ushort rwFirst; ushort rwLast; ubyte colFirst; ubyte colLast; } struct xlmref { ushort count; xlref reflist; } Mac OS X (dmd 2.069.0) === dmd dprob.d Segmentation fault: 11

Re: Segfault while compiling simple program

2015-12-16 Thread Ali Çehreli via Digitalmars-d-learn
On 12/16/2015 01:26 AM, Saurabh Das wrote: struct xlref { ushort rwFirst; ushort rwLast; ubyte colFirst; ubyte colLast; } struct xlmref { ushort count; xlref reflist; } Mac OS X (dmd 2.069.0) === dmd dprob.d Segmentation fault: 11 Compiler bug. P

Re: Segfault while compiling simple program

2015-12-16 Thread Saurabh Das via Digitalmars-d-learn
On Wednesday, 16 December 2015 at 09:38:24 UTC, Ali Çehreli wrote: On 12/16/2015 01:26 AM, Saurabh Das wrote: struct xlref { ushort rwFirst; ushort rwLast; ubyte colFirst; ubyte colLast; } struct xlmref { ushort count; xlref reflist; } Mac OS X (dmd 2.069.0) =

Re: Segfault while compiling simple program

2015-12-16 Thread Saurabh Das via Digitalmars-d-learn
On Wednesday, 16 December 2015 at 10:07:38 UTC, Saurabh Das wrote: On Wednesday, 16 December 2015 at 09:38:24 UTC, Ali Çehreli wrote: On 12/16/2015 01:26 AM, Saurabh Das wrote: struct xlref { ushort rwFirst; ushort rwLast; ubyte colFirst; ubyte colLast; } struct xlmref {

Re: Segfault while compiling simple program

2015-12-16 Thread John Colvin via Digitalmars-d-learn
On Wednesday, 16 December 2015 at 10:15:49 UTC, Saurabh Das wrote: On Wednesday, 16 December 2015 at 10:07:38 UTC, Saurabh Das wrote: On Wednesday, 16 December 2015 at 09:38:24 UTC, Ali Çehreli wrote: On 12/16/2015 01:26 AM, Saurabh Das wrote: struct xlref { ushort rwFirst; ushort rw

Re: Segfault while compiling simple program

2015-12-16 Thread Kagamin via Digitalmars-d-learn
I use dpaste to test compilation on linux.

How to split a string/array with multiple separators?

2015-12-16 Thread Borislav Kosharov via Digitalmars-d-learn
I want to split a string using multiple separators. In std.array the split function has a version where it takes a range as a separator, but it works differently than what I want. Say if I call it with " -> " it will search for the whole thing together. I want to pass split a list of separators

Re: How to split a string/array with multiple separators?

2015-12-16 Thread Dragos Carp via Digitalmars-d-learn
On Wednesday, 16 December 2015 at 14:18:28 UTC, Borislav Kosharov wrote: I want to split a string using multiple separators. In std.array the split function has a version where it takes a range as a separator, but it works differently than what I want. Say if I call it with " -> " it will searc

Re: How to split a string/array with multiple separators?

2015-12-16 Thread Marc Schütz via Digitalmars-d-learn
On Wednesday, 16 December 2015 at 14:47:26 UTC, Dragos Carp wrote: On Wednesday, 16 December 2015 at 14:18:28 UTC, Borislav Kosharov wrote: I want to split a string using multiple separators. In std.array the split function has a version where it takes a range as a separator, but it works diffe

Re: I Did It! Calling D Library from Objective C in XCode on OSX

2015-12-16 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-12-16 10:19, John Colvin wrote: How exactly would it do that? I guess it could parse some output from dmd to check that it's looking in the right directories, that would be a nice enhancement. Not sure, but for one thing, don't put any files any global directories. That is, don't put

Re: Segfault while compiling simple program

2015-12-16 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-12-16 11:51, John Colvin wrote: I'd say list it as 'all', chances are it crashes the same on linux as well. If it's an ICE, it's very likely it applies to all platforms. Unless you get an assert/crash in a platform specific file in DMD. -- /Jacob Carlborg

Re: Implicit Interface Deduction

2015-12-16 Thread Faux Amis via Digitalmars-d-learn
On Mon 14/12/2015 00:27, Ali Çehreli wrote: On 12/13/2015 02:09 PM, Faux Amis wrote: interface IA {} interface IB {} interface IC {} interface IAB : IA, IB {} interface IBC : IB, IC {} class C : IA, IB, IC {} // Defining C as : IAB, IBC // is not really scalable ;) It is not automatic at lea

Re: Implicit Interface Deduction

2015-12-16 Thread Faux Amis via Digitalmars-d-learn
On Mon 14/12/2015 02:45, Chris Wright wrote: On Sun, 13 Dec 2015 23:09:47 +0100, Faux Amis wrote: interface IA {} interface IB {} interface IC {} interface IAB : IA, IB {} interface IBC : IB, IC {} class C : IA, IB, IC {} // Defining C as : IAB, IBC // is not really scalable ;) void main() {

Error 42: Symbol Undefined __lseeki64

2015-12-16 Thread Byron Heads via Digitalmars-d-learn
Seeing this issue on 2.069.2 using etc.c.zlib. C:\d\dmd2\windows\bin\..\lib\phobos.lib(gzlib) Error 42: Symbol Undefined __lseeki64 The code was compiling in 2.067. Not clear on where to look to fix this issue.

Re: Segfault while compiling simple program

2015-12-16 Thread Claude via Digitalmars-d-learn
I tested it on linux (64-bit distro), and it segfaults as well: - $ echo "struct S { ushort a, b; ubyte c, d; } struct T { ushort e; S s; }" > test.d $ dmd -v test.d binarydmd version v2.069.0 config/etc/dmd.conf parse test importall test importobject(/usr/includ

Re: Error 42: Symbol Undefined __lseeki64

2015-12-16 Thread Byron Heads via Digitalmars-d-learn
On Wednesday, 16 December 2015 at 17:23:15 UTC, Byron Heads wrote: Seeing this issue on 2.069.2 using etc.c.zlib. C:\d\dmd2\windows\bin\..\lib\phobos.lib(gzlib) Error 42: Symbol Undefined __lseeki64 The code was compiling in 2.067. Not clear on where to look to fix this issue. I can reprod

Re: Error 42: Symbol Undefined __lseeki64

2015-12-16 Thread Byron Heads via Digitalmars-d-learn
On Wednesday, 16 December 2015 at 18:14:35 UTC, Byron Heads wrote: On Wednesday, 16 December 2015 at 17:23:15 UTC, Byron Heads wrote: Seeing this issue on 2.069.2 using etc.c.zlib. C:\d\dmd2\windows\bin\..\lib\phobos.lib(gzlib) Error 42: Symbol Undefined __lseeki64 The code was compiling in 2

Re: Error 42: Symbol Undefined __lseeki64

2015-12-16 Thread Byron Heads via Digitalmars-d-learn
On Wednesday, 16 December 2015 at 18:21:33 UTC, Byron Heads wrote: On Wednesday, 16 December 2015 at 18:14:35 UTC, Byron Heads wrote: On Wednesday, 16 December 2015 at 17:23:15 UTC, Byron Heads wrote: Seeing this issue on 2.069.2 using etc.c.zlib. C:\d\dmd2\windows\bin\..\lib\phobos.lib(gzlib)

Re: Implicit Interface Deduction

2015-12-16 Thread Meta via Digitalmars-d-learn
On Sunday, 13 December 2015 at 22:09:47 UTC, Faux Amis wrote: interface IA {} interface IB {} interface IC {} interface IAB : IA, IB {} interface IBC : IB, IC {} class C : IA, IB, IC {} // Defining C as : IAB, IBC // is not really scalable ;) void main() { IAB c = new C(); // This doesn't work

isBidirectionalRange fails for unknown reasons

2015-12-16 Thread Jack Stouffer via Digitalmars-d-learn
I'm trying to add a ReferenceBidirectionalRange range type to std.internal.test.dummyrange so I can test some range code I'm writing, but I've hit a wall and I'm not sure why. For some reason, the isBidirectionalRange check fails even though back and popBack are present. Any help here would be

Re: isBidirectionalRange fails for unknown reasons

2015-12-16 Thread Jack Stouffer via Digitalmars-d-learn
On Wednesday, 16 December 2015 at 20:43:02 UTC, Jack Stouffer wrote: unittest { static assert(isInputRange!(ReferenceInputRange!int)); // works static assert(isForwardRange!(ReferenceForwardRange!int)); // works static assert(isBidirectionalRange!(ReferenceBidirectionalRange!int));

Re: isBidirectionalRange fails for unknown reasons

2015-12-16 Thread anonymous via Digitalmars-d-learn
On 16.12.2015 21:43, Jack Stouffer wrote: I'm trying to add a ReferenceBidirectionalRange range type to std.internal.test.dummyrange so I can test some range code I'm writing, but I've hit a wall and I'm not sure why. For some reason, the isBidirectionalRange check fails even though back and popB

Re: isBidirectionalRange fails for unknown reasons

2015-12-16 Thread Jack Stouffer via Digitalmars-d-learn
On Wednesday, 16 December 2015 at 21:40:44 UTC, anonymous wrote: The `.save` primitive of forward ranges must return the very same type that the range has. But your ReferenceBidirectionalRange!T.save returns a ReferenceForwardRange!T, because it's inherited. That makes isForwardRange!(Referenc

Re: isBidirectionalRange fails for unknown reasons

2015-12-16 Thread Jakob Ovrum via Digitalmars-d-learn
On Wednesday, 16 December 2015 at 20:43:02 UTC, Jack Stouffer wrote: ... You can also use return type covariance: class ReferenceBidirectionalRange(T) : ReferenceForwardRange!T { this(Range)(Range r) if (isInputRange!Range) { super(r); } final override @property typeof(this) save() { r

Using a struct as a wrapper for an extern(C) opaque type, no default constructor, what do?

2015-12-16 Thread Jeremy DeHaan via Digitalmars-d-learn
Hi all. I'm interfacing to some C code which include an opaque type and some C functions that create and work with a pointer to that type. I want to wrap up everything in a struct, and the only thing that seems to bug me is initialization. Since it is C code, I obviously can't read the functio

Testing if a file is connected to a terminal

2015-12-16 Thread Shriramana Sharma via Digitalmars-d-learn
Is there a canonical way to test in D whether stdout/stderr (or in general, a std.stdio.File) refers to a terminal or not? https://www.google.co.in/search?q=terminal&sitesearch=dlang.org/phobos turns out nothing. I knew of C's (or rather POSIX's) isatty, and after some digging I found isatty

No documentation for core.sys?

2015-12-16 Thread Shriramana Sharma via Digitalmars-d-learn
In my recent search for D's equivalent of isatty, I found out that there is a core.sys.posix module only by rgrepping under /usr/include/dmd. Why isn't there a documentation page http://dlang.org/phobos/core_sys.html whereas lots of other core.* modules are documented? -- Shriramana Sharma, Pe

Re: Using a struct as a wrapper for an extern(C) opaque type, no default constructor, what do?

2015-12-16 Thread Jakob Ovrum via Digitalmars-d-learn
On Thursday, 17 December 2015 at 03:31:37 UTC, Jeremy DeHaan wrote: Hi all. I'm interfacing to some C code which include an opaque type and some C functions that create and work with a pointer to that type. I want to wrap up everything in a struct, and the only thing that seems to bug me is ini

Re: No documentation for core.sys?

2015-12-16 Thread Jakob Ovrum via Digitalmars-d-learn
On Thursday, 17 December 2015 at 03:40:02 UTC, Shriramana Sharma wrote: In my recent search for D's equivalent of isatty, I found out that there is a core.sys.posix module only by rgrepping under /usr/include/dmd. Why isn't there a documentation page http://dlang.org/phobos/core_sys.html wherea

Re: Testing if a file is connected to a terminal

2015-12-16 Thread Jakob Ovrum via Digitalmars-d-learn
On Thursday, 17 December 2015 at 03:38:31 UTC, Shriramana Sharma wrote: Is there a canonical way to test in D whether stdout/stderr (or in general, a std.stdio.File) refers to a terminal or not? https://www.google.co.in/search?q=terminal&sitesearch=dlang.org/phobos turns out nothing. I knew o

Re: Using a struct as a wrapper for an extern(C) opaque type, no default constructor, what do?

2015-12-16 Thread Jeremy DeHaan via Digitalmars-d-learn
On Thursday, 17 December 2015 at 03:43:58 UTC, Jakob Ovrum wrote: On Thursday, 17 December 2015 at 03:31:37 UTC, Jeremy DeHaan wrote: Hi all. I'm interfacing to some C code which include an opaque type and some C functions that create and work with a pointer to that type. I want to wrap up ever

Re: Testing if a file is connected to a terminal

2015-12-16 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 17 December 2015 at 03:59:27 UTC, Jakob Ovrum wrote: There are some terminal libraries on Github (like consoled) but I have to say I think they're uninspiring in terms of quality and presentation. Can you be any more specific about that?

Re: Error 42: Symbol Undefined __lseeki64

2015-12-16 Thread tcak via Digitalmars-d-learn
On Wednesday, 16 December 2015 at 18:30:41 UTC, Byron Heads wrote: On Wednesday, 16 December 2015 at 18:21:33 UTC, Byron Heads wrote: On Wednesday, 16 December 2015 at 18:14:35 UTC, Byron Heads wrote: [...] Commenting out gzclose(fpGZip); allows it to compile.. Submitted reduced case as

Re: No documentation for core.sys?

2015-12-16 Thread Shriramana Sharma via Digitalmars-d-learn
Jakob Ovrum wrote: > As with core.stdc, refer to the > documentation for the equivalent C header. I only know of even core.stdc's existence since I've been poking into the Phobos sources. At least the Phobos documentation should mention that such modules exist. I note that in the proposed libr

Re: Why should file names intended for executables be valid identifiers?

2015-12-16 Thread Shriramana Sharma via Digitalmars-d-learn
Adam D. Ruppe wrote: > It still has a module name that can be used in reflection, must > be used in name disambiguation (at the linker level if nothing > else, any functions are mangled with the module name so they > don't conflict with C functions with the same name), and other > things. Sorry

Re: No documentation for core.sys?

2015-12-16 Thread Jakob Ovrum via Digitalmars-d-learn
On Thursday, 17 December 2015 at 04:23:30 UTC, Shriramana Sharma wrote: Jakob Ovrum wrote: As with core.stdc, refer to the documentation for the equivalent C header. I only know of even core.stdc's existence since I've been poking into the Phobos sources. At least the Phobos documentation s

Re: Using a struct as a wrapper for an extern(C) opaque type, no default constructor, what do?

2015-12-16 Thread Jakob Ovrum via Digitalmars-d-learn
On Thursday, 17 December 2015 at 04:05:30 UTC, Jeremy DeHaan wrote: http://dpaste.com/3FH3W13 Also, I would be wary of lazy initialization. We have bad experiences with it for AAs and standard containers. A typical example would be: void foo(Wrapper w) { ... w.doTheThing(); ...

Re: Using a struct as a wrapper for an extern(C) opaque type, no default constructor, what do?

2015-12-16 Thread Jakob Ovrum via Digitalmars-d-learn
On Thursday, 17 December 2015 at 04:05:30 UTC, Jeremy DeHaan wrote: Thanks. I guess what bugs me is that I always try to hide the fact that the API is a wrapper around C stuff, ie, I want to make people feel as though they're using idiomatic D. Doing something like this makes it feel like less

Re: Testing if a file is connected to a terminal

2015-12-16 Thread Jakob Ovrum via Digitalmars-d-learn
On Thursday, 17 December 2015 at 04:05:57 UTC, Adam D. Ruppe wrote: On Thursday, 17 December 2015 at 03:59:27 UTC, Jakob Ovrum wrote: There are some terminal libraries on Github (like consoled) but I have to say I think they're uninspiring in terms of quality and presentation. Can you be any

exit(1)?

2015-12-16 Thread Shriramana Sharma via Digitalmars-d-learn
http://dlang.org/phobos/std_getopt.html has a line in an example saying exit(1); Surely this works only if core.stdc.stdlib is imported? Should the example be modified to show the import? And is exit() the canonical way to exit the current process even in D? -- Shriramana Sharma, Penguin #395

Re: Testing if a file is connected to a terminal

2015-12-16 Thread Shriramana Sharma via Digitalmars-d-learn
Jakob Ovrum wrote: > Where's the reference documentation? There's a README: http://code.dlang.org/packages/consoled, and the source does seem to have DDoc comments... -- Shriramana Sharma, Penguin #395953

Re: exit(1)?

2015-12-16 Thread Jakob Ovrum via Digitalmars-d-learn
On Thursday, 17 December 2015 at 05:02:50 UTC, Shriramana Sharma wrote: http://dlang.org/phobos/std_getopt.html has a line in an example saying exit(1); Surely this works only if core.stdc.stdlib is imported? Should the example be modified to show the import? And is exit() the canonical way

Re: Using a struct as a wrapper for an extern(C) opaque type, no default constructor, what do?

2015-12-16 Thread Jeremy DeHaan via Digitalmars-d-learn
On Thursday, 17 December 2015 at 04:59:20 UTC, Jakob Ovrum wrote: On Thursday, 17 December 2015 at 04:05:30 UTC, Jeremy DeHaan wrote: http://dpaste.com/3FH3W13 Also, I would be wary of lazy initialization. We have bad experiences with it for AAs and standard containers. A typical example wou

Re: Using a struct as a wrapper for an extern(C) opaque type, no default constructor, what do?

2015-12-16 Thread Jakob Ovrum via Digitalmars-d-learn
On Thursday, 17 December 2015 at 06:04:14 UTC, Jeremy DeHaan wrote: And I guess what I was talking about before is that using a factory method feels klunky to me. If the things I am wrapping had been written in D they could use default initialization, so it feels wrong to do otherwise. I also j

Re: Why should file names intended for executables be valid identifiers?

2015-12-16 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-12-17 05:26, Shriramana Sharma wrote: Sorry but I don't get this fully: can't a hyphen be part of such mangled names? Aren't they just strings that the linker hashes or something? (My knowledge of compiler/executable internals is limited.) I'm not sure about a hyphen but a dollar sign

Re: No documentation for core.sys?

2015-12-16 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-12-17 04:47, Jakob Ovrum wrote: core.sys contains packages with system-specific D interface files (ports of header files). As with core.stdc, refer to the documentation for the equivalent C header. core.stdc is documented, in the sense that empty doc comments have been added to all sy

Re: exit(1)?

2015-12-16 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-12-17 06:11, Jakob Ovrum wrote: Ouch, that's not good. `exit` is not a good way to terminate a D program. It doesn't call destructors, including module destructors. The example should be restructured to `return 1;` from `main`. I agree with that, but why don't the runtime register a fu