Re: ndBenchmarks #1: ndslice.algorithm vs std.numeric vs std.algorithm

2016-08-03 Thread jmh530 via Digitalmars-d-announce
On Wednesday, 3 August 2016 at 20:53:59 UTC, Ilya Yaroshenko wrote: Hi all, There are two first [1] benchmarks for upcoming ndslice.algorithm [2]. Recent LDC alpha based on LLVM 3.8 and recent Mir v0.16.0-alpha3 are required. @fasmath syntax may be changed a little bit and will be simplified

Re: ndBenchmarks #1: ndslice.algorithm vs std.numeric vs std.algorithm

2016-08-03 Thread Ilya Yaroshenko via Digitalmars-d-announce
On Wednesday, 3 August 2016 at 22:22:19 UTC, Johan Engelen wrote: On Wednesday, 3 August 2016 at 20:53:59 UTC, Ilya Yaroshenko Dot Product: ndReduce vectorized = 3 ms, 314 μs ndReduce = 14 ms, 767 μs **That's** the difference with or without fastmath?? The first

Re: [DIP] In-place struct initialization

2016-08-03 Thread Patrick Schluter via Digitalmars-d
On Wednesday, 3 August 2016 at 21:35:58 UTC, ZombineDev wrote: On Wednesday, 3 August 2016 at 20:30:07 UTC, deadalnix wrote: On Sunday, 31 July 2016 at 14:38:33 UTC, Lodovico Giaretta wrote: I support this idea of extending curly-brace initializers. It would be very useful and less ambiguous

Re: Running a D game in the browser

2016-08-03 Thread Joel via Digitalmars-d-announce
On Wednesday, 3 August 2016 at 23:23:24 UTC, Joel wrote: On Wednesday, 3 August 2016 at 20:26:23 UTC, Sebastien Alaiwan wrote: Hi, I finally managed to compile some D code to asm.js, using Emscripten. Good work. [snip] You can play a minimalistic demo:

Re: Self Optimizing Code

2016-08-03 Thread Chris Wright via Digitalmars-d
In your example, you have a size_t or double factor for array growth. If you set it to -1, you would have an unpleasant time. You need a way to specify the range of valid values. In more complex algorithms, you need a way to evaluate several parameters together to determine if they are valid.

[Issue 16201] When all paths inside a static if return/throw, the portion after static if should be as if "else" were used

2016-08-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16201 Les De Ridder changed: What|Removed |Added CC||dl...@lesderid.net --

[Issue 14835] Statement is not reachable doesn't play along generic code

2016-08-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14835 Les De Ridder changed: What|Removed |Added CC||dl...@lesderid.net --

Re: Self Optimizing Code

2016-08-03 Thread Mark J Twain via Digitalmars-d
On Thursday, 4 August 2016 at 01:54:57 UTC, Chris Wright wrote: On Wed, 03 Aug 2016 21:09:46 +, ikod wrote: This is not just profiling, but "Profile-Guided Optimization (PGO)" The person is talking about algorithms with tuning parameters (like array growth rate when appending) adjusting

Re: Self Optimizing Code

2016-08-03 Thread Chris Wright via Digitalmars-d
On Wed, 03 Aug 2016 21:09:46 +, ikod wrote: > This is not just profiling, but "Profile-Guided Optimization (PGO)" The person is talking about algorithms with tuning parameters (like array growth rate when appending) adjusting those parameters based on observed characteristics of the

Re: Running a D game in the browser

