Re: Dart bindings for D?

2014-10-30 Thread Suliman via Digitalmars-d-learn
Is it's possible to create single language that cover desktop and web? Like D+Dart? I ask becouse I can't understand why it's need 2 language if they are very simmiler and it's can be 1 language instead 2.

Re: Dart bindings for D?

2014-10-30 Thread via Digitalmars-d-learn
On Thursday, 30 October 2014 at 06:14:18 UTC, Suliman wrote: Is it's possible to create single language that cover desktop and web? Like D+Dart? It is probably not possible with D or any other language that is too far off from Javascript since the generated code becomes to large for fast

Re: Dart bindings for D?

2014-10-30 Thread Paolo Invernizzi via Digitalmars-d-learn
On Thursday, 30 October 2014 at 06:57:23 UTC, Ola Fosheim Grøstad wrote: There are also scripting frameworks that let you write portable code for web and mobile platforms, but they tend to be geared towards a special type of application. E.g. http://www.tidesdk.org/ http://cordova.apache.org/

Re: Dart bindings for D?

2014-10-30 Thread Suliman via Digitalmars-d-learn
I know that there is way to write all on JS. But I can't understand what the reason that there are no single language that can work on web and as native language.

Re: Is Apple LLVM 6 compatible with LDC

2014-10-30 Thread Joakim via Digitalmars-d-learn
On Wednesday, 29 October 2014 at 04:45:00 UTC, JJDuck wrote: I'm trying to compile my D code using LDC and hopefully used by my iOS program in Xcode. So I did some research (correct me if I'm wrong) If I compile my D code using LDC into static file and used by my iOS app and since they have

Re: Is Apple LLVM 6 compatible with LDC

2014-10-30 Thread Joakim via Digitalmars-d-learn
On Thursday, 30 October 2014 at 08:54:03 UTC, Joakim wrote: As far as I know, ldc's support for iOS is still in the early stages but they should be binary compatible, particularly if you compile ldc against the same llvm backend, and a C wrapper is likely still necessary, as I don't think Dan

Re: Dart bindings for D?

2014-10-30 Thread via Digitalmars-d-learn
On Thursday, 30 October 2014 at 08:39:15 UTC, Suliman wrote: I know that there is way to write all on JS. But I can't understand what the reason that there are no single language that can work on web and as native language. It is possible, but you need to design the language within the

Re: Dart bindings for D?

2014-10-30 Thread Suliman via Digitalmars-d-learn
It is possible, but you need to design the language within the constraints of javascript: 1. single threaded (or worker threads) 2. 53 bits integers, 26 bits for multiplies. 4. weird fixed size heaps (ArrayView) 5. if garbage collection then it has to be javascript style 6. no tricks:

Re: Dart bindings for D?

2014-10-30 Thread via Digitalmars-d-learn
On Thursday, 30 October 2014 at 09:35:04 UTC, Suliman wrote: It is possible, but you need to design the language within the constraints of javascript: 1. single threaded (or worker threads) Javascript is single threaded by nature. Parallel execution is done in isolation. No shared memory.

Re: Dart bindings for D?

2014-10-30 Thread Suliman via Digitalmars-d-learn
No! I mean not translation to js. I mean theoretical ability of creation new programming language that can work every where!

Re: Dart bindings for D?

2014-10-30 Thread Kagamin via Digitalmars-d-learn
On Thursday, 30 October 2014 at 10:18:40 UTC, Suliman wrote: No! I mean not translation to js. I mean theoretical ability of creation new programming language that can work every where! It's already created - C++! http://www.chromium.org/nativeclient

Re: Dart bindings for D?

2014-10-30 Thread via Digitalmars-d-learn
On Thursday, 30 October 2014 at 10:28:06 UTC, Kagamin wrote: On Thursday, 30 October 2014 at 10:18:40 UTC, Suliman wrote: No! I mean not translation to js. I mean theoretical ability of creation new programming language that can work every where! It's already created - C++!

Re: Dart bindings for D?

2014-10-30 Thread via Digitalmars-d-learn
On Thursday, 30 October 2014 at 10:18:40 UTC, Suliman wrote: No! I mean not translation to js. I mean theoretical ability of creation new programming language that can work every where! Yes, you can create a new programming language that can work everywhere if you restrict the semantics to

D support on SPARC/Solaris

2014-10-30 Thread Wyatt via Digitalmars-d-learn
At work, I have to target SPARC/Solaris. I'm writing code to interface with an internal network protocol, so my current choices are C and (old) C++ (remember Sun Studio? I wish I didn't have to). Having looked, it seems like there's some manner of support for SPARC in the runtime, but

