Re: D + .NET

2015-03-12 Thread Kagamin via Digitalmars-d-learn
Only native libraries are more or less accessible from D, not .net. For .net you can use pinvoke (if you can build D dll) or IPC.

Re: How does laziness and UFCS interact?

2015-03-12 Thread Ali Çehreli via Digitalmars-d-learn
On 03/10/2015 08:00 AM, John Colvin wrote: On Tuesday, 10 March 2015 at 14:41:00 UTC, Logan Capaldo wrote: On Monday, 9 March 2015 at 22:15:43 UTC, Ali Çehreli wrote: You are right. I had the same observation at minute 11:27 below, where I warn against UFCS with assumeWontThrow:

Re: D + .NET

2015-03-12 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-03-11 14:30, Sativa wrote: Can you point out where it says anything about wpf or .NET? I'm having trouble finding it. I even searched for .net and wpf but still no luck ;/ Maybe you posted the wrong link by accident? You did mention win32 ;) For OS X Cocoa is the GUI framework. To

Re: How to find the cause of crash?

2015-03-12 Thread zhmt via Digitalmars-d-learn
I want to know how to locate the position of crashing in dlang? for example: there is stack dump in c, exception stack in java, they could help to locate the root of problems.

Looking for MQTT client library

2015-03-12 Thread o3o via Digitalmars-d-learn
I'm looking a MQTT [0] client library written in D, if it exists. Anyone know of any? I found the great Atila Neves MQTT broker (server) [1], and some C/C++ libraries [2], so, possible solutions are: a. Write a native D library from scratch b. Adapt/copy some parts of [1] to convert from

Re: How to use UFCS and std.algorithm.sort?

2015-03-12 Thread Ali Çehreli via Digitalmars-d-learn
On 03/10/2015 01:40 AM, Jonathan M Davis via Digitalmars-d-learn wrote: .sort on an array is going to use the built-in sort property. You need to use parens if you want to use the function in std.algorithm with an array and UFCS, e.g. arr.sort(); Didn't know that. Nice! Another option is to

Re: enum and static if

2015-03-12 Thread ketmar via Digitalmars-d-learn
On Wed, 11 Mar 2015 13:48:45 +, Namespace wrote: This code does not work: enum Test { Foo, static if (__VERSION__ = 2067) Bar, } Quatz } Any chance that this could work? nope. `static if` is statement, so it works only where statement is allowed. the

Re: D + .NET

2015-03-12 Thread Kagamin via Digitalmars-d-learn
You can also try to expose COM-accessible .net interface and use it through COM in D.

Re: Bypass the protection level

