Re: iopipe v0.0.4 - RingBuffers!

2018-05-10 Thread Dmitry Olshansky via Digitalmars-d-announce
On Thursday, 10 May 2018 at 23:22:02 UTC, Steven Schveighoffer wrote: OK, so at dconf I spoke with a few very smart guys about how I can use mmap to make a zero-copy buffer. And I implemented this on the plane ride home. However, I am struggling to find a use case for this that showcases why

Re: Sealed classes - would you want them in D?

2018-05-10 Thread KingJoffrey via Digitalmars-d
On Friday, 11 May 2018 at 05:10:08 UTC, Uknown wrote: On Friday, 11 May 2018 at 04:43:09 UTC, KingJoffrey wrote: On Friday, 11 May 2018 at 03:32:25 UTC, Uknown wrote: `private` is for outside the module. Within the module, private is not applied because D wanted to avoid C++'s `friend`

Re: Sealed classes - would you want them in D?

2018-05-10 Thread Apocalypto via Digitalmars-d
On Friday, 11 May 2018 at 05:10:08 UTC, Uknown wrote: On Friday, 11 May 2018 at 04:43:09 UTC, KingJoffrey wrote: On Friday, 11 May 2018 at 03:32:25 UTC, Uknown wrote: Whereas D makes it part of the implementation of 'the module' ( which is an even higher level of abstraction). This is an

Re: Sealed classes - would you want them in D?

2018-05-10 Thread Uknown via Digitalmars-d
On Friday, 11 May 2018 at 04:43:09 UTC, KingJoffrey wrote: On Friday, 11 May 2018 at 03:32:25 UTC, Uknown wrote: `private` is for outside the module. Within the module, private is not applied because D wanted to avoid C++'s `friend` functions. 'private' is "meant" to be part of the

Re: Sealed classes - would you want them in D?

2018-05-10 Thread KingJoffrey via Digitalmars-d
On Friday, 11 May 2018 at 03:32:25 UTC, Uknown wrote: `private` is for outside the module. Within the module, private is not applied because D wanted to avoid C++'s `friend` functions. 'private' is "meant" to be part of the implementation of 'the class'. Whereas D makes it part of the

Re: Need help with the dmd package on NixOS

2018-05-10 Thread Thomas Mader via Digitalmars-d
On Wednesday, 9 May 2018 at 19:58:48 UTC, Thomas Mader wrote: Now I wonder how something like that is possible. My suspicion about the switch to glibc 2.27 being the problem was wrong. I did a very timeconsuming bisection and found the problem commit to be the one which bumped binutils to

Re: auto: useful, annoying or bad practice?

2018-05-10 Thread KingJoffrey via Digitalmars-d
On Monday, 30 April 2018 at 21:11:07 UTC, Gerald wrote: So I'm curious, what's the consensus on auto? My rule, is when I can't be bothered typing it all out, or can't be bothered working out what it is I'm actually meant to type, then I use auto (or var). i.e. I use it as a time saver,

[Issue 18852] forum.dlang.org says down when redirect after posting

2018-05-10 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18852 --- Comment #3 from John Hall --- @Vladamir Thanks for fixing this. It's been driving me a bit nuts. I often get the CAPTCHAs at home because I'm behind a VPN. I might get them at work too, but really it's the VPN that

Re: Sealed classes - would you want them in D?

2018-05-10 Thread Uknown via Digitalmars-d
On Friday, 11 May 2018 at 03:11:48 UTC, KingJoffrey wrote: On Thursday, 10 May 2018 at 21:26:12 UTC, Jonathan M Davis wrote: Idiomatic D tends to use classes rarely... What is the basis for this assertion? D tends to prefer structs with UFCS member functions rather than classes, because

[Issue 18852] forum.dlang.org says down when redirect after posting

2018-05-10 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18852 Vladimir Panteleev changed: What|Removed |Added Status|NEW

Re: Sealed classes - would you want them in D?

2018-05-10 Thread KingJoffrey via Digitalmars-d
On Thursday, 10 May 2018 at 21:26:12 UTC, Jonathan M Davis wrote: Idiomatic D tends to use classes rarely... What is the basis for this assertion? On a separate issue, 'private' should mean private! (not kinda-private). Let's not make D classes even more of joke.

[Issue 15246] Destructor inheritance doesn't inherit attributes properly

2018-05-10 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15246 alexanderheisterm...@gmail.com changed: What|Removed |Added Severity|normal |critical --

[Issue 15246] Destructor inheritance doesn't inherit attributes properly