Re: Dart bindings for D?

2014-10-30 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 30 October 2014 at 10:18:40 UTC, Suliman wrote: No! I mean not translation to js. I mean theoretical ability of creation new programming language that can work every where! The problem is getting new features into the browsers that people use. You could also just write native

Re: Dart bindings for D?

2014-10-30 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 30 October 2014 at 06:14:18 UTC, Suliman wrote: Is it's possible to create single language that cover desktop and web? Like D+Dart? You can also run D code on the web server and do very little on the web client itself for a lot of programs.

Re: D support on SPARC/Solaris

2014-10-30 Thread Kagamin via Digitalmars-d-learn
DMD is for x86 AFAIK.

Re: Need help: Return reference slice

2014-10-30 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/29/14 3:50 PM, advibm wrote: Hello, I would like to create a D function that returns a slice of a string. This slice shall be a reference to a part of the string argument. Is this generally possible in D? This is the function: auto ref betweenTwoStrings(T)(inout T src, string start,

Re: Need help: Return reference slice

2014-10-30 Thread bearophile via Digitalmars-d-learn
Steven Schveighoffer: long a = src.countUntil(start); if (a 0) return src; // null a += start.length; long b = src[a..$].countUntil(end); I think there it's better to use auto instead of long. Bye, bearophile

Re: D support on SPARC/Solaris

2014-10-30 Thread Joakim via Digitalmars-d-learn
On Thursday, 30 October 2014 at 14:03:23 UTC, Wyatt wrote: At work, I have to target SPARC/Solaris. I'm writing code to interface with an internal network protocol, so my current choices are C and (old) C++ (remember Sun Studio? I wish I didn't have to). Having looked, it seems like there's

Re: Need help: Return reference slice

2014-10-30 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/30/14 11:06 AM, bearophile wrote: Steven Schveighoffer: long a = src.countUntil(start); if (a 0) return src; // null a += start.length; long b = src[a..$].countUntil(end); I think there it's better to use auto instead of long. Sure, I didn't touch OP's function body,

Re: Need help: Return reference slice

2014-10-30 Thread advibm via Digitalmars-d-learn
Thank you very much for your additions. I am still new to D so I am glad to see solutions from experienced D programmers.

Re: safe pure unittest

2014-10-30 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Aug 13, 2014 at 07:53:34AM -0700, H. S. Teoh via Digitalmars-d-learn wrote: On Wed, Aug 13, 2014 at 03:03:14PM +0200, simendsjo via Digitalmars-d-learn wrote: On 08/13/2014 02:50 PM, Dicebot wrote: On Wednesday, 13 August 2014 at 12:26:02 UTC, simendsjo wrote: This is the first

Re: Dart bindings for D?

2014-10-30 Thread Laeeth Isharc via Digitalmars-d-learn
Hi. Thanks for all the thoughts, and sorry it has taken me a little while to reply. Adam - I liked your book very much: it really complemented the other resources out there, especially in communicating a refreshing spirit of enthusiasm and fearless exploration. ketmar - I took a look at

alias and extern(C)

2014-10-30 Thread Laeeth Isharc via Digitalmars-d-learn
Hi. I am trying to translate the following from the Dart header: typedef void (*Dart_MessageNotifyCallback)(Dart_Isolate dest_isolate); So I made a little simple test to understand callbacks in D. The code below works fine if you remove the extern(C). But I get the error

Re: alias and extern(C)

2014-10-30 Thread anonymous via Digitalmars-d-learn
On Thursday, 30 October 2014 at 18:43:21 UTC, Laeeth Isharc wrote: The code below works fine if you remove the extern(C). But I get the error functionpointertest.d(6): Error: basic type expected, not extern with the code as it is. How do I use alias with extern ? [...] alias Callback=

Re: alias and extern(C)

2014-10-30 Thread Laeeth Isharc via Digitalmars-d-learn
The code below works fine if you remove the extern(C). But I get the error functionpointertest.d(6): Error: basic type expected, not extern with the code as it is. How do I use alias with extern ? [...] alias Callback= extern(C) void function(int); Compiles as is with dmd 2.066. For

Re: Dart bindings for D?

2014-10-30 Thread ketmar via Digitalmars-d-learn
On Thu, 30 Oct 2014 17:39:13 + Laeeth Isharc via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: BTW what was the story behind dscript? It seems to have changed its name and no longer have so much connection to D: http://forum.dlang.org/thread/422be824.6030...@nospam.org we

Re: Dart bindings for D?

