Re: DIP10005: Dependency-Carrying Declarations is now available for community feedback

2016-12-13 Thread Jacob Carlborg via Digitalmars-d
On 2016-12-14 03:23, Andrei Alexandrescu wrote: On 12/13/16 9:22 PM, Hatem Oraby wrote: with(import std.range) bool equal(R1, R2) if (isInputRange!R1 && isInputRange!R2) { ... } I considered this, then figured with is superfluous. -- Andrei It could allow to have a better control of the

Question about compile-time functions.

2016-12-13 Thread Bauss via Digitalmars-d-learn
If a function is only called during compile-time will it be available at runtime?

Re: Bug in exception chaining results in exceptions escaping

2016-12-13 Thread Walter Bright via Digitalmars-d
On 12/13/2016 4:14 PM, Yuxuan Shui wrote: Bug is fixed in https://github.com/dlang/druntime/pull/1712, please review. My favorite kind of bug report is one that comes with a fix! Thanks! But please also file the bug report in bugzilla, that makes it much easier for us to track and document

Re: CTFE-PGO ... Because I was bored

2016-12-13 Thread Era Scarecrow via Digitalmars-d
On Wednesday, 14 December 2016 at 05:07:17 UTC, Stefan Koch wrote: I have just written a little piece of code that counts which switch-cases are executed most frequently versus how often their conditions are evaluated. This can essentially be the basis for pgo based on the ctfe-function

Re: CTFE-PGO ... Because I was bored

2016-12-13 Thread Stefan Koch via Digitalmars-d
On Wednesday, 14 December 2016 at 05:07:17 UTC, Stefan Koch wrote: Hi Guys, Implementing and TESTING function-call support is boring so ... I have just written a little piece of code that counts which switch-cases are executed most frequently versus how often their conditions are evaluated.

CTFE-PGO ... Because I was bored

2016-12-13 Thread Stefan Koch via Digitalmars-d
Hi Guys, Implementing and TESTING function-call support is boring so ... I have just written a little piece of code that counts which switch-cases are executed most frequently versus how often their conditions are evaluated. This can essentially be the basis for pgo based on the

Re: DIP10005: Dependency-Carrying Declarations is now available for community feedback

2016-12-13 Thread Suliman via Digitalmars-d
On Tuesday, 13 December 2016 at 22:33:24 UTC, Andrei Alexandrescu wrote: Destroy. https://github.com/dlang/DIPs/pull/51/files Imho such syntaxis construction make language harder to learn. D is already pretty complex, but DIPs should simplify language, but do not make its harder

Re: All function attributes possible with "@"?

2016-12-13 Thread Jonathan M Davis via Digitalmars-d
On Tuesday, 13 December 2016 at 22:40:47 UTC, 01010100b wrote: So why not let all function attributes which are keywords also be allowed to be used with a "@" prefixed? Because it just creates yet another way to make one person's code look drastically different from another with no real gain?

Re: DIP10005: Dependency-Carrying Declarations is now available for community feedback

2016-12-13 Thread Jon Degenhardt via Digitalmars-d
On Wednesday, 14 December 2016 at 01:39:01 UTC, Andrei Alexandrescu wrote: I prefer the current form of the proposal: bool equal(R1, R2) import (std.range) if (isInputRange!R1 && isInputRange!R2) { ... } I didn't see an example of the syntax when multiple imports are involved (apologies if I

Re: Making AssertError a singleton

2016-12-13 Thread Jonathan M Davis via Digitalmars-d
On Tuesday, 13 December 2016 at 22:47:55 UTC, Andrei Alexandrescu wrote: On 12/13/2016 05:05 PM, Jonathan M Davis wrote: Recall that all AssertError instances are equivalent up to file and line. They also have a message. AssertErrors aren't any more the same as each other than any other

Re: DIP10005: Dependency-Carrying Declarations is now available for community feedback