2018-05-10 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15246 --- Comment #17 from alexanderheisterm...@gmail.com --- This bug blocks certain Phobos functions from being @nogc as it involves the destroy function. I am bumping the importance of this to critical status, as the current workarounds I seen involves

[Issue 13972] Make scoped, Unique, and RefCounted @nogc

2018-05-10 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13972 alexanderheisterm...@gmail.com changed: What|Removed |Added CC||alexanderheistermann@gmail.

[Issue 14171] Mark non-allocating GC functions as @nogc

2018-05-10 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14171 alexanderheisterm...@gmail.com changed: What|Removed |Added Blocks|13972 | Referenced Issues:

[Issue 15246] Destructor inheritance doesn't inherit attributes properly

2018-05-10 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15246 alexanderheisterm...@gmail.com changed: What|Removed |Added Blocks||13972 Referenced Issues:

Re: [DUB][DLS] building package dls doesn't finish

2018-05-10 Thread Rubn via Digitalmars-d
On Thursday, 10 May 2018 at 09:32:38 UTC, Kamil Koczurek wrote: Hello, I installed an atom extension for D support, but it requires dls package to be installed and built. When I fetch and attempt to build it (with --build=release) it just says that it's building and doesn't change even if I

Re: autowrap v0.0.1 - Automatically wrap existing D code for use in Python and Excel

2018-05-10 Thread Laeeth Isharc via Digitalmars-d-announce
On Thursday, 10 May 2018 at 19:50:40 UTC, Nikos wrote: In my dub.sdl file I have configuration "python35" { subConfiguration "autowrap" "python35" } and I run dub build --config=python35 which still tries to find python36. Why doesn't it look for 3.5? Hi. On my phone so can't copy

[Issue 18852] forum.dlang.org says down when redirect after posting

2018-05-10 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18852 greenify changed: What|Removed |Added CC||greeen...@gmail.com ---

iopipe v0.0.4 - RingBuffers!

2018-05-10 Thread Steven Schveighoffer via Digitalmars-d-announce
OK, so at dconf I spoke with a few very smart guys about how I can use mmap to make a zero-copy buffer. And I implemented this on the plane ride home. However, I am struggling to find a use case for this that showcases why you would want to use it. While it does work, and works beautifully,

[Issue 18852] New: forum.dlang.org says down when redirect after posting

2018-05-10 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18852 Issue ID: 18852 Summary: forum.dlang.org says down when redirect after posting Product: D Version: D2 Hardware: x86 OS: Windows Status: NEW Severity: normal

Re: property += operator

2018-05-10 Thread Mike Franklin via Digitalmars-d-learn
On Thursday, 10 May 2018 at 21:16:12 UTC, Jonathan M Davis wrote: IIRC, there's a DIP for trying to make += work with just getters and setters, but I don't know if we're ever going to see anything like it in the language. Yes, the DIP is here: https://github.com/dlang/DIPs/pull/97 It's

Re: Line breaks in JSON

2018-05-10 Thread jmh530 via Digitalmars-d-learn
On Thursday, 10 May 2018 at 18:21:17 UTC, bachmeier wrote: [snip] I used replace("\\n", "\n") Ah, I always forget the extra \.

Re: Building dmd/druntime on windows issue

2018-05-10 Thread Seb via Digitalmars-d-learn
On Thursday, 10 May 2018 at 18:38:30 UTC, Andre Pany wrote: Hi, I follow the instructions from the wiki to build dmd/druntime from source on windows. https://wiki.dlang.org/Building_under_Windows [...] Which DMD/druntime do you try to build? IIRC there are some issues with the release

[Issue 18851] std.net.curl.post cannot be used with !ubyte

2018-05-10 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18851 Eugene changed: What|Removed |Added Keywords||trivial URL|

[Issue 18851] New: std.net.curl.post cannot be used with !ubyte

2018-05-10 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18851 Issue ID: 18851 Summary: std.net.curl.post cannot be used with !ubyte Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: blocker

Re: Sealed classes - would you want them in D?

2018-05-10 Thread Jonathan M Davis via Digitalmars-d
On Thursday, May 10, 2018 13:22:20 Piotr Mitana via Digitalmars-d wrote: > Hello, > > I've recently thought of sealed classes (sealed as in Scala, not > as in C#) and am thinking of writing a DIP for it. I decided to > start this thread first though to gather some opinions on the > topic. > > For

Re: property += operator