2016-08-03 Thread Mark J Twain via Digitalmars-d-announce
On Wednesday, 3 August 2016 at 20:26:23 UTC, Sebastien Alaiwan wrote: Hi, I finally managed to compile some D code to asm.js, using Emscripten. It had been done by one dude several years ago, but some changes in the inner workings of Emscripten (the introduction of fastcomp, also probably

Re: Running a D game in the browser

2016-08-03 Thread Joel via Digitalmars-d-announce
On Wednesday, 3 August 2016 at 20:26:23 UTC, Sebastien Alaiwan wrote: [snip] Please let me know what you think! Another thing, the sound effects are late.

Re: [DIP] In-place struct initialization

2016-08-03 Thread Chris Wright via Digitalmars-d
On Wed, 03 Aug 2016 20:30:07 +, deadalnix wrote: > On Sunday, 31 July 2016 at 14:38:33 UTC, Lodovico Giaretta wrote: >> I support this idea of extending curly-brace initializers. It would be >> very useful and less ambiguous than parenthesized initializers. >> >> > Curly braces are already

Re: Why D is not popular enough?

2016-08-03 Thread bitwise via Digitalmars-d
On Wednesday, 3 August 2016 at 21:19:21 UTC, ketmar wrote: On Wednesday, 3 August 2016 at 19:57:13 UTC, bitwise wrote: On Tuesday, 2 August 2016 at 07:50:29 UTC, ketmar wrote: On Monday, 1 August 2016 at 19:33:48 UTC, bitwise wrote: 'scope' keyword, for example, is legal in D syntax, but

Re: Passing refs with delegates

2016-08-03 Thread Mark J Twain via Digitalmars-d-learn
On Wednesday, 3 August 2016 at 08:12:00 UTC, Ali Çehreli wrote: On 08/02/2016 07:55 PM, Mark J Twain wrote: [...] I didn't know one could use 'auto ref' in this case but the following simple test works: auto foo(Func, Args...)(Func callback, auto ref Args args) { return callback(args);

Re: LDC 1.1.0-beta2 has been released!

2016-08-03 Thread Joakim via Digitalmars-d-announce
On Wednesday, 3 August 2016 at 20:12:59 UTC, Kai Nacke wrote: Hi everyone, LDC 1.1.0-beta2, the LLVM-based D compiler, is available for download! This BETA release is based on the 2.071.1 frontend and standard library and supports LLVM 3.5-3.9. We provide binaries for Linux, OX X, FreeBSD,

Re: C binding with D function

2016-08-03 Thread lobo via Digitalmars-d-learn
On Wednesday, 3 August 2016 at 15:41:55 UTC, llaine wrote: void foo(string str) { writeln(str); } shouldn't foo be: void foo(char* str) { import std.string; writeln(str.fromStringz); } bye, lobo

[Issue 16351] New: Nonstandard output library causes no-argument writeln() to fail.

2016-08-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16351 Issue ID: 16351 Summary: Nonstandard output library causes no-argument writeln() to fail. Product: D Version: D2 Hardware: x86_64 OS: Linux Status:

Re: Running a D game in the browser

2016-08-03 Thread Joel via Digitalmars-d-announce
On Wednesday, 3 August 2016 at 20:26:23 UTC, Sebastien Alaiwan wrote: Hi, I finally managed to compile some D code to asm.js, using Emscripten. Good work. [snip] You can play a minimalistic demo: http://code.alaiwan.org/dscripten/full.html [snip] Though, it looks like the score isn't

Why don't we switch to C like floating pointed arithmetic instead of automatic expansion to reals?

2016-08-03 Thread Seb via Digitalmars-d
There was a recent discussion on Phobos about D's floating point behavior [1]. I think Ilya summarized quite elegantly our problem: We need to argue with @WalterBright to switch to C like floating pointed arithmetic instead of automatic expansion to reals (this is so horrible that it may kill

Re: Running a D game in the browser

2016-08-03 Thread Dechcaudron via Digitalmars-d-announce
On Wednesday, 3 August 2016 at 20:26:23 UTC, Sebastien Alaiwan wrote: I finally managed to compile some D code to asm.js, using Emscripten. I know virtually nothing about compilers and even less about Emscripten, but the fact that you managed to get a D game running inside a browser is plain

Re: ndBenchmarks #1: ndslice.algorithm vs std.numeric vs std.algorithm

2016-08-03 Thread Johan Engelen via Digitalmars-d-announce
On Wednesday, 3 August 2016 at 20:53:59 UTC, Ilya Yaroshenko wrote: Hi all, There are two first [1] benchmarks for upcoming ndslice.algorithm [2]. Recent LDC alpha based on LLVM 3.8 and recent Mir v0.16.0-alpha3 are required. @fasmath syntax may be changed a little bit and will be simplified

Re: ndBenchmarks #1: ndslice.algorithm vs std.numeric vs std.algorithm

2016-08-03 Thread Seb via Digitalmars-d-announce
On Wednesday, 3 August 2016 at 20:53:59 UTC, Ilya Yaroshenko wrote: Hi all, There are two first [1] benchmarks for upcoming ndslice.algorithm [2]. Recent LDC alpha based on LLVM 3.8 and recent Mir v0.16.0-alpha3 are required. @fasmath syntax may be changed a little bit and will be simplified

Re: Indexing with an arbitrary type

2016-08-03 Thread Alex via Digitalmars-d-learn
On Wednesday, 3 August 2016 at 17:56:54 UTC, Jonathan M Davis wrote: int is comparable, but it's not going to index float[string]. Only a string is going to do that. Similarly, long is comparable, but on a 32-bit system, it won't index int[], because it's larger than size_t, which is the

Re: [DIP] In-place struct initialization

2016-08-03 Thread ZombineDev via Digitalmars-d
On Wednesday, 3 August 2016 at 20:30:07 UTC, deadalnix wrote: On Sunday, 31 July 2016 at 14:38:33 UTC, Lodovico Giaretta wrote: I support this idea of extending curly-brace initializers. It would be very useful and less ambiguous than parenthesized initializers. Curly braces are already

Re: [OT] Music to Program Compilers To

2016-08-03 Thread ketmar via Digitalmars-d
On Wednesday, 3 August 2016 at 21:32:06 UTC, ketmar wrote: not mine piece of... sound. ;-) for the curious: it was "piece of cake", not what you expected from me.