2015-03-12 Thread Namespace via Digitalmars-d-learn
On Wednesday, 11 March 2015 at 15:22:43 UTC, Ali Çehreli wrote: On 03/11/2015 04:40 AM, Namespace wrote: I can call draw on Drawable, because it is declared public and I cannot call draw on Sprite because it is declared protected (this is already a bit weird, why can I redeclare the

Re: auto function attributes based on type

2015-03-12 Thread ketmar via Digitalmars-d-learn
On Thu, 12 Mar 2015 04:51:40 +, amber wrote: On Thursday, 12 March 2015 at 04:04:28 UTC, weaselcat wrote: On Thursday, 12 March 2015 at 03:12:15 UTC, amber wrote: ... http://dlang.org/function.html#function-attribute-inference might be a good read if you haven't read it already. I did

Re: is eC alot like D?

2015-03-12 Thread ketmar via Digitalmars-d-learn
On Wed, 11 Mar 2015 19:26:13 -0700, Parke via Digitalmars-d-learn wrote: On Wed, 11 Mar 2015 06:22:32 +, sclytrack wrote: - You can include C library headers directly in your .ec code, without any special keyword (like extern C in C++) On Wed, Mar 11, 2015 at 1:59 AM, ketmar via

Re: D + .NET

2015-03-12 Thread Kagamin via Digitalmars-d-learn
On Wednesday, 11 March 2015 at 13:30:27 UTC, Sativa wrote: On Wednesday, 11 March 2015 at 08:45:15 UTC, Kagamin wrote: http://wiki.dlang.org/Libraries_and_Frameworks#GUI_Libraries Can you point out where it says anything about wpf or .NET? I'm having trouble finding it. I even searched for

Re: moving from c++ to D is easy?

2015-03-12 Thread ketmar via Digitalmars-d-learn
On Thu, 12 Mar 2015 13:01:29 +, ayush wrote: Is D a lot like c++ ? I am currently midway through learning c++ and I also want to learn D . So should i focus on one or learn both together? Will I find learning D easy if I already know c++ ? D is like C++, but made by human beings for human

Re: moving from c++ to D is easy?

2015-03-12 Thread Dennis Ritchie via Digitalmars-d-learn
On Thursday, 12 March 2015 at 13:01:31 UTC, ayush wrote: Is D a lot like c++? Enough. So should i focus on one or learn both together? You can study both together, although it is better to focus on one. Will I find learning D easy if I already know c++? Yes.

Re: moving from c++ to D is easy?

2015-03-12 Thread Daniel Kozák via Digitalmars-d-learn
On Thu, 12 Mar 2015 13:35:18 + ayush via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: On Thursday, 12 March 2015 at 13:13:40 UTC, Dennis Ritchie wrote: On Thursday, 12 March 2015 at 13:01:31 UTC, ayush wrote: Is D a lot like c++? Enough. So should i focus on one

Re: moving from c++ to D is easy?

2015-03-12 Thread ayush via Digitalmars-d-learn
On Thursday, 12 March 2015 at 13:13:40 UTC, Dennis Ritchie wrote: On Thursday, 12 March 2015 at 13:01:31 UTC, ayush wrote: Is D a lot like c++? Enough. So should i focus on one or learn both together? You can study both together, although it is better to focus on one. Will I find

Re: moving from c++ to D is easy?

2015-03-12 Thread weaselcat via Digitalmars-d-learn
On Thursday, 12 March 2015 at 13:01:31 UTC, ayush wrote: Is D a lot like c++ ? I am currently midway through learning c++ and I also want to learn D . So should i focus on one or learn both together? Will I find learning D easy if I already know c++ ? D is very much like C++, but the biggest

Re: moving from c++ to D is easy?

2015-03-12 Thread Dennis Ritchie via Digitalmars-d-learn
On Thursday, 12 March 2015 at 13:44:50 UTC, Daniel Kozák wrote: D is much easier to learn so I will start with it. And then you can try learn C++ if you still want and need it. Yes, but in D for beginners little literature, so I would recommend starting with C++.

Re: moving from c++ to D is easy?

2015-03-12 Thread ketmar via Digitalmars-d-learn
On Thu, 12 Mar 2015 13:56:28 +, Dennis Ritchie wrote: On Thursday, 12 March 2015 at 13:44:50 UTC, Daniel Kozák wrote: D is much easier to learn so I will start with it. And then you can try learn C++ if you still want and need it. Yes, but in D for beginners little literature, so I

Re: moving from c++ to D is easy?

2015-03-12 Thread via Digitalmars-d-learn
On Thursday, 12 March 2015 at 13:56:29 UTC, Dennis Ritchie wrote: On Thursday, 12 March 2015 at 13:44:50 UTC, Daniel Kozák wrote: D is much easier to learn so I will start with it. And then you can try learn C++ if you still want and need it. Yes, but in D for beginners little literature, so

Re: Memoization in compile-time

2015-03-12 Thread Rikki Cattermole via Digitalmars-d-learn
On 13/03/2015 2:23 p.m., Dennis Ritchie wrote: Is it possible to run this code in compile-time? import std.stdio, std.functional; ulong fact(ulong n) { alias mfact = memoize!fact; return n 2 ? 1 : n * mfact(n - 1); } void main() { writeln(fact(10)); } In CommonLisp variable

Re: chaining splitters

2015-03-12 Thread dnoob via Digitalmars-d-learn
Yes. That's it! Thanks a lot. On Wednesday, 11 March 2015 at 09:29:12 UTC, Dave S wrote: On Wednesday, 11 March 2015 at 00:00:39 UTC, dnoob wrote: Hello, I am parsing some text and I have the following; string text = some very long text; foreach(line; splitter(text, [13, 10])) {

Re: is eC alot like D?

2015-03-12 Thread Jerome St-Louis via Digitalmars-d-learn
To confirm guys eC does support C preprocessing. The C preprocessor is invoked before the eC compiler does its parsing. And all native C headers should work fine as well, although there might be some portability issues on more obscure platforms which have not yet been tested which would

Re: moving from c++ to D is easy?

2015-03-12 Thread Dennis Ritchie via Digitalmars-d-learn
On Thursday, 12 March 2015 at 14:47:22 UTC, ketmar wrote: there are alot of books on C++ 'cause C++ is insanely complicated and inconsistend. D design is *MUCH* better, so D doesn't need so many books teaching arcane art of programming. Well, in principle, can be started with a D, but

Re: Looking for MQTT client library

2015-03-12 Thread Atila Neves via Digitalmars-d-learn
Those are basically your options. You could wrap Mosquitto (a C implementation), but I'd just use the existing MQTT broker code. Then again, I would say that. :) Atila On Thursday, 12 March 2015 at 07:59:55 UTC, o3o wrote: I'm looking a MQTT [0] client library written in D, if it exists.

Re: Looking for MQTT client library

2015-03-12 Thread Orfeo via Digitalmars-d-learn
My preferred option is b. that is convert your MQTT broker to MQTT client. I'm not a MQTT expert, so, in your opinion what parts of your code should I change? (i.e. message module should be the same, peraphs module stream...) Thanks for your support (and also for your unit-threaded

Re: Template Parameter Deduction

2015-03-12 Thread Paul D Anderson via Digitalmars-d-learn
On Wednesday, 11 March 2015 at 23:04:15 UTC, Ali Çehreli wrote: On 03/11/2015 03:44 PM, Paul D Anderson wrote: This used to work in D2.065: given 1) public T mul(T)(in T x, in T y, Context context = T.context) if (isDecimal!T) // one template parameter for the two input values and