2014-10-30 Thread Laeeth Isharc via Digitalmars-d-learn
Ah - makes sense. It is satisfyingly fast... On Thursday, 30 October 2014 at 21:33:59 UTC, ketmar via Digitalmars-d-learn wrote: On Thu, 30 Oct 2014 17:39:13 + Laeeth Isharc via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: BTW what was the story behind dscript? It seems

Re: Dart bindings for D?

2014-10-30 Thread ketmar via Digitalmars-d-learn
On Thu, 30 Oct 2014 22:18:22 + Laeeth Isharc via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: Ah - makes sense. It is satisfyingly fast... the only bad thing is that it trashes /tmp/.rdmd-$UID dir. i wrote another simple script that is clearing that dir (but doesn't touch

String range to dchar.

2014-10-30 Thread Samuel Pike via Digitalmars-d-learn
Hi all. First time posting here. I recently downloaded the dmd compiler and started making a few exercises with the language. Nice language features but still somewhat confused with the library. If I use byDchar() over a string is there a possibility to get part of a character or is

Re: Dart bindings for D?

2014-10-30 Thread Rikki Cattermole via Digitalmars-d-learn
On 31/10/2014 6:39 a.m., Laeeth Isharc wrote: Hi. Thanks for all the thoughts, and sorry it has taken me a little while to reply. Adam - I liked your book very much: it really complemented the other resources out there, especially in communicating a refreshing spirit of enthusiasm and fearless

Re: String range to dchar.

2014-10-30 Thread Meta via Digitalmars-d-learn
On Friday, 31 October 2014 at 00:17:02 UTC, Samuel Pike wrote: Hi all. First time posting here. I recently downloaded the dmd compiler and started making a few exercises with the language. Nice language features but still somewhat confused with the library. If I use byDchar() over a string

Re: String range to dchar.

2014-10-30 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Oct 31, 2014 at 12:17:00AM +, Samuel Pike via Digitalmars-d-learn wrote: Hi all. First time posting here. I recently downloaded the dmd compiler and started making a few exercises with the language. Nice language features but still somewhat confused with the library. If I use

Multiple declarations in a C++ namespace

2014-10-30 Thread Paul O'Neil via Digitalmars-d-learn
I'm trying to bind to some C++ code, but when I compile the D side, there are errors. Here's my reduced test case: // C++ namespace ns { void func1(); void func2(); } // D module cpp; extern(C++, ns) void func1(); extern(C++, ns) void func2() dmd says:cpp_test.d(4): Error: namespace

Casting char[] ranges to string can lead to unexpected behavior

2014-10-30 Thread Domingo via Digitalmars-d-learn
I spent two days to find a nasty aleatory problem due to a string been assigned a range from a char[] array. This issue on vibe.d detail it a bit more: https://github.com/rejectedsoftware/vibe.d/issues/889 I'm putting it here to call attention for other developers for this problem. Cheers

Re: Casting char[] ranges to string can lead to unexpected behavior

2014-10-30 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Oct 31, 2014 at 02:03:58AM +, Domingo via Digitalmars-d-learn wrote: I spent two days to find a nasty aleatory problem due to a string been assigned a range from a char[] array. This issue on vibe.d detail it a bit more: https://github.com/rejectedsoftware/vibe.d/issues/889

Re: Casting char[] ranges to string can lead to unexpected behavior

2014-10-30 Thread Jesse Phillips via Digitalmars-d-learn
On Friday, 31 October 2014 at 02:04:00 UTC, Domingo wrote: I spent two days to find a nasty aleatory problem due to a string been assigned a range from a char[] array. This issue on vibe.d detail it a bit more: https://github.com/rejectedsoftware/vibe.d/issues/889 I'm putting it here to

Re: Template constraint: T is a value type

2014-10-30 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 29 October 2014 at 11:49:59 UTC, John Colvin wrote: On Wednesday, 29 October 2014 at 10:01:18 UTC, Gareth Foster wrote: Hi there, I'm looking to write a function template that operates only on value types. Basically I'm looking for an equivalent of where T: struct from C#

Re: Multiple declarations in a C++ namespace

2014-10-30 Thread Meta via Digitalmars-d-learn
On Friday, 31 October 2014 at 02:01:00 UTC, Paul O'Neil wrote: I'm trying to bind to some C++ code, but when I compile the D side, there are errors. Here's my reduced test case: // C++ namespace ns { void func1(); void func2(); } // D module cpp; extern(C++, ns) void func1();

Re: Dart bindings for D?

2014-10-30 Thread via Digitalmars-d-learn
On Thursday, 30 October 2014 at 17:39:14 UTC, Laeeth Isharc wrote: Thanks for the warning. I will have a low number of users, and whilst on occasion working data sets might be large, they won't stick around for very long so pre-allocating buffers should work fine (I hope).