Re: [OT] Music to Program Compilers To

2016-08-03 Thread ketmar via Digitalmars-d
On Wednesday, 3 August 2016 at 19:37:36 UTC, Kai Nacke wrote: What about Grave Digger (https://www.youtube.com/watch?v=p-x_uBB-KIE), Rebellion (https://www.youtube.com/watch?v=oIqpGA1PDTw=PL1CB505201A6DCB79) or Majesty (https://www.youtube.com/watch?v=6CPwz4E7d8I) ah, we are stepping in

Re: Self Optimizing Code

2016-08-03 Thread ketmar via Digitalmars-d
On Wednesday, 3 August 2016 at 19:22:05 UTC, Mark "J" Twain wrote: you know what? i'm sorry that i stepped in your thread. yet i fixed this, as i added you to my ignore list, which means that i won't get any more notifications with your name on 'em, and won't see 'em in web frontend. sorry, i

Re: Self Optimizing Code

2016-08-03 Thread Mark J Twain via Digitalmars-d
On Wednesday, 3 August 2016 at 21:09:46 UTC, ikod wrote: On Wednesday, 3 August 2016 at 19:25:08 UTC, Mark "J" Twain wrote: On Wednesday, 3 August 2016 at 18:18:51 UTC, ikod wrote: On Tuesday, 2 August 2016 at 22:06:38 UTC, Mark "J" Twain wrote: Another new D feature here! Self-Optimizing

Re: Why D is not popular enough?

2016-08-03 Thread ketmar via Digitalmars-d
On Wednesday, 3 August 2016 at 19:57:13 UTC, bitwise wrote: On Tuesday, 2 August 2016 at 07:50:29 UTC, ketmar wrote: On Monday, 1 August 2016 at 19:33:48 UTC, bitwise wrote: 'scope' keyword, for example, is legal in D syntax, but doesn't actually do anything. sorry, but you are wrong here.

Re: ndBenchmarks #1: ndslice.algorithm vs std.numeric vs std.algorithm

2016-08-03 Thread Ilya Yaroshenko via Digitalmars-d-announce
The tests above are for double precision floating point numbers. The results for single precision are below. Dot Product (single precision): ndReduce vectorized = 2 ms, 200 μs ndReduce = 14 ms, 543 μs numeric.dotProduct, arrays = 7 ms, 208 μs numeric.dotProduct, slices

Re: Self Optimizing Code

2016-08-03 Thread ikod via Digitalmars-d
On Wednesday, 3 August 2016 at 19:25:08 UTC, Mark "J" Twain wrote: On Wednesday, 3 August 2016 at 18:18:51 UTC, ikod wrote: On Tuesday, 2 August 2016 at 22:06:38 UTC, Mark "J" Twain wrote: Another new D feature here! Self-Optimizing Code is a fantastic research area that can lead to greater

Re: ndBenchmarks #1: ndslice.algorithm vs std.numeric vs std.algorithm

2016-08-03 Thread Ilya Yaroshenko via Digitalmars-d-announce
On Wednesday, 3 August 2016 at 20:53:59 UTC, Ilya Yaroshenko wrote: Update: Dot Product: zip & reduce = 74 ms, 280 μs zip & reduce = 44 ms, 57 μs Euclidean Distance: zip & reduce = 73 ms, 678 μs zip & reduce = 44

Re: std.experimental.xml available on DUB

2016-08-03 Thread Robert burner Schadek via Digitalmars-d-announce
On Wednesday, 3 August 2016 at 09:04:30 UTC, Jacob Carlborg wrote: Another question. I see that there are a couple of different lexers available. Can those be exposed with the same interface/type instead of using different types? Perhaps based on the input type. Well, currently you have to

Re: [DIP] In-place struct initialization

2016-08-03 Thread deadalnix via Digitalmars-d
On Wednesday, 3 August 2016 at 20:43:25 UTC, Enamex wrote: On Wednesday, 3 August 2016 at 20:30:07 UTC, deadalnix wrote: On Sunday, 31 July 2016 at 14:38:33 UTC, Lodovico Giaretta wrote: I support this idea of extending curly-brace initializers. It would be very useful and less ambiguous than

ndBenchmarks #1: ndslice.algorithm vs std.numeric vs std.algorithm

2016-08-03 Thread Ilya Yaroshenko via Digitalmars-d-announce
Hi all, There are two first [1] benchmarks for upcoming ndslice.algorithm [2]. Recent LDC alpha based on LLVM 3.8 and recent Mir v0.16.0-alpha3 are required. @fasmath syntax may be changed a little bit and will be simplified anyway. Dot Product: ndReduce vectorized = 3 ms, 314 μs

Re: Running a D game in the browser

2016-08-03 Thread Kai Nacke via Digitalmars-d-announce
On Wednesday, 3 August 2016 at 20:26:23 UTC, Sebastien Alaiwan wrote: Hi, I finally managed to compile some D code to asm.js, using Emscripten. It had been done by one dude several years ago, but some changes in the inner workings of Emscripten (the introduction of fastcomp, also probably

Re: [DIP] In-place struct initialization

2016-08-03 Thread Enamex via Digitalmars-d
On Wednesday, 3 August 2016 at 20:30:07 UTC, deadalnix wrote: On Sunday, 31 July 2016 at 14:38:33 UTC, Lodovico Giaretta wrote: I support this idea of extending curly-brace initializers. It would be very useful and less ambiguous than parenthesized initializers. Curly braces are already

Re: [DIP] In-place struct initialization

2016-08-03 Thread deadalnix via Digitalmars-d
On Sunday, 31 July 2016 at 14:38:33 UTC, Lodovico Giaretta wrote: I support this idea of extending curly-brace initializers. It would be very useful and less ambiguous than parenthesized initializers. Curly braces are already extremely overloaded. They can start a block statement, a

Running a D game in the browser

2016-08-03 Thread Sebastien Alaiwan via Digitalmars-d-announce
Hi, I finally managed to compile some D code to asm.js, using Emscripten. It had been done by one dude several years ago, but some changes in the inner workings of Emscripten (the introduction of fastcomp, also probably combined with changes in the way LDC generates LLVM bitcode) made it

LDC 1.1.0-beta2 has been released!

2016-08-03 Thread Kai Nacke via Digitalmars-d-announce
Hi everyone, LDC 1.1.0-beta2, the LLVM-based D compiler, is available for download! This BETA release is based on the 2.071.1 frontend and standard library and supports LLVM 3.5-3.9. We provide binaries for Linux, OX X, FreeBSD, Win32 & Win64, Linux/ARM (armv7hf), now bundled with DUB. :-)

Re: Why D is not popular enough?

2016-08-03 Thread bitwise via Digitalmars-d
On Tuesday, 2 August 2016 at 07:50:29 UTC, ketmar wrote: On Monday, 1 August 2016 at 19:33:48 UTC, bitwise wrote: 'scope' keyword, for example, is legal in D syntax, but doesn't actually do anything. sorry, but you are wrong here. of course, it does HAVE effect. `void foo (scope delegate

Re: [OT] Music to Program Compilers To

2016-08-03 Thread Kai Nacke via Digitalmars-d
On Wednesday, 3 August 2016 at 09:09:38 UTC, Chris wrote: On Wednesday, 3 August 2016 at 05:05:08 UTC, Kai Nacke wrote: On Tuesday, 2 August 2016 at 11:47:16 UTC, Chris wrote: On Tuesday, 2 August 2016 at 05:03:43 UTC, Kai Nacke wrote: On Saturday, 30 July 2016 at 03:41:10 UTC, Jack Stouffer

Re: D safety! New Feature?

2016-08-03 Thread Mark J Twain via Digitalmars-d
On Wednesday, 3 August 2016 at 08:09:41 UTC, qznc wrote: On Tuesday, 2 August 2016 at 21:48:58 UTC, Mark Twain wrote: global ImmutableArray!int Data; MutableArray!int DataCopy = Data.Copy; // Creates a mutable copy of Data. ... Do work with DataCopy ... Data.Replace(DataCopy); // Makes a

Re: alias to function literal, call without () not possible

2016-08-03 Thread Andre Pany via Digitalmars-d-learn
On Wednesday, 3 August 2016 at 18:15:23 UTC, Anonymouse wrote: On Wednesday, 3 August 2016 at 17:16:10 UTC, Andre Pany wrote: [...] [...] ...is an alias for a delegate/function returning an Object. It is analogous to [...] [...] ...is a function accepting an Object parameter. In main

Re: [OT] Music to Program Compilers To

2016-08-03 Thread Kai Nacke via Digitalmars-d
On Wednesday, 3 August 2016 at 07:08:49 UTC, ketmar wrote: On Wednesday, 3 August 2016 at 05:01:40 UTC, Kai Nacke wrote: Dark Tranquillity is one of my preferred bands. :-) wow! ;-) Do you know Insomnium? They are awesome, too. yeah, found 'em not a long time ago, almost accidentally. great