2016-12-13 Thread Chris M. via Digitalmars-d
On Wednesday, 14 December 2016 at 02:23:07 UTC, Andrei Alexandrescu wrote: On 12/13/16 8:53 PM, Chris M. wrote: On Wednesday, 14 December 2016 at 01:39:01 UTC, Andrei Alexandrescu wrote: I prefer the current form of the proposal: bool equal(R1, R2) import (std.range) if (isInputRange!R1 &&

Re: DIP10005: Dependency-Carrying Declarations is now available for community feedback

2016-12-13 Thread Andrei Alexandrescu via Digitalmars-d
On 12/13/16 9:22 PM, Hatem Oraby wrote: On Wednesday, 14 December 2016 at 01:39:01 UTC, Andrei Alexandrescu wrote: On 12/13/16 8:07 PM, Chris M. wrote: [...] So we have: // 1 struct Buffer(R) if ((import std.range).isInputRange!R) { ... } [...] What about?: with(import std.range) bool

Re: DIP10005: Dependency-Carrying Declarations is now available for community feedback

2016-12-13 Thread Andrei Alexandrescu via Digitalmars-d
On 12/13/16 8:53 PM, Chris M. wrote: On Wednesday, 14 December 2016 at 01:39:01 UTC, Andrei Alexandrescu wrote: I prefer the current form of the proposal: bool equal(R1, R2) import (std.range) if (isInputRange!R1 && isInputRange!R2) { ... } The point has been brought up that the syntax

Re: DIP10005: Dependency-Carrying Declarations is now available for community feedback

2016-12-13 Thread Hatem Oraby via Digitalmars-d
On Wednesday, 14 December 2016 at 01:39:01 UTC, Andrei Alexandrescu wrote: On 12/13/16 8:07 PM, Chris M. wrote: [...] So we have: // 1 struct Buffer(R) if ((import std.range).isInputRange!R) { ... } [...] What about?: with(import std.range) bool equal(R1, R2) if (isInputRange!R1 &&

Re: DIP10005: Dependency-Carrying Declarations is now available for community feedback

2016-12-13 Thread Chris M. via Digitalmars-d
On Wednesday, 14 December 2016 at 01:39:01 UTC, Andrei Alexandrescu wrote: I prefer the current form of the proposal: bool equal(R1, R2) import (std.range) if (isInputRange!R1 && isInputRange!R2) { ... } The point has been brought up that the syntax import(std.range) is also used for string

Re: DIP10005: Dependency-Carrying Declarations is now available for community feedback

2016-12-13 Thread Andrei Alexandrescu via Digitalmars-d
On 12/13/16 8:07 PM, Chris M. wrote: Why not something like import foo.bar : baz or import foo : bar.baz to distinguish between module and symbol? It's already used anyway. Also I like Yuxuan's idea, the other ideas seem to add more clutter after the function name So we have: // 1 struct

Re: DIP10005: Dependency-Carrying Declarations is now available for community feedback

2016-12-13 Thread Chris M. via Digitalmars-d
On Tuesday, 13 December 2016 at 23:03:39 UTC, Timon Gehr wrote: On 13.12.2016 23:33, Andrei Alexandrescu wrote: Destroy. https://github.com/dlang/DIPs/pull/51/files Andrei 1. The syntax is ambiguous. Is import.foo.bar.baz the symbol baz in module foo.bar, or the symbol bar.baz in module

Re: LDC 1.1.0-beta6

2016-12-13 Thread Nicholas Wilson via Digitalmars-d-announce
On Tuesday, 13 December 2016 at 21:30:05 UTC, Andrei Alexandrescu wrote: On 12/13/2016 02:37 PM, kinke wrote: Hey all, on behalf of the LDC team I am proud to announce the new 1.1.0-beta6 release! It's based on the 2.071.2 frontend and standard library and supports LLVM 3.5 up to current

Re: DIP10005: Dependency-Carrying Declarations is now available for community feedback

2016-12-13 Thread Yuxuan Shui via Digitalmars-d
On Wednesday, 14 December 2016 at 00:21:23 UTC, Timon Gehr wrote: On 14.12.2016 01:14, Andrei Alexandrescu wrote: On 12/13/16 6:03 PM, Timon Gehr wrote: [...] That is a problem. I switched to the most attractive alternate syntax.

Re: DIP10005: Dependency-Carrying Declarations is now available for community feedback

2016-12-13 Thread Timon Gehr via Digitalmars-d
On 14.12.2016 01:14, Andrei Alexandrescu wrote: On 12/13/16 6:03 PM, Timon Gehr wrote: On 13.12.2016 23:33, Andrei Alexandrescu wrote: Destroy. https://github.com/dlang/DIPs/pull/51/files Andrei 1. The syntax is ambiguous. Is import.foo.bar.baz the symbol baz in module foo.bar, or the

Re: [Bench!][Mir] +54%..+185% performance boost for Mersenne Twister.

2016-12-13 Thread Joseph Rushton Wakeling via Digitalmars-d
On Tuesday, 13 December 2016 at 23:18:26 UTC, Ilya Yaroshenko wrote: * @Ilya, is this implementation your own design, or do you have a reference for the rationale behind this revised implementation of MT? My own. Congratulations, then -- I think this is a very interesting rewrite of

Bug in exception chaining results in exceptions escaping

2016-12-13 Thread Yuxuan Shui via Digitalmars-d
Test case originally by Ali Çehreli, modified by me to expose a more serious bug: import core.stdc.stdio; class TestException : Exception { this(string msg) { super(typeof(this).stringof~": "~msg); } } class UnrelatedException: Exception { this() { super("You

Re: DIP10005: Dependency-Carrying Declarations is now available for community feedback

2016-12-13 Thread Andrei Alexandrescu via Digitalmars-d
On 12/13/16 6:03 PM, Timon Gehr wrote: On 13.12.2016 23:33, Andrei Alexandrescu wrote: Destroy. https://github.com/dlang/DIPs/pull/51/files Andrei 1. The syntax is ambiguous. Is import.foo.bar.baz the symbol baz in module foo.bar, or the symbol bar.baz in module foo? I'd prefer syntax

Re: Dynamic arrays with static initialization and maybe a bug with sizeof

2016-12-13 Thread Xavier Bigand via Digitalmars-d-learn
Le 13/12/2016 23:44, Johan Engelen a écrit : On Tuesday, 13 December 2016 at 21:27:57 UTC, Xavier Bigand wrote: Hi, I have the following code snippet : voidset() { GLfloat[]data = [ -1.0f, -1.0f, 0.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f,

Re: DRY version of `static if(__traits(compiles, expr)) fun(expr)`

2016-12-13 Thread Timon Gehr via Digitalmars-d-learn
On 14.12.2016 00:00, Timothee Cour via Digitalmars-d-learn wrote: what's the best (and DRY) way to achieve: ``` static if(__traits(compiles, expr)) fun(expr); ``` ie, without repeating the expression inside expr? eg: ``` static if(__traits(compiles, foo.bar[2])){ counter++; writeln("

Re: Accessing members through pointers to structs (also, CTFE associative arrays)

2016-12-13 Thread Ali Çehreli via Digitalmars-d-learn
On 12/13/2016 01:36 PM, Ali wrote: Now about that second part of my problem I'm not entirely sure whether this should work but I think the problem is with mutating the 'frequencies' member of an immutable element of 'rooms'. The error message means that those non-const expressions

Re: [Bench!][Mir] +54%..+185% performance boost for Mersenne Twister.

2016-12-13 Thread Ilya Yaroshenko via Digitalmars-d
If I remember correctly it is used with Using, so I use the same type. Using -> Uint Sorry, it is phone keyboard

Re: [Bench!][Mir] +54%..+185% performance boost for Mersenne Twister.

2016-12-13 Thread Ilya Yaroshenko via Digitalmars-d
On Tuesday, 13 December 2016 at 18:15:25 UTC, Joseph Rushton Wakeling wrote: On Saturday, 26 November 2016 at 20:13:36 UTC, Andrei Alexandrescu wrote: Congrats! Also thanks for using the Boost license which would allow backporting the improvements to Phobos. Who'd be up for it? I've finally

Re: DIP10005: Dependency-Carrying Declarations is now available for community feedback

2016-12-13 Thread Timon Gehr via Digitalmars-d
On 13.12.2016 23:33, Andrei Alexandrescu wrote: Destroy. https://github.com/dlang/DIPs/pull/51/files Andrei 1. The syntax is ambiguous. Is import.foo.bar.baz the symbol baz in module foo.bar, or the symbol bar.baz in module foo? I'd prefer syntax like (import foo.bar).baz and (import

DRY version of `static if(__traits(compiles, expr)) fun(expr)`

2016-12-13 Thread Timothee Cour via Digitalmars-d-learn
what's the best (and DRY) way to achieve: ``` static if(__traits(compiles, expr)) fun(expr); ``` ie, without repeating the expression inside expr? eg: ``` static if(__traits(compiles, foo.bar[2])){ counter++; writeln(" expr = ", foo.bar[2]); } ```

Re: arsd.cgi - maximum length of form post

2016-12-13 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 13 December 2016 at 00:54:43 UTC, Adam D. Ruppe wrote: On Tuesday, 13 December 2016 at 00:48:44 UTC, bachmeier wrote: a range violation error core.exception.RangeError@test.d(109): Range violation What's that line of your code too? Here is a minimal program that can replicate

Re: DIP10005: Dependency-Carrying Declarations is now available for community feedback

2016-12-13 Thread Andrei Alexandrescu via Digitalmars-d
On 12/13/2016 05:33 PM, Andrei Alexandrescu wrote: Destroy. https://github.com/dlang/DIPs/pull/51/files The "View" mode offers formatting before merging: https://github.com/andralex/DIPs/blob/10ca2e22c0d759c81e4b3afbdc085d7131f68b85/DIPs/DIP1005.md -- Andrei

Re: Making AssertError a singleton

2016-12-13 Thread Andrei Alexandrescu via Digitalmars-d
On 12/13/2016 05:05 PM, Jonathan M Davis wrote: I mean that with virtual functions, in contracts get ||ed and out contracts get & Since that involves assertions, unless the compiler is doing something special there with assert, that involves throwing multiple AssertErrors and catching them.

Re: Making AssertError a singleton

2016-12-13 Thread Jonathan M Davis via Digitalmars-d
On Tuesday, 13 December 2016 at 06:36:47 UTC, Shachar Shemesh wrote: On 13/12/16 02:57, Andrei Alexandrescu wrote: You can catch AssertError. There's no guarantees dtors have been called during unwinding. -- Andrei That makes no sense to me, unless you only want to catch it in order to do

All function attributes possible with "@"?

2016-12-13 Thread 01010100b via Digitalmars-d
On the wiki there is an argument given for why not to allow "@" on function attributes which are keywords, however it seems to include a reasoning error. This is the argument: "Why don't we just allow an '@' character on all function attributes so it looks consistent? To appreciate the

Re: Dynamic arrays with static initialization and maybe a bug with sizeof

2016-12-13 Thread Johan Engelen via Digitalmars-d-learn
On Tuesday, 13 December 2016 at 21:27:57 UTC, Xavier Bigand wrote: Hi, I have the following code snippet : voidset() { GLfloat[] data = [ -1.0f, -1.0f, 0.0f, 1.0f, -1.0f, 0.0f,

Re: DIP10005: Dependency-Carrying Declarations is now available for community feedback

2016-12-13 Thread Andrei Alexandrescu via Digitalmars-d
(eh I was off by one zero in the title)

DIP10005: Dependency-Carrying Declarations is now available for community feedback

2016-12-13 Thread Andrei Alexandrescu via Digitalmars-d
Destroy. https://github.com/dlang/DIPs/pull/51/files Andrei

Re: DIP 1003: remove `body` as a keyword

2016-12-13 Thread Mark via Digitalmars-d-announce
On Thursday, 24 November 2016 at 14:06:40 UTC, Jonathan M Davis wrote: Personally, I don't care much about having body as a usable symbol. It occasionally would be useful, but I can live without it. However, I _do_ find it very annoying that it's required for the function body when you have

Re: Making AssertError a singleton

2016-12-13 Thread Stefan Koch via Digitalmars-d
On Tuesday, 13 December 2016 at 22:15:13 UTC, Stefan Koch wrote: I have noticed severe code-bloat at ctfe, and worse when ctfe-codegen miscompiles those templates, there in way to know why! Was meant to say. there is no way to know why.

Re: Making AssertError a singleton

2016-12-13 Thread Stefan Koch via Digitalmars-d
On Tuesday, 13 December 2016 at 18:52:05 UTC, Andrei Alexandrescu wrote: * People have noticed that certain simple uses of D trigger calls into druntime that are not quite justified. For example, assigning an array of int to another array of int issues a call into a function that uses dynamic

Re: Making AssertError a singleton

2016-12-13 Thread Jonathan M Davis via Digitalmars-d
On Tuesday, 13 December 2016 at 13:59:13 UTC, Andrei Alexandrescu wrote: On 12/13/2016 01:34 AM, Shachar Shemesh wrote: unlinking GC from phobos is not likely to happen until that happens You can avoid linking druntime today with -betterC. -- Andrei You can avoid linking druntime _now_. And

Re: Making AssertError a singleton

2016-12-13 Thread Jonathan M Davis via Digitalmars-d
On Tuesday, 13 December 2016 at 04:45:35 UTC, Andrei Alexandrescu wrote: On 12/12/16 11:07 PM, Jonathan M Davis wrote: On Monday, 12 December 2016 at 15:51:07 UTC, Andrei Alexandrescu wrote: Here it is: https://github.com/dlang/druntime/pull/1710 It relieves code that uses assert from

Re: [Bench!][Mir] +54%..+185% performance boost for Mersenne Twister.

2016-12-13 Thread Joseph Rushton Wakeling via Digitalmars-d
On Tuesday, 13 December 2016 at 18:15:25 UTC, Joseph Rushton Wakeling wrote: I'm going to try to put together a range-based version to see if this also makes any difference. I'll post some benchmarks of my own once that's done, and if all looks good I'll try to put a Phobos PR together.

Using Nsight with VisualD

2016-12-13 Thread Xavier Bigand via Digitalmars-d-learn
Hi, I am trying to use Nsight with VisualD by it tell me that it can not start the program "". It seems that it does not use the right property of the project to retrieve the path of my generated binary. I do not know if it is an issue of VisualD directly or DUB that don't correctly

Re: Mir Blog: Writing efficient numerical code in D

2016-12-13 Thread Mark via Digitalmars-d-announce
On Monday, 12 December 2016 at 21:58:23 UTC, Relja Ljubobratovic wrote: [1] http://blog.mir.dlang.io/ndslice/algorithm/optimization/2016/12/12/writing-efficient-numerical-code.html [2] https://github.com/libmir/dcv [3] https://github.com/libmir/dcv/pull/58 Very impressive work.

Re: Making AssertError a singleton

2016-12-13 Thread Jonathan M Davis via Digitalmars-d
On Tuesday, 13 December 2016 at 11:39:16 UTC, Guillaume Piolat wrote: On Monday, 12 December 2016 at 21:02:11 UTC, Andrei Alexandrescu wrote: That will come too. Andrei Great teaser :) For reference, here is how I currently do this: - make Object.~this() @nogc with a cast - throw

Re: Dynamic arrays with static initialization and maybe a bug with sizeof

2016-12-13 Thread Xavier Bigand via Digitalmars-d-learn
Le 13/12/2016 22:39, ag0aep6g a écrit : On 12/13/2016 10:27 PM, Xavier Bigand wrote: voidset() { GLfloat[]data = [ -1.0f, -1.0f, 0.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, ]; glBindVertexArray(mVAO);

Re: Compiler concept

2016-12-13 Thread bauss (wtf happend to my name took some old cached title LOL??) via Digitalmars-d
On Tuesday, 13 December 2016 at 12:58:42 UTC, Swoorup Joshi wrote: On Tuesday, 13 December 2016 at 01:03:54 UTC, Ignacious wrote: Would it be difficult to implement the following, or something with similar capabilities, as a patch to dmd? [...] Isn't this what string mixin is for Not

Re: Dynamic arrays with static initialization and maybe a bug with sizeof

2016-12-13 Thread ag0aep6g via Digitalmars-d-learn
On 12/13/2016 10:27 PM, Xavier Bigand wrote: voidset() { GLfloat[]data = [ -1.0f, -1.0f, 0.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, ]; glBindVertexArray(mVAO); glBufferData(GL_ARRAY_BUFFER, data.sizeof,

Re: Accessing members through pointers to structs (also, CTFE associative arrays)

2016-12-13 Thread Ali via Digitalmars-d-learn
On Tuesday, 13 December 2016 at 21:33:11 UTC, Ali Çehreli wrote: On 12/13/2016 12:30 PM, Ali wrote: > foreach (i, room; rooms) { > data[i].room = That is the address of the local variable room. You need to use 'ref' there: foreach (i, ref room; rooms) { > - Ali Ahh

Re: LDC 1.1.0-beta6

2016-12-13 Thread Andrei Alexandrescu via Digitalmars-d-announce
On 12/13/2016 02:37 PM, kinke wrote: Hey all, on behalf of the LDC team I am proud to announce the new 1.1.0-beta6 release! It's based on the 2.071.2 frontend and standard library and supports LLVM 3.5 up to current trunk (4.0). This is awesome! Could you please tell what the expected lag

Re: Alias variable from another class

2016-12-13 Thread Ali via Digitalmars-d-learn
I guess it's because you're accessing a member of _1 from inside a scope of _2 where nothing has been constructed yet? Someone more familiar with D would probably have a better answer on this part. I'm quite new :) But a work around would be class _2 { _1 instance;

Re: Accessing members through pointers to structs (also, CTFE associative arrays)

2016-12-13 Thread Ali Çehreli via Digitalmars-d-learn
On 12/13/2016 12:30 PM, Ali wrote: > foreach (i, room; rooms) { > data[i].room = That is the address of the local variable room. You need to use 'ref' there: foreach (i, ref room; rooms) { > - Ali Ali "the real one :o)"

Re: Accessing members through pointers to structs (also, CTFE associative arrays)

2016-12-13 Thread bauss (wtf happend to my name took some old cached title LOL??) via Digitalmars-d-learn
On Tuesday, 13 December 2016 at 21:21:34 UTC, Ali wrote: On Tuesday, 13 December 2016 at 21:08:31 UTC, drug007 wrote: (*d.room).name Oh yeah, tried that too. That at least compiles but gives a runtime exception (bad address). Try (*cast(Room*)(d.room)).name

Dynamic arrays with static initialization and maybe a bug with sizeof

2016-12-13 Thread Xavier Bigand via Digitalmars-d-learn
Hi, I have the following code snippet : voidset() { GLfloat[] data = [ -1.0f, -1.0f, 0.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, ];

Re: Accessing members through pointers to structs (also, CTFE associative arrays)

2016-12-13 Thread Ali via Digitalmars-d-learn
On Tuesday, 13 December 2016 at 21:08:31 UTC, drug007 wrote: (*d.room).name Oh yeah, tried that too. That at least compiles but gives a runtime exception (bad address).

Re: Fix suggestions for missing imports // code-d 0.15.0 & workspace-d 2.9.1 released

2016-12-13 Thread Anonymouse via Digitalmars-d-announce
On Monday, 12 December 2016 at 21:42:50 UTC, WebFreak001 wrote: [...] I cannot for the life of me get it to work on Arch. I have workspace-d from the AUR and the rest of dcd, dscanner, dfmt, dub etc from the official repositories. They're all reachable via $PATH so I haven't touched the

Re: reading from file

2016-12-13 Thread Ali via Digitalmars-d-learn
On Tuesday, 13 December 2016 at 16:59:17 UTC, Namal wrote: On Tuesday, 13 December 2016 at 16:57:40 UTC, Namal wrote: Sorry if I wasn't clear. The array should be two demensional and each line in text line should be a row in that 2x2 array. Also, it should be saved as an integer. And

Re: Accessing members through pointers to structs (also, CTFE associative arrays)

2016-12-13 Thread drug007 via Digitalmars-d-learn
On 13.12.2016 23:30, Ali wrote: Hi, Long time watcher and recently started playing with D a bit more. Ran in to a couple of snags that I'll combine in one post. It involves a data set that contains a list of strings. Each string represents a Room name. What I'm trying to do is pluck out the room

Re: Fix suggestions for missing imports // code-d 0.15.0 & workspace-d 2.9.1 released

2016-12-13 Thread Soulsbane via Digitalmars-d-announce
On Tuesday, 13 December 2016 at 14:09:53 UTC, WebFreak001 wrote: On Tuesday, 13 December 2016 at 00:25:27 UTC, Soulsbane wrote: On Monday, 12 December 2016 at 21:42:50 UTC, WebFreak001 wrote: I recently released workspace-d¹ 2.9.1 with many new additions and I released code-d² 0.15.0 just a

Accessing members through pointers to structs (also, CTFE associative arrays)

2016-12-13 Thread Ali via Digitalmars-d-learn
Hi, Long time watcher and recently started playing with D a bit more. Ran in to a couple of snags that I'll combine in one post. It involves a data set that contains a list of strings. Each string represents a Room name. What I'm trying to do is pluck out the room names and also calculate the

Re: reading from file

2016-12-13 Thread Ali Çehreli via Digitalmars-d-learn
On 12/13/2016 08:59 AM, Namal wrote: On Tuesday, 13 December 2016 at 16:57:40 UTC, Namal wrote: Sorry if I wasn't clear. The array should be two demensional and each line in text line should be a row in that 2x2 array. Also, it should be saved as an integer. Here is another one: import

LDC 1.1.0-beta6

2016-12-13 Thread kinke via Digitalmars-d-announce
Hey all, on behalf of the LDC team I am proud to announce the new 1.1.0-beta6 release! It's based on the 2.071.2 frontend and standard library and supports LLVM 3.5 up to current trunk (4.0). Beta 6 is what beta 4 should have been, but early testing revealed some issues (thanks for

Re: SecureD - A simple cryptography library for D

2016-12-13 Thread Jacob Carlborg via Digitalmars-d-announce
On 2016-12-13 09:20, Adam Wilson wrote: ld: in ../../.dub/packages/botan-1.12.8/botan/.dub/build/full-unittest-posix.osx-x86_64-dmd_2072-0D593375D53C36354213ADF6E4F6A036/libbotan_base.a(unique_40d1_3b6.o), in section __TEXT,__textcoal_nt reloc 2: symbol index out of range for architecture

Alias variable from another class

2016-12-13 Thread Begah via Digitalmars-d-learn
I made a little program to illustrate my confusion : import std.stdio; class _1 { int i; this(int n) { i = n; } } class _2 { _1 instance; alias twelve = instance.i; this() {

Re: Making AssertError a singleton

2016-12-13 Thread Andrei Alexandrescu via Digitalmars-d
On 12/13/2016 01:23 AM, Shachar Shemesh wrote: On 12/12/16 23:02, Andrei Alexandrescu wrote: Why am I not surprised :o). I'm not sure what to make of that comment. Just jesting, and not always in style. Apologies. Let me restate the factors at play here; admittedly the matter is a bit

Re: this is not an lvalue

2016-12-13 Thread kinke via Digitalmars-d-learn
On Tuesday, 13 December 2016 at 17:52:21 UTC, Adam D. Ruppe wrote: On Tuesday, 13 December 2016 at 17:26:28 UTC, kink wrote: Assuming `Parameter` is a class and not a struct, yes. Even if it is a struct, ref wouldn't make a difference here because the variable is assigned to a member, which

Re: [Bench!][Mir] +54%..+185% performance boost for Mersenne Twister.

2016-12-13 Thread Joseph Rushton Wakeling via Digitalmars-d
On Saturday, 26 November 2016 at 20:13:36 UTC, Andrei Alexandrescu wrote: Congrats! Also thanks for using the Boost license which would allow backporting the improvements to Phobos. Who'd be up for it? I've finally found a moment to look into this (I'm at home recovering from a seasonal

Re: Making AssertError a singleton

2016-12-13 Thread Andrei Alexandrescu via Digitalmars-d
On 12/13/2016 12:18 PM, Timon Gehr wrote: I assume you don't refer to passing along a runtime flag whether execution is currently in a contract and then selectively disable calling of dtors. No, something simpler than that - nontransitive. Consider: T fun(R range) in { assert(range.front

Re: this is not an lvalue

2016-12-13 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 13 December 2016 at 17:26:28 UTC, kink wrote: Assuming `Parameter` is a class and not a struct, yes. Even if it is a struct, ref wouldn't make a difference here because the variable is assigned to a member, which means ref would get lost.

Re: this is not an lvalue

2016-12-13 Thread kink via Digitalmars-d-learn
On Tuesday, 13 December 2016 at 16:23:16 UTC, Adam D. Ruppe wrote: On Tuesday, 13 December 2016 at 15:09:10 UTC, Andrey wrote: void moveTo(ref Parameter parent) { You probably don't want the `ref` there, nor likely on any other method definitions (especially check removeValue). Assuming

Re: Making AssertError a singleton

2016-12-13 Thread Timon Gehr via Digitalmars-d
On 13.12.2016 17:47, Andrei Alexandrescu wrote: On 12/13/2016 11:39 AM, Timon Gehr wrote: On 13.12.2016 01:57, Andrei Alexandrescu wrote: On 12/12/16 4:35 PM, Brad Roberts via Digitalmars-d wrote: Of course, then you'll find the fun of all the tests (and probably code) that catch AssertError.

Re: reading from file

2016-12-13 Thread Namal via Digitalmars-d-learn
Sorry if I wasn't clear. The array should be two demensional and each line in text line should be a row in that 2x2 array.

Re: reading from file

2016-12-13 Thread Namal via Digitalmars-d-learn
On Tuesday, 13 December 2016 at 16:57:40 UTC, Namal wrote: Sorry if I wasn't clear. The array should be two demensional and each line in text line should be a row in that 2x2 array. Also, it should be saved as an integer.

Re: Making AssertError a singleton

2016-12-13 Thread Andrei Alexandrescu via Digitalmars-d
On 12/13/2016 11:39 AM, Timon Gehr wrote: On 13.12.2016 01:57, Andrei Alexandrescu wrote: On 12/12/16 4:35 PM, Brad Roberts via Digitalmars-d wrote: Of course, then you'll find the fun of all the tests (and probably code) that catch AssertError. You can catch AssertError. There's no

Re: Making AssertError a singleton

2016-12-13 Thread Timon Gehr via Digitalmars-d
On 13.12.2016 01:57, Andrei Alexandrescu wrote: On 12/12/16 4:35 PM, Brad Roberts via Digitalmars-d wrote: Of course, then you'll find the fun of all the tests (and probably code) that catch AssertError. You can catch AssertError. There's no guarantees dtors have been called during unwinding.

Re: this is not an lvalue

2016-12-13 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 13 December 2016 at 15:09:10 UTC, Andrey wrote: void moveTo(ref Parameter parent) { You probably don't want the `ref` there, nor likely on any other method definitions (especially check removeValue).

Re: reading from file

2016-12-13 Thread bluecat via Digitalmars-d-learn
On Tuesday, 13 December 2016 at 15:42:16 UTC, Namal wrote: Hello, comming from C++, I find it hard to remember and understand how reading from file should be done in D. Especially since I am not very good in functional programming. So I have a file which looks like this: 1,2,3,4 5,6,7,8

Re: reading from file

2016-12-13 Thread rikki cattermole via Digitalmars-d-learn
On 14/12/2016 4:42 AM, Namal wrote: Hello, comming from C++, I find it hard to remember and understand how reading from file should be done in D. Especially since I am not very good in functional programming. So I have a file which looks like this: 1,2,3,4 5,6,7,8 9,11,11,12 and so on How

Re: Mir Blog: Writing efficient numerical code in D

2016-12-13 Thread Relja Ljubobratovic via Digitalmars-d-announce
On Tuesday, 13 December 2016 at 15:31:00 UTC, Mike Parker wrote: https://www.reddit.com/r/programming/comments/5i42vc/writing_efficient_numerical_code_in_d/ Thank you, Mike!

Re: Installing ldc breaks gdc

2016-12-13 Thread Eduard Staniloiu via Digitalmars-d
On Friday, 9 December 2016 at 17:53:30 UTC, Matthias Klumpp wrote: Hi! This issue should be fixed since LDC 1:1.1.0-2, which Xenial doesn't have. Ideally, fetch a newer version from Debian or a PPA to solve this issue. Cheers, Matthias Hi! Thank you for your answer. For future

reading from file

2016-12-13 Thread Namal via Digitalmars-d-learn
Hello, comming from C++, I find it hard to remember and understand how reading from file should be done in D. Especially since I am not very good in functional programming. So I have a file which looks like this: 1,2,3,4 5,6,7,8 9,11,11,12 and so on How could I read it row by row and create

Re: Mir Blog: Writing efficient numerical code in D

2016-12-13 Thread Mike Parker via Digitalmars-d-announce
On Tuesday, 13 December 2016 at 09:58:09 UTC, Mike Parker wrote: On Tuesday, 13 December 2016 at 05:27:01 UTC, Andrei Alexandrescu wrote: This is awesome! Mike, could you please post to reddit about 11 hours from now if possible. Yes, I intend to post it to both reddit and FB, but it will

this is not an lvalue

2016-12-13 Thread Andrey via Digitalmars-d-learn
Hello, I'm newbie in D. I'm trying to rewrite my project from C++ and now I get strange warning: src/e2ml/node.d(23,22): Deprecation: this is not an lvalue As I write the following code void moveTo(ref Parameter parent) { this.p_parent.removeValue(this); this.p_parent = parent;

Re: Getters/setters generator

2016-12-13 Thread Kapps via Digitalmars-d-announce
On Sunday, 11 December 2016 at 06:55:22 UTC, Mike Parker wrote: On Sunday, 11 December 2016 at 03:15:55 UTC, Mike Bierlee wrote: I was under the impression that you could only access methods as if they were fields using the @property attribute. After carefully reading the documentation I

Re: Happy December 13th!

2016-12-13 Thread Wyatt via Digitalmars-d
On Tuesday, 13 December 2016 at 10:48:23 UTC, Walter Bright wrote: What a great day to be alive! Just feeling really blessed today, and hope you all are too. Well, Merry Tuesday!

Re: Fix suggestions for missing imports // code-d 0.15.0 & workspace-d 2.9.1 released

2016-12-13 Thread WebFreak001 via Digitalmars-d-announce
On Tuesday, 13 December 2016 at 00:25:27 UTC, Soulsbane wrote: On Monday, 12 December 2016 at 21:42:50 UTC, WebFreak001 wrote: I recently released workspace-d¹ 2.9.1 with many new additions and I released code-d² 0.15.0 just a few hours ago. [...] Question, will(or perhaps there already is

Re: Making AssertError a singleton

2016-12-13 Thread Andrei Alexandrescu via Digitalmars-d
On 12/13/2016 01:34 AM, Shachar Shemesh wrote: unlinking GC from phobos is not likely to happen until that happens You can avoid linking druntime today with -betterC. -- Andrei

Re: Happy December 13th!

2016-12-13 Thread Walter Bright via Digitalmars-d
On 12/13/2016 2:48 AM, Walter Bright wrote: What a great day to be alive! Just feeling really blessed today, and hope you all are too. This is a fake message. - the real Walter

Re: Happy December 13th!

2016-12-13 Thread Andrei Alexandrescu via Digitalmars-d
On 12/13/2016 05:48 AM, Walter Bright wrote: What a great day to be alive! Just feeling really blessed today, and hope you all are too. Thanks for sharing this luminous thought. -- Andrei

Re: Happy December 13th!

2016-12-13 Thread Bauss via Digitalmars-d
On Tuesday, 13 December 2016 at 10:48:23 UTC, Walter Bright wrote: What a great day to be alive! Just feeling really blessed today, and hope you all are too. You as well! It's a pretty good day isn't it?

Re: Happy December 13th!

2016-12-13 Thread Basile B. via Digitalmars-d
On Tuesday, 13 December 2016 at 10:48:23 UTC, Walter Bright wrote: What a great day to be alive! Just feeling really blessed today, and hope you all are too. Thanks, Happy 13th of December too. The intention is here but I didn't manage to get a cover from soundgarden for today. So let's the

Re: Compiler concept

2016-12-13 Thread Swoorup Joshi via Digitalmars-d
On Tuesday, 13 December 2016 at 01:03:54 UTC, Ignacious wrote: Would it be difficult to implement the following, or something with similar capabilities, as a patch to dmd? [...] Isn't this what string mixin is for

Re: Compiler concept

2016-12-13 Thread Adam D. Ruppe via Digitalmars-d
On Tuesday, 13 December 2016 at 07:44:54 UTC, Jacob Carlborg wrote: Doing something like AST macros (which this sounds like) is not _that_ difficult. I was thinking doing it at run time... doing it at compile time indeed isn't that bad (it still looks like the interpreter tree at that

[Issue 16352] dead-lock in std.allocator.free_list unittest

2016-12-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16352 --- Comment #5 from John Colvin --- It seems that all the threads exit but (in my tests) one message either is never sent or is never received by the main thread, so it sits in receiveOnly!bool --

Re: Making AssertError a singleton

2016-12-13 Thread Atila Neves via Digitalmars-d
On Tuesday, 13 December 2016 at 07:49:59 UTC, Jacob Carlborg wrote: On 2016-12-13 05:07, Jonathan M Davis wrote: It also could be problematic with unit tests - especially unit tests that catch AssertErrors (e.g. if someone wants to test the contracts). I also expect all unit test

Re: CTFE Status

2016-12-13 Thread Stefan Koch via Digitalmars-d
I made good progress on function calls today. By deferring them we get both better bytecode-generator performance and simpler code. Since the deferring step seems to work, you can expect calls to work by the end of next week. When function-calls work, I will direct efforts towards correct

[Issue 16969] New: [backend] add an assemby writer

2016-12-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16969 Issue ID: 16969 Summary: [backend] add an assemby writer Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: enhancement

[Issue 16969] [backend] add an assembly writer

2016-12-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16969 b2.t...@gmx.com changed: What|Removed |Added Summary|[backend] add an assemby|[backend] add an assembly

  1   2   >