2018-05-10 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, May 10, 2018 18:43:40 SrMordred via Digitalmars-d-learn wrote: > struct T > { > int x; > @property ref X(){ return x; } > @property X(int v) > { > x = v; > } > } > > T t; > t.X += 10; > > The setter 'x = v' are not executed because i´m returning the >

Re: D'ish similar_text?

2018-05-10 Thread Dgame via Digitalmars-d-learn
On Thursday, 10 May 2018 at 20:38:12 UTC, Vladimir Panteleev wrote: On Thursday, 10 May 2018 at 20:32:11 UTC, Dgame wrote: immutable size_t len = s1.length + s2.length; percent = (len - distance) * 100.0 / len; Note that this formula will give you only 50% similarity for "abc" and

Re: property += operator

2018-05-10 Thread Dlang User via Digitalmars-d-learn
On 5/10/2018 3:18 PM, Ali Çehreli wrote: On 05/10/2018 01:03 PM, Dlang User wrote: >> this didn´t work either. >> note that 'f.data+= 2;' don't call the write property > > That's odd, it works on my machine (Windows 10 with V2.079.0 DMD compiler). Try putting writeln expressions in the

Re: How do you connect Python with D via socket, I'm still getting connection refused error

2018-05-10 Thread Enjoys Math via Digitalmars-d-learn
On Friday, 4 May 2018 at 13:52:29 UTC, Andy Smith wrote: On Thursday, 3 May 2018 at 23:58:24 UTC, Enjoys Math wrote: Error - [...] Haven't run it, but two things to try... On D side try adding listen after bind. On python side. Don't think you need to call bind the client socket

Re: A bit more Emscripten

2018-05-10 Thread Laeeth Isharc via Digitalmars-d-announce
On Thursday, 10 May 2018 at 08:32:07 UTC, Vladimir Panteleev wrote: On Tuesday, 8 May 2018 at 08:53:36 UTC, Vladimir Panteleev wrote: https://github.com/CyberShadow/dscripten-tools Progress update: - std.stdio.writeln() works - Using a D main() works (though unittests and static

Re: D'ish similar_text?

2018-05-10 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 10 May 2018 at 20:32:11 UTC, Dgame wrote: immutable size_t len = s1.length + s2.length; percent = (len - distance) * 100.0 / len; Note that this formula will give you only 50% similarity for "abc" and "def", i.e. two completely different strings. I suggest to divide by

Re: D'ish similar_text?

2018-05-10 Thread Dgame via Digitalmars-d-learn
On Thursday, 10 May 2018 at 20:13:49 UTC, Vladimir Panteleev wrote: On Thursday, 10 May 2018 at 20:08:04 UTC, Dgame wrote: void similar_text_similar_str(char* txt1, size_t len1, char* That looks like an implementation of Levenshtein distance. We have one in Phobos:

Re: property += operator

2018-05-10 Thread Ali Çehreli via Digitalmars-d-learn
On 05/10/2018 01:03 PM, Dlang User wrote: >> this didn´t work either. >> note that 'f.data+= 2;' don't call the write property > > That's odd, it works on my machine (Windows 10 with V2.079.0 DMD compiler). Try putting writeln expressions in the two functions to see which one gets called. ;)

[Issue 18850] Template overload incorrectly results in recursive expansion error

2018-05-10 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18850 ag0aep6g changed: What|Removed |Added CC||ag0ae...@gmail.com ---

Re: D'ish similar_text?