Re: Initialize array of objects not work

2016-08-03 Thread Andre Pany via Digitalmars-d-learn
On Wednesday, 3 August 2016 at 18:34:02 UTC, Ali Çehreli wrote: On 08/03/2016 10:58 AM, Andre Pany wrote: > [...] (linear/equals/) > [...] common > [...] quadraticCoefficient(1)~linearCoefficient(2)~equals()~constant(1); [...] Thanks a lot Ali. Kind regards André

Re: D safety! New Feature?

2016-08-03 Thread Mark J Twain via Digitalmars-d
On Wednesday, 3 August 2016 at 05:44:42 UTC, ag0aep6g wrote: On 08/02/2016 11:48 PM, Mark Twain wrote: global ImmutableArray!int Data; MutableArray!int DataCopy = Data.Copy; // Creates a mutable copy of Data. ... Do work with DataCopy ... Data.Replace(DataCopy); // Makes a copy of DataCopy.

Re: Self Optimizing Code

2016-08-03 Thread Mark J Twain via Digitalmars-d
On Wednesday, 3 August 2016 at 18:18:51 UTC, ikod wrote: On Tuesday, 2 August 2016 at 22:06:38 UTC, Mark "J" Twain wrote: Another new D feature here! Self-Optimizing Code is a fantastic research area that can lead to greater improvements in code, make them more responsive to individual

