Re: Appending static arrays

2017-07-18 Thread Jack Applegame via Digitalmars-d-learn
On Monday, 17 July 2017 at 17:38:23 UTC, Nordlöw wrote: I'm want to define a specialization of `append()` that takes only static arrays as inputs and returns a static array being the sum of the lengths of the inputs. Have anybody already implemented this? If not, I'm specifically interested

How to init immutable static array?

2017-07-18 Thread Miguel L via Digitalmars-d-learn
Hi, I need help again. I have an immutable static array and i need to initialize its contents inside a for loop. Something like this: void f(int n)() { immutable float[n] my_array; for(int i=0;i

Re: How to init immutable static array?

2017-07-18 Thread Era Scarecrow via Digitalmars-d-learn
On Tuesday, 18 July 2017 at 07:20:48 UTC, Miguel L wrote: Hi, I need help again. I have an immutable static array and i need to initialize its contents inside a for loop. Something like this: void f(int n)() { immutable float[n] my_array; for(int i=0;i

Re: Idiomatic way of writing nested loops?

2017-07-18 Thread Anton Fediushin via Digitalmars-d-learn
On Tuesday, 18 July 2017 at 03:36:04 UTC, Nicholas Wilson wrote: With regards to parallel, only use it on the outermost loop. Assuming you have more items in the outermost loop than you do threads parallelising more than one loop won't net you any speed. Thank you! Yes, `parallel` runs only

Re: proposed @noreturn attribute

2017-07-18 Thread Olivier FAURE via Digitalmars-d
On Monday, 17 July 2017 at 18:10:27 UTC, Andrei Alexandrescu wrote: On 7/17/17 11:39 AM, Olivier FAURE wrote: I'd really prefer if you avoided the whole `typeof(assert(0))` thing. First off, it's way too verbose for a simple concept. Noted, thanks. I won't debate this much but for now I

Re: New library: open multi-methods

2017-07-18 Thread Jean-Louis Leroy via Digitalmars-d-announce
On Tuesday, 18 July 2017 at 07:06:10 UTC, Jean-Louis Leroy wrote: As for performance, I have a first result: https://github.com/jll63/methods.d/blob/master/benchmarks/source/benchmarks.d#L122 but I still have to implement the "first argument optimization". I am working on it. Now this is

Re: New library: open multi-methods

2017-07-18 Thread Jean-Louis Leroy via Digitalmars-d-announce
On Tuesday, 18 July 2017 at 04:26:42 UTC, Ali Çehreli wrote: On 07/16/2017 10:24 AM, Jean-Louis Leroy wrote: > TL;DR: see here https://github.com/jll63/methods.d/blob/master/README.md Woot! :) I'm so happy to see this project complete. Honestly, growing up with languages without this feature

Re: How to init immutable static array?

2017-07-18 Thread Era Scarecrow via Digitalmars-d-learn
On Tuesday, 18 July 2017 at 07:30:30 UTC, Era Scarecrow wrote: my_array[i]=some calculations(based on constants and n) i meant: tmp[i]=some calculations(based on constants and n)

Re: regex(q"<[^]>")

2017-07-18 Thread Anton Fediushin via Digitalmars-d
On Monday, 17 July 2017 at 17:00:10 UTC, unDEFER wrote: Hello! The code in the header leads to assertion! But the user inputed data don't must leads to any assertions! This regular expression is invalid. [bar] - Matches 'b' or 'a' or 'r' [^bar] - Matches everything but 'b' or 'a' or 'r'. So,

Re: How to init immutable static array?

2017-07-18 Thread Miguel L via Digitalmars-d-learn
On Tuesday, 18 July 2017 at 07:31:22 UTC, Era Scarecrow wrote: On Tuesday, 18 July 2017 at 07:30:30 UTC, Era Scarecrow wrote: my_array[i]=some calculations(based on constants and n) i meant: tmp[i]=some calculations(based on constants and n) That does work, thanks.

Re: Appending static arrays

2017-07-18 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-07-17 22:11, Nordlöw wrote: - under what name: append, concat or cat? append - add array or element to existing array concat (concatenate) - add to arrays (or element) together to create a new array Seems like this is a concatenation. But please avoid shortening the names. I vote

Re: Compilation times and idiomatic D code

2017-07-18 Thread Olivier FAURE via Digitalmars-d
On Monday, 17 July 2017 at 18:42:36 UTC, H. S. Teoh wrote: Besides the symbol problem though, does the template instantiation explosion problem imply as many duplicated function bodies corresponding to the new type symbols? That's a different, though somewhat related, issue. I have some

Re: static foreach is now in github master

2017-07-18 Thread Daniel N via Digitalmars-d-announce
On Tuesday, 18 July 2017 at 06:48:29 UTC, Jacob Carlborg wrote: On 2017-07-17 20:14, Andrei Alexandrescu wrote: For those who want to play with our new static foreach feature and are willing to take the steps to building their own dmd, the feature is now merged in master:

Re: DIP 1010--Static foreach--Accepted

2017-07-18 Thread Jacob Carlborg via Digitalmars-d-announce
On 2017-07-17 14:39, Steven Schveighoffer wrote: Awesome! Super glad and looking forward to this in 2.076? ;) It's already merged [1] so..., why not :) [1] http://forum.dlang.org/post/okiuqb$1eti$1...@digitalmars.com -- /Jacob Carlborg

Re: New library: open multi-methods

2017-07-18 Thread Jean-Louis Leroy via Digitalmars-d-announce
On Tuesday, 18 July 2017 at 02:22:15 UTC, Jay Norwood wrote: An excerpt statement from this wiki page is : " dynamically dispatched based on the run-time (dynamic) type or, in the more general case some other attribute, of more than one of its arguments" Based on the 'some other

Re: static foreach is now in github master

2017-07-18 Thread Jacob Carlborg via Digitalmars-d-announce
On 2017-07-17 20:14, Andrei Alexandrescu wrote: For those who want to play with our new static foreach feature and are willing to take the steps to building their own dmd, the feature is now merged in master: https://github.com/dlang/dmd/pull/6760 Happy hacking! That was quick, and awesome

Re: DCompute: GPGPU with Native D for OpenCL and CUDA

2017-07-18 Thread Nicholas Wilson via Digitalmars-d-announce
On Tuesday, 18 July 2017 at 09:48:47 UTC, John Colvin wrote: On Tuesday, 18 July 2017 at 00:49:11 UTC, Nicholas Wilson wrote: Oh and @JohnColvin do you like the solution for the lambdas? I do, very nice :) You're essentially achieving what I set out to do and got stuck with, just much

Re: DMD library available as DUB package

2017-07-18 Thread Dukc via Digitalmars-d-announce
On Tuesday, 18 July 2017 at 12:35:10 UTC, Suliman wrote: Could you explain where it can be helpful? For tools, such as source code formatters. They do not have to write the parsers themselves if they use a library such as this one.

[Issue 5254] Low performance code with struct constructor

2017-07-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=5254 Vladimir Panteleev changed: What|Removed |Added Hardware|x86 |All

Re: Get complete function declaration

2017-07-18 Thread Ivan Kazmenko via Digitalmars-d-learn
On Tuesday, 18 July 2017 at 13:35:49 UTC, SrMordred wrote: There is a way to get the full function(or any other structure) declaration with traits? Or I will have to mount it with std.traits functions? eg. void add(int x, int y){} GetFullFunctionDeclaration!add; //return "void add(int x, int

Re: DMD library available as DUB package

2017-07-18 Thread Meta via Digitalmars-d-announce
On Tuesday, 18 July 2017 at 12:07:27 UTC, Jacob Carlborg wrote: During the dconf hackathon I set out to create a DUB package for DMD to be used as a library. This has finally been merged [1] and is available here [2]. It contains the lexer and the parser. A minimal example: #!/usr/bin/env

Re: Get complete function declaration

2017-07-18 Thread SrMordred via Digitalmars-d-learn
On Tuesday, 18 July 2017 at 13:53:11 UTC, Ivan Kazmenko wrote: On Tuesday, 18 July 2017 at 13:35:49 UTC, SrMordred wrote: There is a way to get the full function(or any other structure) declaration with traits? Or I will have to mount it with std.traits functions? eg. void add(int x, int

Re: DMD library available as DUB package

2017-07-18 Thread Jacob Carlborg via Digitalmars-d-announce
On 2017-07-18 14:35, Suliman wrote: Could you explain where it can be helpful? As Dukc said, for tools that need to analyze D source code. -- /Jacob Carlborg

Get complete function declaration

2017-07-18 Thread SrMordred via Digitalmars-d-learn
There is a way to get the full function(or any other structure) declaration with traits? Or I will have to mount it with std.traits functions? eg. void add(int x, int y){} GetFullFunctionDeclaration!add; //return "void add(int x, int y)"

[Issue 7720] asm silent wrong code generation

2017-07-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=7720 Vladimir Panteleev changed: What|Removed |Added Status|NEW

[Issue 13938] IASM shouldn't be able to access TLS variables

2017-07-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13938 Vladimir Panteleev changed: What|Removed |Added CC|

Can't get expected strings

2017-07-18 Thread helxi via Digitalmars-d-learn
import std.stdio, std.datetime, std.conv, std.algorithm; void main() { immutable DEADLINE = DateTime(2017, 7, 16, 23, 59, 59).to!SysTime; immutable NOW = Clock.currTime; immutable INTERVAL = (DEADLINE - NOW) .abs .to!string;

[Issue 17604] Reject mutable fields initialized with reference types to data segment

2017-07-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17604 Vladimir Panteleev changed: What|Removed |Added See Also|

[Issue 13646] static darray & pointer initializers always allocated in shared(global) memory rather than in TLS

2017-07-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13646 Vladimir Panteleev changed: What|Removed |Added See Also|

[Issue 9641] Wrong module init order when a thread is created in a module ctor

2017-07-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=9641 --- Comment #2 from Vladimir Panteleev --- (In reply to Martin Nowak from comment #1) > I think the fix would need a mutex which blocks all created threads until > all shared module constructors are finished. This

[Issue 697] No const folding on asm db,dw, etc

2017-07-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=697 Vladimir Panteleev changed: What|Removed |Added Status|REOPENED

[Issue 13039] combinations

2017-07-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13039 Vladimir Panteleev changed: What|Removed |Added Keywords|

[Issue 12389] Operating system C functions should be marked as 'nothrow'

2017-07-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12389 Vladimir Panteleev changed: What|Removed |Added Status|NEW

Re: static foreach is now in github master

2017-07-18 Thread Vladimir Panteleev via Digitalmars-d-announce
On Tuesday, 18 July 2017 at 10:02:10 UTC, Seb wrote: And thanks to dmd-nightly, also on run.dlang.io:

How do I cast to from byte[] <-> double for making a small assembler language VM to work?

2017-07-18 Thread Enjoys Math via Digitalmars-d-learn
class OpCode { private: byte[] bytes_; public: void opCall(Program program) const; byte[] bytes() const { return bytes_.dup; } } class AddD : OpCode { private: uint d, s; public: this(uint dst, uint src) { d =

Re: static foreach is now in github master

2017-07-18 Thread Seb via Digitalmars-d-announce
On Monday, 17 July 2017 at 21:27:40 UTC, Martin Nowak wrote: On Monday, 17 July 2017 at 18:14:35 UTC, Andrei Alexandrescu wrote: For those who want to play with our new static foreach feature and are willing to take the steps to building their own dmd, Or just wait for the next nightly until

Re: proposed @noreturn attribute

2017-07-18 Thread John Colvin via Digitalmars-d
On Monday, 17 July 2017 at 23:01:40 UTC, Walter Bright wrote: On 7/16/2017 5:41 AM, Timon Gehr wrote: struct S{ T x; Bottom everything; } turns the entire struct into an empty type. It is therefore most natural to say that Bottom.sizeof == ∞. (It's the only choice for which S.sizeof

Re: proposed @noreturn attribute

2017-07-18 Thread Stefan Koch via Digitalmars-d
On Tuesday, 18 July 2017 at 10:17:17 UTC, John Colvin wrote: how do I store the type "int" in memory? new Type(TYENUM.Tint32); :o)

Re: DCompute: GPGPU with Native D for OpenCL and CUDA

2017-07-18 Thread John Colvin via Digitalmars-d-announce
On Tuesday, 18 July 2017 at 00:49:11 UTC, Nicholas Wilson wrote: On Monday, 17 July 2017 at 13:50:22 UTC, Mike Parker wrote: Nicholas Wilson has put together a blog post on his progress with DCompute, expanding on his DConf talk. I have to admit that this is one of the D projects I'm most

Re: An Issue I Wish To Raise Awareness On

2017-07-18 Thread via Digitalmars-d
On Monday, 17 July 2017 at 19:30:53 UTC, Jack Stouffer wrote: On Monday, 17 July 2017 at 17:41:58 UTC, Atila Neves wrote: On Monday, 17 July 2017 at 14:26:19 UTC, Jack Stouffer wrote: TL;DR: Issue 17658 [1] makes using shared very annoying/practically impossible. [...] I fixed this

Re: Appending static arrays

2017-07-18 Thread Stefan Koch via Digitalmars-d-learn
On Tuesday, 18 July 2017 at 08:46:50 UTC, Jack Applegame wrote: On Monday, 17 July 2017 at 17:38:23 UTC, Nordlöw wrote: I'm want to define a specialization of `append()` that takes only static arrays as inputs and returns a static array being the sum of the lengths of the inputs. Have

Re: DMD library available as DUB package

2017-07-18 Thread Suliman via Digitalmars-d-announce
Could you explain where it can be helpful?

[Issue 11500] Bringing mixed-in operators and constructors to the overload set

2017-07-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=11500 Vladimir Panteleev changed: What|Removed |Added Keywords|

[Issue 15297] std.stdio readf cryptic error message

2017-07-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15297 Vladimir Panteleev changed: What|Removed |Added Status|NEW

[Issue 9991] Optimizer Doesn't Enregister Static Array Elements With Compile-Time Constant Index

2017-07-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=9991 --- Comment #5 from Vladimir Panteleev --- FWIW, after https://github.com/dlang/dmd/pull/6176 (2.073.0) the generated assembly code changed, however a simple benchmark shows that performance did not noticeably

[Issue 12930] static and the access modifiers aren't legal on the right-hand side of a function

2017-07-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12930 Vladimir Panteleev changed: What|Removed |Added Keywords||spec

DMD library available as DUB package

2017-07-18 Thread Jacob Carlborg via Digitalmars-d-announce
During the dconf hackathon I set out to create a DUB package for DMD to be used as a library. This has finally been merged [1] and is available here [2]. It contains the lexer and the parser. A minimal example: #!/usr/bin/env dub /++ dub.sdl: name "dmd_lexer_example" dependency "dmd"

Re: How do I cast to from byte[] <-> double for making a small assembler language VM to work?

2017-07-18 Thread Stefan Koch via Digitalmars-d-learn
On Tuesday, 18 July 2017 at 11:06:22 UTC, Enjoys Math wrote: [ ... ] The cast at the bottom gives a compiler error (can't cast byte[] to double). If you want to see how it's done check: https://github.com/UplinkCoder/dmd/blob/newCTFE_on_master/src/ddmd/ctfe/bc.d Though if you have the choice

Re: Appending static arrays

2017-07-18 Thread Nordlöw via Digitalmars-d-learn
On Tuesday, 18 July 2017 at 08:07:45 UTC, Jacob Carlborg wrote: append - add array or element to existing array concat (concatenate) - add to arrays (or element) together to create a new array Seems like this is a concatenation. But please avoid shortening the names. I vote you go with

Re: proposed @noreturn attribute

2017-07-18 Thread Stefan Koch via Digitalmars-d
On Tuesday, 18 July 2017 at 12:15:06 UTC, Timon Gehr wrote: On 18.07.2017 12:17, John Colvin wrote: Better to just not define it. That's not an option. Bottom is a subtype of all types. It cannot remove members, even static ones. Timon, how important is it to actually have bottom ? ...

Re: proposed @noreturn attribute

2017-07-18 Thread Timon Gehr via Digitalmars-d
On 18.07.2017 12:17, John Colvin wrote: Better to just not define it. That's not an option. Bottom is a subtype of all types. It cannot remove members, even static ones.

[Issue 16512] std.allocator: Nullify the argument passed to allocator.dispose

2017-07-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16512 Vladimir Panteleev changed: What|Removed |Added Component|dmd

[Issue 17224] Foreach documentation still refers to TypeTuples, rather than AliasSequences

2017-07-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17224 --- Comment #4 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/c336bb96cf8a0a1b4be57c25d6ef59e3ef781b54 Issue 17224 - Remove std.typetuple from the

Re: An Issue I Wish To Raise Awareness On

2017-07-18 Thread via Digitalmars-d
On Tuesday, 18 July 2017 at 11:47:37 UTC, Petar Kirov [ZombineDev] wrote: On Monday, 17 July 2017 at 19:30:53 UTC, Jack Stouffer wrote: On Monday, 17 July 2017 at 17:41:58 UTC, Atila Neves wrote: On Monday, 17 July 2017 at 14:26:19 UTC, Jack Stouffer wrote: TL;DR: Issue 17658 [1] makes using

Re: How do I cast to from byte[] <-> double for making a small assembler language VM to work?

2017-07-18 Thread Stefan Koch via Digitalmars-d-learn
On Tuesday, 18 July 2017 at 11:06:22 UTC, Enjoys Math wrote: class OpCode { private: byte[] bytes_; public: void opCall(Program program) const; byte[] bytes() const { return bytes_.dup; } } class AddD : OpCode { private: uint d, s;

[Issue 8204] Alias causes error: "auto can only be used for template function parameters"

2017-07-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=8204 --- Comment #2 from Vladimir Panteleev --- (In reply to dlang+issues from comment #0) > void foo(T)(ref auto T v) { } > alias foo!int bar; // Error: auto can only be used for template function > parameters What is

[Issue 12260] Improve error of std.stdio.readf when involving whitespace

2017-07-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12260 Vladimir Panteleev changed: What|Removed |Added CC|

[Issue 13584] "not callable using argument types" despite perfect match

2017-07-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13584 Vladimir Panteleev changed: What|Removed |Added Status|NEW

Re: Idiomatic way of writing nested loops?

2017-07-18 Thread Russel Winder via Digitalmars-d-learn
On Tue, 2017-07-18 at 08:41 +, Anton Fediushin via Digitalmars-d-learn wrote: > On Tuesday, 18 July 2017 at 03:36:04 UTC, Nicholas Wilson wrote: > > With regards to parallel, only use it on the outermost loop. > > Assuming you have more items in the outermost loop than you do > > threads

Re: Slides share: DMesos - Not only a re-implementation of Mesos

2017-07-18 Thread 鲜卑拓跋枫 via Digitalmars-d
On Sunday, 16 July 2017 at 03:45:09 UTC, Dsby wrote: On Saturday, 15 July 2017 at 15:57:18 UTC, 鲜卑拓跋枫 wrote: On Friday, 14 July 2017 at 05:07:11 UTC, Dsby wrote: On Monday, 10 July 2017 at 17:29:01 UTC, 鲜卑拓跋枫 wrote: [...] 我也希望能用D做出来。 我们也在研究过raft, akka这些技术。

Re: An Issue I Wish To Raise Awareness On

2017-07-18 Thread Kagamin via Digitalmars-d
On Tuesday, 18 July 2017 at 11:47:37 UTC, Petar Kirov [ZombineDev] wrote: I think Atila was talking about this one: struct A { ~this() {} } void main() { auto a = A(); shared b = A(); } This is strange. There's nothing that suggests that struct A and its destructor is

Re: replacement for squeeze and removechars.

2017-07-18 Thread Seb via Digitalmars-d-learn
On Tuesday, 18 July 2017 at 15:28:06 UTC, Antonio Corbi wrote: Hi all, I'm trying dmd-2.075.0-rc1 in one of my projects where I use `squeeze` and `removechars`. Both of them are flagged as obsolete and in the docs we are suggested to use functions from std.regex and/or std.algorithm. Does

Re: Idiomatic way of writing nested loops?

2017-07-18 Thread Russel Winder via Digitalmars-d-learn
On Tue, 2017-07-18 at 03:36 +, Nicholas Wilson via Digitalmars-d-learn wrote: > On Monday, 17 July 2017 at 11:07:35 UTC, Anton Fediushin wrote: > > […] > > > > Also, I have a question about running this in parallel: if I > > want to use nested loops with `parallel` from > >

replacement for squeeze and removechars.

2017-07-18 Thread Antonio Corbi via Digitalmars-d-learn
Hi all, I'm trying dmd-2.075.0-rc1 in one of my projects where I use `squeeze` and `removechars`. Both of them are flagged as obsolete and in the docs we are suggested to use functions from std.regex and/or std.algorithm. Does any one kow a one-liner from std.regex or std.algorithm that

Re: proposed @noreturn attribute

2017-07-18 Thread Timon Gehr via Digitalmars-d
On 18.07.2017 14:19, Stefan Koch wrote: On Tuesday, 18 July 2017 at 12:15:06 UTC, Timon Gehr wrote: On 18.07.2017 12:17, John Colvin wrote: Better to just not define it. That's not an option. Bottom is a subtype of all types. It cannot remove members, even static ones. Timon, how

Re: An Issue I Wish To Raise Awareness On

2017-07-18 Thread Atila Neves via Digitalmars-d
On Tuesday, 18 July 2017 at 11:47:37 UTC, Petar Kirov [ZombineDev] wrote: On Monday, 17 July 2017 at 19:30:53 UTC, Jack Stouffer wrote: [...] I think Atila was talking about this one: struct A { ~this() {} } void main() { auto a = A(); shared b = A(); }

Re: New library: open multi-methods

2017-07-18 Thread Ali Çehreli via Digitalmars-d-announce
On 07/18/2017 12:06 AM, Jean-Louis Leroy wrote: > Yes I will probably write something. You mean on the D Blog? Not necessarily but why not. :) > As for performance, I have a first result: > https://github.com/jll63/methods.d/blob/master/benchmarks/source/benchmarks.d#L122 > but I still have

Re: replacement for squeeze and removechars.

2017-07-18 Thread Meta via Digitalmars-d-learn
On Tuesday, 18 July 2017 at 15:28:06 UTC, Antonio Corbi wrote: Hi all, I'm trying dmd-2.075.0-rc1 in one of my projects where I use `squeeze` and `removechars`. Both of them are flagged as obsolete and in the docs we are suggested to use functions from std.regex and/or std.algorithm. Does

Re: replacement for squeeze and removechars.

2017-07-18 Thread Antonio Corbi via Digitalmars-d-learn
On Tuesday, 18 July 2017 at 15:55:00 UTC, Seb wrote: On Tuesday, 18 July 2017 at 15:41:44 UTC, Meta wrote: As Seb somewhat undiplomatically put, there are replacements listed in the changelog. Sorry - it wasn't intended to be an offense or aggressive. I consider(ed) RTFM as common internet

Re: How do I cast to from byte[] <-> double for making a small assembler language VM to work?

2017-07-18 Thread H. S. Teoh via Digitalmars-d-learn
Maybe use a union? union U { double d; byte[double.sizeof] bytes; } U u; u.bytes = ...; double d = u.d; ... // do something with d // or: U u; u.d = 3.14159; byte[] b = u.bytes[];

Re: regex(q"<[^]>")

2017-07-18 Thread unDEFER via Digitalmars-d
On Tuesday, 18 July 2017 at 08:56:12 UTC, Anton Fediushin wrote: Not a bug, but I think that `regex()` should fail with a nice exception, not silently fail. Yes, exception, not assert.

Re: Can't get expected strings

2017-07-18 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, July 18, 2017 13:49:11 helxi via Digitalmars-d-learn wrote: > import std.stdio, std.datetime, std.conv, std.algorithm; > > void main() > { > immutable DEADLINE = DateTime(2017, 7, 16, 23, 59, > 59).to!SysTime; > immutable NOW = Clock.currTime; > immutable INTERVAL =

Re: static foreach is now in github master

2017-07-18 Thread Seb via Digitalmars-d-announce
On Tuesday, 18 July 2017 at 10:06:33 UTC, Vladimir Panteleev wrote: On Tuesday, 18 July 2017 at 10:02:10 UTC, Seb wrote: And thanks to dmd-nightly, also on run.dlang.io:

Re: replacement for squeeze and removechars.

2017-07-18 Thread Antonio Corbi via Digitalmars-d-learn
On Tuesday, 18 July 2017 at 15:41:44 UTC, Meta wrote: On Tuesday, 18 July 2017 at 15:28:06 UTC, Antonio Corbi wrote: Hi all, I'm trying dmd-2.075.0-rc1 in one of my projects where I use `squeeze` and `removechars`. Both of them are flagged as obsolete and in the docs we are suggested to use

Re: replacement for squeeze and removechars.

2017-07-18 Thread Seb via Digitalmars-d-learn
On Tuesday, 18 July 2017 at 15:41:44 UTC, Meta wrote: As Seb somewhat undiplomatically put, there are replacements listed in the changelog. Sorry - it wasn't intended to be an offense or aggressive. I consider(ed) RTFM as common internet slang.

Re: replacement for squeeze and removechars.

2017-07-18 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, July 18, 2017 15:55:00 Seb via Digitalmars-d-learn wrote: > On Tuesday, 18 July 2017 at 15:41:44 UTC, Meta wrote: > > As Seb somewhat undiplomatically put, there are replacements > > listed in the changelog. > > Sorry - it wasn't intended to be an offense or aggressive. I >

Re: regex(q"<[^]>")

2017-07-18 Thread Temtaime via Digitalmars-d
On Tuesday, 18 July 2017 at 16:34:39 UTC, unDEFER wrote: On Tuesday, 18 July 2017 at 08:56:12 UTC, Anton Fediushin wrote: Not a bug, but I think that `regex()` should fail with a nice exception, not silently fail. Yes, exception, not assert. The forum is not a bugtracker

Re: How do I cast to from byte[] <-> double for making a small assembler language VM to work?

2017-07-18 Thread Enjoys Math via Digitalmars-d-learn
Thanks for the replies. I will look at 3-address opcodes and consider unions. *Wonders if it matters that Program is a struct with opSlice / opSliceAssign overloaded*.

[Issue 16160] selective imports in aggregation shadow @property functions

2017-07-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16160 feklushkin.de...@gmail.com changed: What|Removed |Added CC||feklushkin.de...@gmail.com --

[Issue 16412] instance variable shadowing with inheritance

2017-07-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16412 feklushkin.de...@gmail.com changed: What|Removed |Added CC||feklushkin.de...@gmail.com --

Is it possible to generate a pool of random D or D inline assembler programs, run them safely?

2017-07-18 Thread Enjoys Math via Digitalmars-d-learn
Without them crashing the app running them? Say by wrapping with try / catch? You can assume that I've limited the opcode addresses to the program and/or the data section which I'll try to put right next to the code. Reason is so I don't have to make my own VM. I want to mutate computable

Re: An Issue I Wish To Raise Awareness On

2017-07-18 Thread Jonathan M Davis via Digitalmars-d
On Tuesday, July 18, 2017 18:06:56 Atila Neves via Digitalmars-d wrote: > On Tuesday, 18 July 2017 at 15:03:07 UTC, Kagamin wrote: > > On Tuesday, 18 July 2017 at 11:47:37 UTC, Petar Kirov > > > > [ZombineDev] wrote: > >> I think Atila was talking about this one: > >> struct A > >> { > >> > >>

Re: New library: open multi-methods

2017-07-18 Thread jmh530 via Digitalmars-d-announce
On Tuesday, 18 July 2017 at 16:57:30 UTC, Ali Çehreli wrote: Perhaps they are all needed but I'm thinking about the need for forward declaration, the need for the underscore prefix, etc. He might be able to at least get rid of the forward declaration (not sure on the underscore). The

Re: newCTFE Status July 2017

2017-07-18 Thread Stefan Koch via Digitalmars-d
On Tuesday, 18 July 2017 at 19:11:37 UTC, H. S. Teoh wrote: Shouldn't there be a way to reduce the test case so that you don't have to look through 300 temporaries? Yes. However, there is not automated way to reduce it. So to find the source-code which actually leads to the mis-compiled

Re: proposed @noreturn attribute

2017-07-18 Thread Atila Neves via Digitalmars-d
On Monday, 17 July 2017 at 18:54:37 UTC, H. S. Teoh wrote: On Mon, Jul 17, 2017 at 02:10:27PM -0400, Andrei Alexandrescu via Digitalmars-d wrote: [...] [...] IMO, the observations "used rarely" and "attention-seeking notation" are better satisfied by an attribute named @noreturn than some

Re: static foreach is now in github master

2017-07-18 Thread Martin Tschierschke via Digitalmars-d-announce
On Tuesday, 18 July 2017 at 10:02:10 UTC, Seb wrote: On Monday, 17 July 2017 at 21:27:40 UTC, Martin Nowak wrote: On Monday, 17 July 2017 at 18:14:35 UTC, Andrei Alexandrescu wrote: For those who want to play with our new static foreach feature and are willing to take the steps to building

[Issue 697] No const folding on asm db,dw, etc

2017-07-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=697 --- Comment #7 from Stewart Gordon --- (In reply to Vladimir Panteleev from comment #6) > The original test case as presented in the issue description now works, as > per comment 3, so I'm going to close this. > > (In reply to Don

Re: Mixin function names

2017-07-18 Thread Moinak Bhattacharrya via Digitalmars-d
On Tuesday, 18 July 2017 at 20:57:51 UTC, Moinak Bhattacharrya wrote: Is it possible to mixin function names? IE something like this: template strFunc(string s){ int mixin(s)(int a){ return a+1; } } If not, is something like this being looked at? Or, just

Re: New library: open multi-methods

2017-07-18 Thread jmh530 via Digitalmars-d-announce
On Tuesday, 18 July 2017 at 19:22:38 UTC, Jean-Louis Leroy wrote: Look at https://github.com/jll63/methods.d/blob/master/examples/matrix/source/matrix.d and https://github.com/jll63/methods.d/blob/master/examples/matrix/source/densematrix.d They know nothing about printing. They don't want to.

Re: Mixin function names

2017-07-18 Thread Adam D. Ruppe via Digitalmars-d
On Tuesday, 18 July 2017 at 20:57:51 UTC, Moinak Bhattacharrya wrote: Is it possible to mixin function names? IE something like this: Only if you mixin the entire function. But what I like to do is to write the function with some internal name, then do `mixin("alias "~ new_name ~ " =

Re: New library: open multi-methods

2017-07-18 Thread Ali Çehreli via Digitalmars-d-announce
On 07/18/2017 11:03 AM, jmh530 wrote: > the mixin(registerMethods); could then be adjusted so that void > print(virtual!Matrix m); is mixed in automatically because we now know > how to construct it. That reminds me: Would the following be possible and better? // From void main() {

Re: newCTFE Status July 2017

2017-07-18 Thread Stefan Koch via Digitalmars-d
On Thursday, 13 July 2017 at 12:45:19 UTC, Stefan Koch wrote: [ ... ] Hi Guys, I have good news and bad news. The good news: newCTFE just compiled my own version of std.bitmanip.bitfields dubbed fastFields. which can be seen here:

Adding flags to dub build

2017-07-18 Thread Jean-Louis Leroy via Digitalmars-d-learn
Hi, I want to add a few flags while building with dub. I tried: DFLAGS='-d-version=explain' dub test ... ...but DFLAGS does not seem to be honored. In fact I wouldn't mind adding a builtType to my dub.sdl (but then will it be inherited by the subpackages) but I don't see how to specify

Re: New library: open multi-methods

2017-07-18 Thread Ali Çehreli via Digitalmars-d-announce
On 07/18/2017 12:22 PM, Jean-Louis Leroy wrote: > Look at > https://github.com/jll63/methods.d/blob/master/examples/matrix/source/matrix.d > and > https://github.com/jll63/methods.d/blob/master/examples/matrix/source/densematrix.d > They know nothing about printing. They don't want to. The

Re: Adding flags to dub build

2017-07-18 Thread Jean-Louis Leroy via Digitalmars-d-learn
On Tuesday, 18 July 2017 at 20:12:13 UTC, Jean-Louis Leroy wrote: On Tuesday, 18 July 2017 at 20:00:48 UTC, Guillaume Piolat wrote: On Tuesday, 18 July 2017 at 19:49:35 UTC, Jean-Louis Leroy wrote: Hi, I want to add a few flags while building with dub. I tried:

Re: Building DMD on OpenBSD

2017-07-18 Thread Anonymous via Digitalmars-d
On Tuesday, 18 July 2017 at 05:11:30 UTC, Kai Nacke wrote: In master there is already some OpenBSD support. Some time ago I worked on druntime support but I still need to finish this. Mostly there is nothing magic here - just translating the header files. The only non-obvious work is required

[Issue 17663] New: header generation (-H) is broken with public override of private default

2017-07-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17663 Issue ID: 17663 Summary: header generation (-H) is broken with public override of private default Product: D Version: D2 Hardware: All URL: http://dlang.org/

Re: New library: open multi-methods

2017-07-18 Thread Jean-Louis Leroy via Digitalmars-d-announce
On Tuesday, 18 July 2017 at 18:03:30 UTC, jmh530 wrote: On Tuesday, 18 July 2017 at 16:57:30 UTC, Ali Çehreli wrote: Perhaps they are all needed but I'm thinking about the need for forward declaration, the need for the underscore prefix, etc. He might be able to at least get rid of the

Re: An Issue I Wish To Raise Awareness On

2017-07-18 Thread Atila Neves via Digitalmars-d
On Monday, 17 July 2017 at 19:30:53 UTC, Jack Stouffer wrote: On Monday, 17 July 2017 at 17:41:58 UTC, Atila Neves wrote: On Monday, 17 July 2017 at 14:26:19 UTC, Jack Stouffer wrote: TL;DR: Issue 17658 [1] makes using shared very annoying/practically impossible. [...] I fixed this

Re: New library: open multi-methods

2017-07-18 Thread Jean-Louis Leroy via Digitalmars-d-announce
On Tuesday, 18 July 2017 at 16:57:30 UTC, Ali Çehreli wrote: > As for performance, I have a first result: > https://github.com/jll63/methods.d/blob/master/benchmarks/source/benchmarks.d#L122 > but I still have to implement the "first argument optimization". I am > working on it. I could use

  1   2   >