2018-05-10 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 10 May 2018 at 20:08:04 UTC, Dgame wrote: void similar_text_similar_str(char* txt1, size_t len1, char* That looks like an implementation of Levenshtein distance. We have one in Phobos: https://dlang.org/library/std/algorithm/comparison/levenshtein_distance.html

D'ish similar_text?

2018-05-10 Thread Dgame via Digitalmars-d-learn
I'm in need for some sort of string similarity comparision. I've found soundex but that didn't solved my needs. After some search I found a C implementation of similar_text, but that is quite ugly... I was able to let it work in D but it's still somewhat messy. Is there any D implementation of

Re: property += operator

2018-05-10 Thread Dlang User via Digitalmars-d-learn
On 5/10/2018 2:50 PM, SrMordred wrote: On Thursday, 10 May 2018 at 19:41:41 UTC, Dlang User wrote: On 5/10/2018 1:43 PM, SrMordred wrote: [...] I am relatively new to D and I was under the impression that that was a limitation of @property functions. But, re-reading the language

Re: autowrap v0.0.1 - Automatically wrap existing D code for use in Python and Excel

2018-05-10 Thread Nikos via Digitalmars-d-announce
In my dub.sdl file I have configuration "python35" { subConfiguration "autowrap" "python35" } and I run dub build --config=python35 which still tries to find python36. Why doesn't it look for 3.5?

Re: property += operator

2018-05-10 Thread SrMordred via Digitalmars-d-learn
On Thursday, 10 May 2018 at 19:41:41 UTC, Dlang User wrote: On 5/10/2018 1:43 PM, SrMordred wrote: [...] I am relatively new to D and I was under the impression that that was a limitation of @property functions. But, re-reading the language reference, it gave this example (it returns

Re: property += operator

2018-05-10 Thread Dlang User via Digitalmars-d-learn
On 5/10/2018 1:43 PM, SrMordred wrote: struct T {     int x;     @property ref X(){ return x; }     @property X(int v)     {     x = v;     } } T t; t.X += 10; The setter 'x = v' are not executed because i´m returning the reference of x. And without the 'ref' the compiler complains

Class member variable initialization vs. C++ initializer lists, and weirder classes

2018-05-10 Thread Evan via Digitalmars-d
A discussion came up on Reddit about C++'s initializer lists, and I realized I didn't really know what other languages in the same space do for member initialization. I'm not looking to start a language war here; I'm asking out of curiosity/general knowledge. I found a prior discussion on

Re: Extra .tupleof field in structs with disabled postblit blocks non-GC-allocation trait

2018-05-10 Thread Meta via Digitalmars-d-learn
On Thursday, 10 May 2018 at 12:55:36 UTC, Uknown wrote: On Thursday, 10 May 2018 at 11:06:06 UTC, Per Nordlöw wrote: On Wednesday, 9 May 2018 at 21:09:12 UTC, Meta wrote: It's a context pointer to the enclosing function/object/struct. Mark the struct as static to get rid of it. Ok, but why

Re: autowrap v0.0.1 - Automatically wrap existing D code for use in Python and Excel

2018-05-10 Thread Nikos via Digitalmars-d-announce
Interesting stuff. In http://code.dlang.org/packages/autowrap it says: """ Python versions Since autowrap depends on PyD, the python version must be explicitly stated as a dub configuration and defaults to 3.6. To use another version, pass -c $CONFIG to dub where $CONFIG is one of:

Re: Sealed classes - would you want them in D?

2018-05-10 Thread Jesse Phillips via Digitalmars-d
On Thursday, 10 May 2018 at 15:18:56 UTC, Bastiaan Veelo wrote: How about extending the behaviour of ‘private’, which means private except for this module, to ‘final’, which would then allow sub typing in the same module but not outside? It would not break any code. Are there downsides to

property += operator

2018-05-10 Thread SrMordred via Digitalmars-d-learn
struct T { int x; @property ref X(){ return x; } @property X(int v) { x = v; } } T t; t.X += 10; The setter 'x = v' are not executed because i´m returning the reference of x. And without the 'ref' the compiler complains because 'x' is not a lvalue. Any solution

Building dmd/druntime on windows issue

2018-05-10 Thread Andre Pany via Digitalmars-d-learn
Hi, I follow the instructions from the wiki to build dmd/druntime from source on windows. https://wiki.dlang.org/Building_under_Windows Building dmd ends with following text: --- copy ..\generated\windows\release\32\dmd.exe . 1 file copied. make -fwin32.mak

Re: Line breaks in JSON

2018-05-10 Thread bachmeier via Digitalmars-d-learn
On Thursday, 10 May 2018 at 17:59:26 UTC, jmh530 wrote: On Thursday, 10 May 2018 at 15:01:57 UTC, rikki cattermole wrote: [snip] You'll need to unescape them (which is pretty easy, a simple replacement here). For reference, this is invalid json[0]: ``` { "1 2 3 " }

[Issue 18850] New: Template overload incorrectly results in recursive expansion error

2018-05-10 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18850 Issue ID: 18850 Summary: Template overload incorrectly results in recursive expansion error Product: D Version: D2 Hardware: All OS: All Status: NEW

Re: Line breaks in JSON

2018-05-10 Thread jmh530 via Digitalmars-d-learn
On Thursday, 10 May 2018 at 15:01:57 UTC, rikki cattermole wrote: [snip] You'll need to unescape them (which is pretty easy, a simple replacement here). For reference, this is invalid json[0]: ``` { "1 2 3 " } ``` [0] https://jsonlint.com/ I don't see an unescape

Disabling copy constructor and passing as rvalue

2018-05-10 Thread ANtlord via Digitalmars-d-debugger
Hello, everyone! Short time ago I got a problem creating a container that is felt by structure instances of a structure type has disabled copy constructor. Actually it is felt by a rvalue instead of an instance. I realize that disabling of copying means denying to pass an instance by lvalue

[Issue 18743] ConditionalExpression and AssignExpression should require parentheses

2018-05-10 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18743 Nick Treleaven changed: What|Removed |Added Keywords||pull URL|

Re: Sealed classes - would you want them in D?

2018-05-10 Thread rikki cattermole via Digitalmars-d
On 11/05/2018 3:18 AM, Bastiaan Veelo wrote: On Thursday, 10 May 2018 at 13:22:20 UTC, Piotr Mitana wrote: Hello, I've recently thought of sealed classes (sealed as in Scala, not as in C#) and am thinking of writing a DIP for it. I decided to start this thread first though to gather some

Re: Line breaks in JSON

2018-05-10 Thread bachmeier via Digitalmars-d-learn
On Thursday, 10 May 2018 at 15:01:57 UTC, rikki cattermole wrote: You'll need to unescape them (which is pretty easy, a simple replacement here). For reference, this is invalid json[0]: ``` { "1 2 3 " } ``` [0] https://jsonlint.com/ So I see the answer is that I

[Issue 18176] std.numeric.gapWeightedSimilarity should be usable in @safe

2018-05-10 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18176 Jack Stouffer changed: What|Removed |Added CC||j...@jackstouffer.com

Re: Sealed classes - would you want them in D?

2018-05-10 Thread Bastiaan Veelo via Digitalmars-d
On Thursday, 10 May 2018 at 13:22:20 UTC, Piotr Mitana wrote: Hello, I've recently thought of sealed classes (sealed as in Scala, not as in C#) and am thinking of writing a DIP for it. I decided to start this thread first though to gather some opinions on the topic. For those who never

Re: Extend the call site default argument expansion mechanism?

2018-05-10 Thread Paul Backus via Digitalmars-d
On Thursday, 10 May 2018 at 14:37:00 UTC, rikki cattermole wrote: On 11/05/2018 2:33 AM, Yuxuan Shui wrote: On Thursday, 10 May 2018 at 14:28:39 UTC, JN wrote: But doing it with default argument expansion saves you 1 allocation, has 1 less type, while being just as readable. I think that's a

Re: Line breaks in JSON

2018-05-10 Thread rikki cattermole via Digitalmars-d-learn
On 11/05/2018 2:56 AM, bachmeier wrote: I'm using std.json for the first time. I want to download the contents of a markdown file from a web server. When I do that, the line breaks are escaped, which I don't want. Here's an example: import std.conv, std.json, std.stdio; void main() {

Re: Extend the call site default argument expansion mechanism?

2018-05-10 Thread Uknown via Digitalmars-d
On Thursday, 10 May 2018 at 14:37:00 UTC, rikki cattermole wrote: On 11/05/2018 2:33 AM, Yuxuan Shui wrote: On Thursday, 10 May 2018 at 14:28:39 UTC, JN wrote: On Thursday, 10 May 2018 at 14:15:18 UTC, Yuxuan Shui wrote: [...] But doing it with default argument expansion saves you 1

Line breaks in JSON

2018-05-10 Thread bachmeier via Digitalmars-d-learn
I'm using std.json for the first time. I want to download the contents of a markdown file from a web server. When I do that, the line breaks are escaped, which I don't want. Here's an example: import std.conv, std.json, std.stdio; void main() { string data = "This is a paragraph with

[Issue 18178] std.path should be usable in @safe

2018-05-10 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18178 --- Comment #1 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/f6e4416a72a778bc6cd21fbefb6e72bfd9fb2976 Fix Issue 18178 - std.path should be usable in @safe

[Issue 18110] most of phobos should be @safe-ly useable

2018-05-10 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18110 Issue 18110 depends on issue 18178, which changed state. Issue 18178 Summary: std.path should be usable in @safe https://issues.dlang.org/show_bug.cgi?id=18178 What|Removed |Added

Re: Sealed classes - would you want them in D?

2018-05-10 Thread rikki cattermole via Digitalmars-d
On 11/05/2018 2:43 AM, jmh530 wrote: On Thursday, 10 May 2018 at 13:47:16 UTC, rikki cattermole wrote: [snip] Adding a keyword like sealed isn't desirable. I'm trying to find fault of the concept, but it definitely is tough. You basically want protected, but only for specific packages,

Re: Sealed classes - would you want them in D?

2018-05-10 Thread jmh530 via Digitalmars-d
On Thursday, 10 May 2018 at 13:47:16 UTC, rikki cattermole wrote: [snip] Adding a keyword like sealed isn't desirable. I'm trying to find fault of the concept, but it definitely is tough. You basically want protected, but only for specific packages, otherwise final. protected(foo, final)

Re: Extend the call site default argument expansion mechanism?

2018-05-10 Thread rikki cattermole via Digitalmars-d
On 11/05/2018 2:33 AM, Yuxuan Shui wrote: On Thursday, 10 May 2018 at 14:28:39 UTC, JN wrote: On Thursday, 10 May 2018 at 14:15:18 UTC, Yuxuan Shui wrote: [...] For things like this you can use the OOP Factory pattern, pseudocode: class DataStructureFactory {   this(Allocator alloc)   {    

Re: Extend the call site default argument expansion mechanism?

2018-05-10 Thread Yuxuan Shui via Digitalmars-d
On Thursday, 10 May 2018 at 14:30:49 UTC, Seb wrote: On Thursday, 10 May 2018 at 14:15:18 UTC, Yuxuan Shui wrote: So in D I can use default argument like this: int f(int line=__LINE__) {} [...] Why not define a TLS or global variable like theAllocator? Or if you know it at compile-time as

Re: Extend the call site default argument expansion mechanism?

2018-05-10 Thread Yuxuan Shui via Digitalmars-d
On Thursday, 10 May 2018 at 14:28:39 UTC, JN wrote: On Thursday, 10 May 2018 at 14:15:18 UTC, Yuxuan Shui wrote: [...] For things like this you can use the OOP Factory pattern, pseudocode: class DataStructureFactory { this(Allocator alloc) { this.alloc = alloc; } Allocator

Re: Extend the call site default argument expansion mechanism?

2018-05-10 Thread Seb via Digitalmars-d
On Thursday, 10 May 2018 at 14:15:18 UTC, Yuxuan Shui wrote: So in D I can use default argument like this: int f(int line=__LINE__) {} [...] Why not define a TLS or global variable like theAllocator? Or if you know it at compile-time as an alias?

Re: Extend the call site default argument expansion mechanism?

2018-05-10 Thread JN via Digitalmars-d
On Thursday, 10 May 2018 at 14:15:18 UTC, Yuxuan Shui wrote: So in D I can use default argument like this: int f(int line=__LINE__) {} And because default argument is expanded at call site, f() will be called with the line number of the call site. This is a really clever feature, and I

Re: Extend the call site default argument expansion mechanism?

2018-05-10 Thread rikki cattermole via Digitalmars-d
On 11/05/2018 2:20 AM, Yuxuan Shui wrote: On Thursday, 10 May 2018 at 14:17:50 UTC, rikki cattermole wrote: On 11/05/2018 2:15 AM, Yuxuan Shui wrote: [...] Bad idea, too much magic. This magic is already there in D. I just want to use it in a different way. The magic is not already in

Re: Extend the call site default argument expansion mechanism?

2018-05-10 Thread Yuxuan Shui via Digitalmars-d
On Thursday, 10 May 2018 at 14:17:50 UTC, rikki cattermole wrote: On 11/05/2018 2:15 AM, Yuxuan Shui wrote: [...] Bad idea, too much magic. This magic is already there in D. I just want to use it in a different way.

Extend the call site default argument expansion mechanism?

2018-05-10 Thread Yuxuan Shui via Digitalmars-d
So in D I can use default argument like this: int f(int line=__LINE__) {} And because default argument is expanded at call site, f() will be called with the line number of the call site. This is a really clever feature, and I think a similar feature can be useful in other ways. Say I need

Re: Extend the call site default argument expansion mechanism?

2018-05-10 Thread rikki cattermole via Digitalmars-d
On 11/05/2018 2:15 AM, Yuxuan Shui wrote: So in D I can use default argument like this: int f(int line=__LINE__) {} And because default argument is expanded at call site, f() will be called with the line number of the call site. This is a really clever feature, and I think a similar feature

Re: Sealed classes - would you want them in D?

2018-05-10 Thread rikki cattermole via Digitalmars-d
On 11/05/2018 1:22 AM, Piotr Mitana wrote: Hello, I've recently thought of sealed classes (sealed as in Scala, not as in C#) and am thinking of writing a DIP for it. I decided to start this thread first though to gather some opinions on the topic. For those who never coded Scala and don't

Re: Package method is not virtual and cannot override - a bug or a feature?

2018-05-10 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, May 10, 2018 11:52:38 Piotr Mitana via Digitalmars-d-learn wrote: > Given this code: > > abstract class A > { > package @property void x(int x); > package @property int x(); > } > > class B : A > { > package @property override void x(int x) {} > package @property

Re: mofile - gettext library for D

2018-05-10 Thread Bastiaan Veelo via Digitalmars-d-announce
On Thursday, 10 May 2018 at 10:57:25 UTC, FreeSlave wrote: It was a real concern for me that there's no gettext-compatible package for D (at least I could not find one in dub registry), because it's kind of standard. So I made it myself. mofile is similar to GNU gettext, but gettext and

Sealed classes - would you want them in D?

2018-05-10 Thread Piotr Mitana via Digitalmars-d
Hello, I've recently thought of sealed classes (sealed as in Scala, not as in C#) and am thinking of writing a DIP for it. I decided to start this thread first though to gather some opinions on the topic. For those who never coded Scala and don't know sealed classes: a sealed class is a

[Issue 18848] std.allocator: Regions are non-copyable, yet are passed around in examples

2018-05-10 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18848 Andrei Alexandrescu changed: What|Removed |Added Assignee|nob...@puremagic.com|edi33...@gmail.com

[Issue 18849] std.allocator: AllocatorList uses deallocate and ignores return value in deallocateAll

2018-05-10 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18849 Andrei Alexandrescu changed: What|Removed |Added Assignee|nob...@puremagic.com|edi33...@gmail.com

Re: Extra .tupleof field in structs with disabled postblit blocks non-GC-allocation trait

2018-05-10 Thread Uknown via Digitalmars-d-learn
On Thursday, 10 May 2018 at 11:06:06 UTC, Per Nordlöw wrote: On Wednesday, 9 May 2018 at 21:09:12 UTC, Meta wrote: It's a context pointer to the enclosing function/object/struct. Mark the struct as static to get rid of it. Ok, but why an extra void* for `S.tupleof` and not for `T.tupleof`

Package method is not virtual and cannot override - a bug or a feature?

2018-05-10 Thread Piotr Mitana via Digitalmars-d-learn
Given this code: abstract class A { package @property void x(int x); package @property int x(); } class B : A { package @property override void x(int x) {} package @property override int x() { return 0; } } void main() {} I get the following message: onlineapp.d(9): Error:

[Issue 18849] std.allocator: AllocatorList uses deallocate and ignores return value in deallocateAll

2018-05-10 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18849 Vladimir Panteleev changed: What|Removed |Added CC|

[Issue 18849] New: std.allocator: AllocatorList uses deallocate and ignores return value in deallocateAll

2018-05-10 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18849 Issue ID: 18849 Summary: std.allocator: AllocatorList uses deallocate and ignores return value in deallocateAll Product: D Version: D2 Hardware: All OS: All

[Issue 18848] New: std.allocator: Regions are non-copyable, yet are passed around in examples

2018-05-10 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18848 Issue ID: 18848 Summary: std.allocator: Regions are non-copyable, yet are passed around in examples Product: D Version: D2 Hardware: All OS: All

Re: Binderoo additional language support?

2018-05-10 Thread jmh530 via Digitalmars-d
On Thursday, 10 May 2018 at 07:42:36 UTC, Laeeth Isharc wrote: I made a start at writing a Jupyter library for writing kernels in D. Not sure how long it will be till its finished, but it is something in time we will need. Note that one would then need to write a D kernel on top, but that

Re: DConf 2018 Livestream

2018-05-10 Thread David Nadlinger via Digitalmars-d-announce
On Thursday, 10 May 2018 at 09:11:20 UTC, Walter Bright wrote: This isn't the only time videos of my talks (and others) have been lost due to technical problems or simple screwups. I'm tired of this happening. One hopes that the contract with the respective company providing A/V services

Re: Extra .tupleof field in structs with disabled postblit blocks non-GC-allocation trait

2018-05-10 Thread Per Nordlöw via Digitalmars-d-learn
On Wednesday, 9 May 2018 at 21:09:12 UTC, Meta wrote: It's a context pointer to the enclosing function/object/struct. Mark the struct as static to get rid of it. Ok, but why an extra void* for `S.tupleof` and not for `T.tupleof` which is also scoped inside a unittest?

Re: mofile - gettext library for D

2018-05-10 Thread Andrea Fontana via Digitalmars-d-announce
On Thursday, 10 May 2018 at 10:57:25 UTC, FreeSlave wrote: It was a real concern for me that there's no gettext-compatible package for D (at least I could not find one in dub registry), because it's kind of standard. So I made it myself. mofile is similar to GNU gettext, but gettext and

mofile - gettext library for D

2018-05-10 Thread FreeSlave via Digitalmars-d-announce
It was a real concern for me that there's no gettext-compatible package for D (at least I could not find one in dub registry), because it's kind of standard. So I made it myself. mofile is similar to GNU gettext, but gettext and ngettext functions are implemented as member functions of MoFile

[Issue 18847] New: std.allocator: Region uses .parent before it can be set

2018-05-10 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18847 Issue ID: 18847 Summary: std.allocator: Region uses .parent before it can be set Product: D Version: D2 Hardware: All OS: All Status: NEW

[DUB][DLS] building package dls doesn't finish

2018-05-10 Thread Kamil Koczurek via Digitalmars-d
Hello, I installed an atom extension for D support, but it requires dls package to be installed and built. When I fetch and attempt to build it (with --build=release) it just says that it's building and doesn't change even if I leave it running for several hours. What can I do to fix it? Or

Re: DConf 2018 Livestream

2018-05-10 Thread rikki cattermole via Digitalmars-d-announce
On 10/05/2018 9:11 PM, Walter Bright wrote: On 5/3/2018 2:23 AM, Mike Parker wrote: Yes, unfortunately some of the videos were lost. We should be good from here on out. I gave the same talk again at Code Europe in Krakow. The video for that should appear on youtube in a month. This isn't

Re: DConf 2018 Livestream

2018-05-10 Thread Walter Bright via Digitalmars-d-announce
On 5/3/2018 2:23 AM, Mike Parker wrote: Yes, unfortunately some of the videos were lost. We should be good from here on out. I gave the same talk again at Code Europe in Krakow. The video for that should appear on youtube in a month. This isn't the only time videos of my talks (and others)

Re: A bit more Emscripten

2018-05-10 Thread Vladimir Panteleev via Digitalmars-d-announce
On Tuesday, 8 May 2018 at 08:53:36 UTC, Vladimir Panteleev wrote: https://github.com/CyberShadow/dscripten-tools Progress update: - std.stdio.writeln() works - Using a D main() works (though unittests and static constructors still don't) - WebAssembly output works! - std.allocator works (at

Re: Binderoo additional language support?

2018-05-10 Thread Laeeth Isharc via Digitalmars-d
On Thursday, 10 May 2018 at 02:39:41 UTC, Paul O'Neil wrote: On 05/09/2018 03:50 PM, Ethan wrote: On Tuesday, 8 May 2018 at 14:28:53 UTC, jmh530 wrote: I don't really understand what to use binderoo for. So rather than fill out the questionnaire, maybe I would just recommend you do some work

Re: D GPU execution module: A survey of requirements.

2018-05-10 Thread Nicholas Wilson via Digitalmars-d
On Thursday, 10 May 2018 at 00:10:07 UTC, H Paterson wrote: On Wednesday, 9 May 2018 at 23:37:14 UTC, Henry Gouk wrote: On Wednesday, 9 May 2018 at 23:26:19 UTC, H Paterson wrote: Hello, I'm interested in writing a module for executing D code on GPUs. I'd like to bounce some ideas off D

Re: Error: module `hello` is in file 'hello.d' which cannot be read

2018-05-10 Thread phongkhamdakhoathegioi via Digitalmars-d-learn
On Saturday, 5 May 2018 at 10:39:17 UTC, Alex wrote: Thank you for you for your quick answer. I think I allready tryed this, before asking, but ... C:\>cd D\dmd2\sources C:\D\dmd2\sources>dmd hello.d Error: module `hello` is in file 'hello.d' which cannot be read import path[0] =

[Issue 15099] C++ projects depend on D projects?

2018-05-10 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15099 Manu changed: What|Removed |Added Status|NEW |RESOLVED Resolution|---

Re: `this` and nested structs

2018-05-10 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, May 10, 2018 06:31:09 Mike Franklin via Digitalmars-d-learn wrote: > On Thursday, 10 May 2018 at 06:22:37 UTC, Jonathan M Davis wrote: > > Structs don't have that. > > Should they? Honestly, I don't think that classes should have it, but changing it now would break code (most

  1   2   >