Re: Self Optimizing Code

2016-08-03 Thread Mark J Twain via Digitalmars-d
On Wednesday, 3 August 2016 at 07:36:21 UTC, ketmar wrote: hello, you just invented JIT compiler. Um, no. JIT = Just in time compilation. The code is already compiled and in binary form. The only differnece is that hard coded values = literals in the binary, become variables. There is no

Re: C binding with D function

2016-08-03 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 3 August 2016 at 15:56:34 UTC, llaine wrote: Okay on stack overflow, they are not using ffi but dl. I tried changing ffi to dl, it's the same don't work unfortunatly. This FFI example calls an init function from a library:

Re: Initialize array of objects not work

2016-08-03 Thread Ali Çehreli via Digitalmars-d-learn
On 08/03/2016 10:58 AM, Andre Pany wrote: > I try to initialize an array of objects. The methods (linear/equals/) > returns object of different classes, but all implement a common > interface "Element". > > Element[] elements = >

Re: Self Optimizing Code

2016-08-03 Thread ikod via Digitalmars-d
On Tuesday, 2 August 2016 at 22:06:38 UTC, Mark "J" Twain wrote: Another new D feature here! Self-Optimizing Code is a fantastic research area that can lead to greater improvements in code, make them more responsive to individual applications, and requires very little effort. Looks like

Re: alias to function literal, call without () not possible