Re: moving from c++ to D is easy?

2015-03-12 Thread Namespace via Digitalmars-d-learn
On Thursday, 12 March 2015 at 18:57:51 UTC, Ali Çehreli wrote: On 03/12/2015 06:01 AM, ayush wrote: Is D a lot like c++ ? I came to D from C++. I remember the following being notable differences: - In D, classes have reference semantics. I quickly realized that this is not an issue

Re: moving from c++ to D is easy?

2015-03-12 Thread Dennis Ritchie via Digitalmars-d-learn
On Thursday, 12 March 2015 at 18:57:51 UTC, Ali Çehreli wrote: If you are a mortal like myself, you may find out years later that you are still at the midway point. Happened to me several times when I was learning C++. :) О, yeah.

Re: moving from c++ to D is easy?

2015-03-12 Thread Ali Çehreli via Digitalmars-d-learn
On 03/12/2015 06:01 AM, ayush wrote: Is D a lot like c++ ? I came to D from C++. I remember the following being notable differences: - In D, classes have reference semantics. I quickly realized that this is not an issue because so many of my C++ types were hand-reference-typified :p by this

moving from c++ to D is easy?

2015-03-12 Thread ayush via Digitalmars-d-learn
Is D a lot like c++ ? I am currently midway through learning c++ and I also want to learn D . So should i focus on one or learn both together? Will I find learning D easy if I already know c++ ?

Re: moving from c++ to D is easy?

2015-03-12 Thread Ali Çehreli via Digitalmars-d-learn
On 03/12/2015 01:19 PM, Namespace wrote: On Thursday, 12 March 2015 at 18:57:51 UTC, Ali Çehreli wrote: On 03/12/2015 06:01 AM, ayush wrote: Is D a lot like c++ ? I came to D from C++. I remember the following being notable differences: - In D, classes have reference semantics. I

Re: moving from c++ to D is easy?

2015-03-12 Thread Namespace via Digitalmars-d-learn
On Thursday, 12 March 2015 at 21:41:07 UTC, Ali Çehreli wrote: On 03/12/2015 01:19 PM, Namespace wrote: On Thursday, 12 March 2015 at 18:57:51 UTC, Ali Çehreli wrote: On 03/12/2015 06:01 AM, ayush wrote: Is D a lot like c++ ? I came to D from C++. I remember the following being notable

Re: Looking for MQTT client library

2015-03-12 Thread Dicebot via Digitalmars-d-learn
If it isn't on http://code.dlang.org it is unlikely to exist in easy to use form. Starting with C bindings is probably the easiest approach - you may want to check out https://github.com/jacob-carlborg/dstep if you haven't already.

vibe.d crashs when forwarding a stream to another?

2015-03-12 Thread zhmt via Digitalmars-d-learn
I posted in vibe.d forum, no one replied . Help me please: http://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/thread/24458/

Memoization in compile-time

2015-03-12 Thread Dennis Ritchie via Digitalmars-d-learn
Is it possible to run this code in compile-time? import std.stdio, std.functional; ulong fact(ulong n) { alias mfact = memoize!fact; return n 2 ? 1 : n * mfact(n - 1); } void main() { writeln(fact(10)); } In CommonLisp variable *factorial-cache* available in CT, and

Re: embedding Pyd in Windows program

2015-03-12 Thread Ellery Newcomer via Digitalmars-d-learn
On 03/11/2015 07:59 PM, Matt wrote: Right, copying site.py into my program's working dir sorts out the missing module error, but I now get a syntax error: file=sys.stderr) ^ SyntaxError: invalid syntax Error executing command run: Program exited with code 1 I googled this, and

Re: auto function attributes based on type

2015-03-12 Thread weaselcat via Digitalmars-d-learn
On Thursday, 12 March 2015 at 05:01:50 UTC, amber wrote: On Thursday, 12 March 2015 at 04:51:42 UTC, amber wrote: On Thursday, 12 March 2015 at 04:04:28 UTC, weaselcat wrote: On Thursday, 12 March 2015 at 03:12:15 UTC, amber wrote: ...