2016-08-03 Thread Anonymouse via Digitalmars-d-learn
On Wednesday, 3 August 2016 at 17:16:10 UTC, Andre Pany wrote: Hi, I just stumbled over this behavior. I am not sure whether the behavior is correct or not. [...] alias foo = () => new Object; ...is an alias for a delegate/function returning an Object. It is analogous to alias foo = () {

Initialize array of objects not work

2016-08-03 Thread Andre Pany via Digitalmars-d-learn
Hi, I try to initialize an array of objects. The methods (linear/equals/) returns object of different classes, but all implement a common interface "Element". Element[] elements = quadraticCoefficient(1)~linearCoefficient(2)~equals()~constant(1); I tried different casts and different

Re: Indexing with an arbitrary type

2016-08-03 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, August 03, 2016 16:42:18 Alex via Digitalmars-d-learn wrote: > On Wednesday, 3 August 2016 at 14:46:25 UTC, Alex wrote: > > On Wednesday, 3 August 2016 at 14:23:59 UTC, Jonathan M Davis > > wrote: > > > > But it should. > > > > Just found this: > >

alias to function literal, call without () not possible

2016-08-03 Thread Andre Pany via Digitalmars-d-learn
Hi, I just stumbled over this behavior. I am not sure whether the behavior is correct or not. alias foo = () => new Object; void bar(Object o){} void main() { auto n1 = foo; bar(foo); } While first line in main is working fine, second line does not compile due to missing ().

Re: Indexing with an arbitrary type

2016-08-03 Thread Alex via Digitalmars-d-learn
On Wednesday, 3 August 2016 at 14:46:25 UTC, Alex wrote: On Wednesday, 3 August 2016 at 14:23:59 UTC, Jonathan M Davis wrote: But it should. Just found this: https://www.sgi.com/tech/stl/StrictWeakOrdering.html which should be fulfilled by a type, which can be used as a key. So, in my

Re: C binding with D function

2016-08-03 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 3 August 2016 at 15:56:34 UTC, llaine wrote: Okay on stack overflow, they are not using ffi but dl. I tried changing ffi to dl, it's the same don't work unfortunatly. That's about as far as I can go without having it set up on my machine. The procedure should be the same as I

Re: C binding with D function

2016-08-03 Thread llaine via Digitalmars-d-learn
On Wednesday, 3 August 2016 at 15:47:48 UTC, bachmeier wrote: On Wednesday, 3 August 2016 at 15:24:56 UTC, llaine wrote: On Wednesday, 3 August 2016 at 15:14:24 UTC, Kagamin wrote: On Wednesday, 3 August 2016 at 15:08:51 UTC, llaine wrote: So basically I have to create wrapper.c ? Yes, but

Re: C binding with D function

2016-08-03 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 3 August 2016 at 15:24:56 UTC, llaine wrote: On Wednesday, 3 August 2016 at 15:14:24 UTC, Kagamin wrote: On Wednesday, 3 August 2016 at 15:08:51 UTC, llaine wrote: So basically I have to create wrapper.c ? Yes, but you should write it in D. Runtime initialization is at

Re: C binding with D function

2016-08-03 Thread llaine via Digitalmars-d-learn
On Wednesday, 3 August 2016 at 15:24:56 UTC, llaine wrote: On Wednesday, 3 August 2016 at 15:14:24 UTC, Kagamin wrote: After digging a bit more, I get a different error. import std.stdio; import core.runtime; extern(C) { void initialize() { Runtime.initialize(); } void

Re: q about bindings to C (noob)

2016-08-03 Thread RomanZ via Digitalmars-d-learn
thanks.

Re: C binding with D function

2016-08-03 Thread llaine via Digitalmars-d-learn
On Wednesday, 3 August 2016 at 15:14:24 UTC, Kagamin wrote: On Wednesday, 3 August 2016 at 15:08:51 UTC, llaine wrote: So basically I have to create wrapper.c ? Yes, but you should write it in D. Runtime initialization is at https://dlang.org/phobos/core_runtime.html#.Runtime Okay I tried

Re: C binding with D function

2016-08-03 Thread Kagamin via Digitalmars-d-learn
On Wednesday, 3 August 2016 at 15:08:51 UTC, llaine wrote: So basically I have to create wrapper.c ? Yes, but you should write it in D. Runtime initialization is at https://dlang.org/phobos/core_runtime.html#.Runtime

Re: C binding with D function

2016-08-03 Thread llaine via Digitalmars-d-learn
On Wednesday, 3 August 2016 at 15:08:51 UTC, llaine wrote: On Wednesday, 3 August 2016 at 14:58:04 UTC, bachmeier wrote: On Wednesday, 3 August 2016 at 15:08:51 UTC, llaine wrote: by switching my file to just this extern(C) { char* foo(char* str) { return str; } } It works.

Re: C binding with D function

2016-08-03 Thread llaine via Digitalmars-d-learn
On Wednesday, 3 August 2016 at 14:58:04 UTC, bachmeier wrote: On Wednesday, 3 August 2016 at 14:01:34 UTC, llaine wrote: On Wednesday, 3 August 2016 at 13:49:36 UTC, bachmeier wrote: Probably because you need the D runtime. One way is to import core.runtime and call Runtime.initialize().

Re: Indexing with an arbitrary type

2016-08-03 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, August 03, 2016 09:21:13 Alex via Digitalmars-d-learn wrote: > On Monday, 1 August 2016 at 16:09:50 UTC, Alex wrote: > > On Monday, 1 August 2016 at 15:51:58 UTC, Jonathan M Davis > > wrote: > > template isIndexable(I, T) > > { > > > > enum isIndexable = __traits(compiles,

Re: C binding with D function

2016-08-03 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 3 August 2016 at 14:01:34 UTC, llaine wrote: On Wednesday, 3 August 2016 at 13:49:36 UTC, bachmeier wrote: Probably because you need the D runtime. One way is to import core.runtime and call Runtime.initialize(). Where should I call this Runtime.initialize() ? Does the

Re: Indexing with an arbitrary type

2016-08-03 Thread Alex via Digitalmars-d-learn
On Wednesday, 3 August 2016 at 14:23:59 UTC, Jonathan M Davis wrote: On Wednesday, August 03, 2016 09:21:13 Alex via Digitalmars-d-learn wrote: On Monday, 1 August 2016 at 16:09:50 UTC, Alex wrote: > On Monday, 1 August 2016 at 15:51:58 UTC, Jonathan M Davis > wrote: > template isIndexable(I,

Re: DMD on ARM/Linux (for controlling EV3 Lego Mindstorm)?

2016-08-03 Thread Kagamin via Digitalmars-d-learn
There's also official armv7hf release https://github.com/ldc-developers/ldc/releases

Re: C binding with D function

2016-08-03 Thread llaine via Digitalmars-d-learn
On Wednesday, 3 August 2016 at 14:02:12 UTC, Adam D. Ruppe wrote: On Wednesday, 3 August 2016 at 13:44:46 UTC, llaine wrote: void puts(string str) { writeln(str); } A D string isn't the same as a C string, so your params won't work as-is, and writeln requires the D runtime to be

Re: Self Optimizing Code

2016-08-03 Thread Jack Stouffer via Digitalmars-d
On Wednesday, 3 August 2016 at 07:36:21 UTC, ketmar wrote: hello, you just invented JIT compiler. Yup, 100% a JIT. I'm pretty sure PyPy does this to some degree

Re: Self Optimizing Code

2016-08-03 Thread ketmar via Digitalmars-d
On Wednesday, 3 August 2016 at 13:45:13 UTC, Luis wrote: On Wednesday, 3 August 2016 at 07:36:21 UTC, ketmar wrote: hello, you just invented JIT compiler. This is not JIT. yes, it is. fairly advanced one, that does dynamic recompilation of some code pathes, but still JIT. being in touch with

Re: C binding with D function

2016-08-03 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 3 August 2016 at 13:44:46 UTC, llaine wrote: void puts(string str) { writeln(str); } A D string isn't the same as a C string, so your params won't work as-is, and writeln requires the D runtime to be initialized. Does the ruby gem have a way to automatically call a

Re: C binding with D function

2016-08-03 Thread llaine via Digitalmars-d-learn
On Wednesday, 3 August 2016 at 13:49:36 UTC, bachmeier wrote: Probably because you need the D runtime. One way is to import core.runtime and call Runtime.initialize(). Where should I call this Runtime.initialize() ?

Re: [DIP] In-place struct initialization

2016-08-03 Thread Martin Tschierschke via Digitalmars-d
On Tuesday, 2 August 2016 at 16:02:21 UTC, Jacob Carlborg wrote: On 2016-07-30 23:42, cym13 wrote: In accordance to the new DIP process you can find the full presentation of the change here: https://github.com/dlang/DIPs/pull/22 I like it. I've already reported an enhancement request [1].

Re: Self Optimizing Code

2016-08-03 Thread Luis via Digitalmars-d
On Wednesday, 3 August 2016 at 07:36:21 UTC, ketmar wrote: hello, you just invented JIT compiler. This is not JIT.

Re: C binding with D function

2016-08-03 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 3 August 2016 at 13:44:46 UTC, llaine wrote: Hi guys, I'm trying to make a bridge between D and ruby with a gem called ffi. It's basically a loading/binding library that grab C function and make them callable from Ruby code. As you might already understand, i'm trying to

C binding with D function

2016-08-03 Thread llaine via Digitalmars-d-learn
Hi guys, I'm trying to make a bridge between D and ruby with a gem called ffi. It's basically a loading/binding library that grab C function and make them callable from Ruby code. As you might already understand, i'm trying to develop extensions using D and uses them in Ruby. I tried to

Re: [OT] Create more debt == earn more

2016-08-03 Thread jmh530 via Digitalmars-d
On Wednesday, 3 August 2016 at 07:35:28 UTC, deadalnix wrote: And how is this legal tender emitted ? With debt. Do you mean how money is created? The Fed and other major central banks use open market operations like repos or outright asset purchases to control the money supply. For

Building CTFE - On Youtube

2016-08-03 Thread Stefan Koch via Digitalmars-d
Hi, I decided to (semi-regularly) record the coding session I do on ctfe. I have now created a you-tube playlist with the most recent video in a acceptable quality. https://www.youtube.com/playlist?list=PL_Hatz-fH1CcCRHREbuV8EC3jgudTvwm_ Please tell me me what you think.

Re: [OT] Create more debt == earn more

2016-08-03 Thread Basile B. via Digitalmars-d
On Tuesday, 2 August 2016 at 11:44:17 UTC, qznc wrote: On Tuesday, 2 August 2016 at 08:07:38 UTC, Basile B. wrote: I was thinking about the value of what we do in the life, daily, the jobs, etc I've endend with this conclusion: The more you're able to create debt, the more you'll earn.

Re: Indexing with an arbitrary type

2016-08-03 Thread Alex via Digitalmars-d-learn
On Monday, 1 August 2016 at 16:09:50 UTC, Alex wrote: On Monday, 1 August 2016 at 15:51:58 UTC, Jonathan M Davis wrote: template isIndexable(I, T) { enum isIndexable = __traits(compiles, T.init[I.init]); } As a last question afterwards: Is it possible to create such an isIndexable

Re: [OT] Music to Program Compilers To

2016-08-03 Thread Chris via Digitalmars-d
On Wednesday, 3 August 2016 at 05:05:08 UTC, Kai Nacke wrote: On Tuesday, 2 August 2016 at 11:47:16 UTC, Chris wrote: On Tuesday, 2 August 2016 at 05:03:43 UTC, Kai Nacke wrote: On Saturday, 30 July 2016 at 03:41:10 UTC, Jack Stouffer wrote: On Friday, 29 July 2016 at 22:44:04 UTC, Walter

Re: q about bindings to C (noob)

2016-08-03 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-08-03 10:27, RomanZ wrote: version(RefOut) extern(C) void fun(out int input, ref in output); else extern(C) void fun( /*[out]*/ int* input, const(float)* output); version = RefOut; void main() { int input; float output; fun( input, output ); // work fine; is it

Re: std.experimental.xml available on DUB

2016-08-03 Thread Jacob Carlborg via Digitalmars-d-announce
On 2016-07-30 11:26, Lodovico Giaretta wrote: Hi, I'm proud to announce that std.experimental.xml v0.1.0 is available on DUB [1]! Another question. I see that there are a couple of different lexers available. Can those be exposed with the same interface/type instead of using different

Re: std.experimental.xml available on DUB

2016-08-03 Thread Jacob Carlborg via Digitalmars-d-announce
On 2016-08-03 09:20, Lodovico Giaretta wrote: On Tuesday, 2 August 2016 at 15:32:50 UTC, Jacob Carlborg wrote: * Does it work at CTFE? I don't think so. It would be cool if it did. I think it would at least be worth taking a couple of minutes and investigate if it does work or not. If

q about bindings to C (noob)

2016-08-03 Thread RomanZ via Digitalmars-d-learn
version(RefOut) extern(C) void fun(out int input, ref in output); else extern(C) void fun( /*[out]*/ int* input, const(float)* output); version = RefOut; void main() { int input; float output; fun( input, output ); // work fine; is it correct binding? or

Re: Passing refs with delegates

2016-08-03 Thread Ali Çehreli via Digitalmars-d-learn
On 08/02/2016 07:55 PM, Mark J Twain wrote: It's nice to be able to pass delegates and functions as callbacks. A nice feature is something like R foo(R,Args...)(R function(Args) callback, Args args) { return callback(args); } There are two problems with this. One is that type deduction

Re: D safety! New Feature?

2016-08-03 Thread qznc via Digitalmars-d
On Tuesday, 2 August 2016 at 21:48:58 UTC, Mark Twain wrote: global ImmutableArray!int Data; MutableArray!int DataCopy = Data.Copy; // Creates a mutable copy of Data. ... Do work with DataCopy ... Data.Replace(DataCopy); // Makes a copy of DataCopy. I see the problem that you cannot

Re: [OT] Create more debt == earn more

2016-08-03 Thread deadalnix via Digitalmars-d
On Tuesday, 2 August 2016 at 20:26:07 UTC, Rufus Smith wrote: Now the system has become cancerous. There is no natural way to escape it(it can't be avoided). There are plenty of way to escape it, you just don't want to be sleeping half naked on the ground in a forest with no toilet paper.

Re: [OT] Create more debt == earn more

2016-08-03 Thread deadalnix via Digitalmars-d
On Tuesday, 2 August 2016 at 19:51:04 UTC, jmh530 wrote: When I look on my money (US dollars) it says "This note is legal tender for all debts, public and private." This means that you can pay debts with it. It doesn't mean that it is a debt. And how is this legal tender emitted ? With

Re: Self Optimizing Code

2016-08-03 Thread ketmar via Digitalmars-d
hello, you just invented JIT compiler.

Re: std.experimental.xml available on DUB

2016-08-03 Thread Lodovico Giaretta via Digitalmars-d-announce
On Tuesday, 2 August 2016 at 15:32:50 UTC, Jacob Carlborg wrote: * Does it work at CTFE? I don't think so. * I see that it doesn't follow the D naming conventions You are talking about upper/lower cases in the names, right? I will correct them in the Phobos PR.

Re: [OT] Music to Program Compilers To

2016-08-03 Thread ketmar via Digitalmars-d
On Wednesday, 3 August 2016 at 05:01:40 UTC, Kai Nacke wrote: Dark Tranquillity is one of my preferred bands. :-) wow! ;-) Do you know Insomnium? They are awesome, too. yeah, found 'em not a long time ago, almost accidentally. great band too. still, i'm more technical death/power metal

Re: [OT] Create more debt == earn more

2016-08-03 Thread ketmar via Digitalmars-d
On Tuesday, 2 August 2016 at 20:25:15 UTC, dewitt wrote: "You have no reason to remember, but we came out of the White House not only dead broke, but in debt," -Hillary Clinton politican says. how dare i to think that politican can lie?!

Re: [OT] Create more debt == earn more

2016-08-03 Thread ketmar via Digitalmars-d
On Tuesday, 2 August 2016 at 21:01:13 UTC, jmh530 wrote: On Tuesday, 2 August 2016 at 20:26:07 UTC, Rufus Smith wrote: [snip] It is a beast of an organism and is a parasite on humanity. Luckily if it kills us off completely it will die too ;) Sigh... yep. he made a right conclusion, but