Re: Dynamically Sized Structs

2014-04-17 Thread Dicebot via Digitalmars-d-learn
On Thursday, 17 April 2014 at 18:29:21 UTC, Kagamin wrote: How is this different from my example? b = new byte[StateImpl.sizeof + CellIndex.sizeof*cellCount]; this line creates heap indirection

Re: Throw exception on segmentation fault in GNU/Linux

2014-04-22 Thread Dicebot via Digitalmars-d-learn
On Tuesday, 22 April 2014 at 09:58:45 UTC, ilya-stromberg wrote: What should I add in the D program in GNU/Linux to throw exception if I have segmentation fault error? I read somewhere that it's possible, but I don't know how to do it. etc.linux.memoryerror Just remember that it is more of

Re: Throw exception on segmentation fault in GNU/Linux

2014-04-22 Thread Dicebot via Digitalmars-d-learn
On Tuesday, 22 April 2014 at 15:47:37 UTC, ilya-stromberg wrote: On Tuesday, 22 April 2014 at 14:49:58 UTC, Dicebot wrote: On Tuesday, 22 April 2014 at 09:58:45 UTC, ilya-stromberg wrote: What should I add in the D program in GNU/Linux to throw exception if I have segmentation fault error? I

Re: Inherit of attributes

2014-04-25 Thread Dicebot via Digitalmars-d-learn
On Friday, 25 April 2014 at 09:08:50 UTC, Temtaime wrote: Hi, MrSmith ! Yes, i know that, but my question isn't about it. I want to type `pure:` at module's beginning and have all function(in classes, too) declared as pure. I think `pure:` should do it. But it doesn't. pure is not a

Re: Const Tuples

2014-04-25 Thread Dicebot via Digitalmars-d-learn
On Friday, 25 April 2014 at 11:51:48 UTC, bearophile wrote: They are not the same type: void main() { import std.typecons: Tuple; alias T1 = const Tuple!(int, int); alias T2 = Tuple!(const int, const int); static assert(is(T1 == T2)); // Fails. } This type difference causes

Re: Const Tuples

2014-04-25 Thread Dicebot via Digitalmars-d-learn
On Friday, 25 April 2014 at 12:17:31 UTC, bearophile wrote: In general a tuple is a higher level data structure compared to a struct. So it's not unreasonable to expect a Tuple to be more flexible than a struct. Well, wrong :) std.typecons.Tuple IS a struct -

Re: Const Tuples

2014-04-25 Thread Dicebot via Digitalmars-d-learn
On Friday, 25 April 2014 at 12:42:33 UTC, bearophile wrote: Dicebot: Well, wrong :) std.typecons.Tuple IS a struct - https://github.com/D-Programming-Language/phobos/blob/master/std/typecons.d#L388 Nope, that's just an implementation detail. They are two quite different data structures.

Re: Const Tuples

2014-04-25 Thread Dicebot via Digitalmars-d-learn
On Friday, 25 April 2014 at 12:54:25 UTC, bearophile wrote: Dicebot: std.typecons.Tuple is just a subset of all structs implementing specific behavior. It still acts as struct everywhere when applicable. A subset is not the same as the whole set. You are missing something important about

Re: Const Tuples

2014-04-25 Thread Dicebot via Digitalmars-d-learn
On Friday, 25 April 2014 at 13:18:13 UTC, bearophile wrote: Dicebot: It would be weird exception of general type system rules with no practical justification I can readily imagine. I partially disagree. It could be useful to have structural typing

Re: @nogc and lazy arguments

2014-04-27 Thread Dicebot via Digitalmars-d-learn
On Sunday, 27 April 2014 at 13:09:39 UTC, bearophile wrote: Lazy arguments in general allocate, but who is to blame for the allocation? Isn't the allocation at the calling point? This code: void foo(lazy int x) @nogc { auto r = x(); // Error } void main() { foo(1); } Gives:

Re: How to use the result of __traits( allMembers , T ) with string mixins ?

2014-04-28 Thread Dicebot via Digitalmars-d-learn
On Monday, 28 April 2014 at 17:40:54 UTC, Philippe Sigaud via Digitalmars-d-learn wrote: On Mon, Apr 28, 2014 at 5:45 PM, Andrej Mitrovic via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: If you need to store the tuple as an array to some variable, then you would use that

Re: private constructors and inheritance

2014-04-29 Thread Dicebot via Digitalmars-d-learn
http://dlang.org/class.html#constructors If no call to constructors via this or super appear in a constructor, and the base class has a constructor, a call to super() is inserted at the beginning of the constructor. The fact that call to base constructor is not inserted into templated

Re: private constructors and inheritance

2014-04-29 Thread Dicebot via Digitalmars-d-learn
On Tuesday, 29 April 2014 at 18:51:15 UTC, ketmar via Digitalmars-d-learn wrote: On Tue, 29 Apr 2014 13:59:28 + John Colvin via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: Can someone explain why this can't/doesn't work? Thanks. hm. why it should? there is no 'default'

Re: C++ std::map equivalent? (An in-order iterable associative container)

2014-05-04 Thread Dicebot via Digitalmars-d-learn
On Sunday, 4 May 2014 at 21:40:04 UTC, bearophile wrote: Mark Isaacson: 2) Create a wrapper struct that contains key and value and whose comparison operator is defined only on the key. This would essentially be doing what the C++ implementation does. Until we have a tree-based associative

Re: C++ std::map equivalent? (An in-order iterable associative container)

2014-05-04 Thread Dicebot via Digitalmars-d-learn
On Sunday, 4 May 2014 at 22:25:36 UTC, bearophile wrote: Dicebot: What benefits this gives over definining distinct struct? Sounds like unnecessary complication for me. See the code in my precedent post, what do you think about it? Bye, bearophile Change alias Two =

Re: [Rosettacode] D code line length limit

2014-05-08 Thread Dicebot via Digitalmars-d-learn
On Thursday, 8 May 2014 at 14:34:27 UTC, H. S. Teoh via Digitalmars-d-learn wrote: FWIW, for very long function signatures I write it this way: const(T)[] myVeryLongFunction(T)(const(T)[] arr, intx,

Re: D Newbie Trying to Use D with Major C Libraries

2014-05-16 Thread Dicebot via Digitalmars-d-learn
On Friday, 16 May 2014 at 19:05:25 UTC, Tom Browder via Digitalmars-d-learn wrote: On Fri, May 16, 2014 at 1:05 PM, Gary Willoughby via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: ... Then take a look at one of my projects in which i've ported C headers to D.

Re: Is it possible to assumeSafeAppend malloced memory?

2014-05-19 Thread Dicebot via Digitalmars-d-learn
On Monday, 19 May 2014 at 13:44:45 UTC, monarch_dodra wrote: Recently, a new function in druntime was added: _d_newarrayU. This void allocates a new array *with* appendable information. We can hope it will be given a more formal and public interface, and it would then be useable by array

Re: Is it possible to assumeSafeAppend malloced memory?

2014-05-19 Thread Dicebot via Digitalmars-d-learn
On Monday, 19 May 2014 at 21:01:52 UTC, monarch_dodra wrote: Huh, will it also make possible to call `realloc` if capacity is exceeded? AFAIK, using the GC.realloc (or GC.extent) function on it directly would not work. This may or may not be an issue with how GC.realloc is designed. The

Re: @safe @nogc memory allocation

2014-05-28 Thread Dicebot via Digitalmars-d-learn
On Wednesday, 28 May 2014 at 20:51:08 UTC, Nordlöw wrote: malloc? There's no wrapper around it though, like there is for uninitializedArray. Is the fact that malloc() can't be pure when new is a limitiation in the type system? Do we need a yet another code tag for this? /Per It is also

Re: @safe @nogc memory allocation

2014-05-28 Thread Dicebot via Digitalmars-d-learn
On Wednesday, 28 May 2014 at 21:09:26 UTC, bearophile wrote: Dicebot: It is also because `malloc` can return null when out of memory and `new` will throw an Error. Wrapper around `malloc` that throws `OutOfMemoryError` on null can be considered of same purity class as `new`. One wrapper

Re: @safe @nogc memory allocation

2014-05-28 Thread Dicebot via Digitalmars-d-learn
On Wednesday, 28 May 2014 at 21:31:41 UTC, Nordlöw wrote: It is also because `malloc` can return null when out of memory and `new` will throw an Error. Wrapper around `malloc` that throws `OutOfMemoryError` on null can be considered of same purity class as `new`. Does this mean that I should

Re: Examining Members of a module at Compile Time

2014-05-29 Thread Dicebot via Digitalmars-d-learn
class Test {} class TestChild: Test {} class TestChildChild: TestChild {} alias Alias(alias Symbol) = Symbol; // this does the trick void main() { foreach (item; __traits(allMembers, mixin(__MODULE__))) { alias sym = Alias!(__traits(getMember, mixin(__MODULE__), item));

Re: Differences between const Type function() and const(Type) function()

2014-05-30 Thread Dicebot via Digitalmars-d-learn
On Friday, 30 May 2014 at 12:35:46 UTC, francesco cattoglio wrote: Today I got the following compile error: Cannot implicitly convert expression (blabla) of type const(Type) to Type and this is a reduced example ( also on http://dpaste.dzfl.pl/f2f3bd921989): module test; import std.stdio;

Re: Hiding types

2014-05-30 Thread Dicebot via Digitalmars-d-learn
private in D does not provide any strong guarantees, it only controls direct access to the symbol. You effectively want some sort of strict internal linkage attribute which does not exist in D.

Re: Different random shuffles generated when compiled with gdc than with dmd

2014-05-31 Thread Dicebot via Digitalmars-d-learn
On Saturday, 31 May 2014 at 06:54:13 UTC, Russel Winder via Digitalmars-d-learn wrote: On Fri, 2014-05-30 at 16:44 +, Andrew Brown via Digitalmars-d-learn wrote: GDC version 4.8.2,i guess that's my problem. This is what happens when you let Ubuntu look after your packages. Debian Sid

Re: Indicating incompatible modules

2014-05-31 Thread Dicebot via Digitalmars-d-learn
On Saturday, 31 May 2014 at 16:34:00 UTC, Joseph Rushton Wakeling via Digitalmars-d-learn wrote: Hello all, Is there a straightforward way to indicate that two modules should not be used together in the same program? Preferably one that does not require editing both of the modules? The

Re: installing Mango with DMD instead of ldc

2014-06-02 Thread Dicebot via Digitalmars-d-learn
On Monday, 26 May 2014 at 15:42:56 UTC, JJDuck wrote: On Monday, 26 May 2014 at 15:41:03 UTC, bioinfornatics wrote: On Monday, 26 May 2014 at 15:33:45 UTC, JJDuck wrote: vibe.d is root an open-source project ? on about page is wrote is licensed under MIT which are an open source license.

Re: Don't Understand why Phobos Auto-Tester fails for PR #3606

2014-06-07 Thread Dicebot via Digitalmars-d-learn
On Saturday, 7 June 2014 at 09:19:55 UTC, Jonathan M Davis via Digitalmars-d-learn wrote: Also, you're probably going to need to use DMD= to set dmd to the one that you built in order to use the one that you built when building druntime and Phobos instead of the one you installed normally and

Re: Class Data Members Name Reflection

2014-06-10 Thread Dicebot via Digitalmars-d-learn
On Tuesday, 10 June 2014 at 16:10:09 UTC, Nordlöw wrote: Is there a way to iterate over the symbolic names of the data members of a class instance? I'm currently using .tupleof to get its values (and in turn types) to implement pretty printing to multiple backends (currently testing HTML)

Re: Core dump with dstep on 64-bit Linux (Debian 7): testers needed

2014-06-12 Thread Dicebot via Digitalmars-d-learn
confirmed and commmented in that issue

Re: using regex at compiletime

2014-06-15 Thread Dicebot via Digitalmars-d-learn
AFAIK you can _generate_ regex at compile-time but not actually use it.

Re: Is it normal that unittests of phobos are executed with my project build?

2014-06-16 Thread Dicebot via Digitalmars-d-learn
On Saturday, 14 June 2014 at 14:32:10 UTC, Xavier Bigand wrote: I get a failure on a test in format.d when I build my own project with unittest. I though importing phobos header would not regenerate their unittest modules. Any idea of what can cause this issue? I already have reinstalled dmd

Re: Struct Constructors

2014-06-16 Thread Dicebot via Digitalmars-d-learn
On Monday, 16 June 2014 at 22:03:28 UTC, Mark Blume wrote: Why exactly isn't a constructor without any parameters is not allowed? Why does Struct() calls Struct.opCall(), which means Struct.init initially, while Struct(params) calls Struct.this(params)? Does Struct(params) also call

Re: Some kind of RPC exists for D?

2014-06-19 Thread Dicebot via Digitalmars-d-learn
On Thursday, 19 June 2014 at 10:25:08 UTC, Bienlein wrote: vibe.web.rest server/client combo is effectively RPC over HTTP/json This looks good. For what am I'm thinking of doing performance is important. In that way rest makes me think a bit or is this only a prejudice from the Java world?

Re: Some kind of RPC exists for D?

2014-06-19 Thread Dicebot via Digitalmars-d-learn
On Thursday, 19 June 2014 at 13:54:01 UTC, David Nadlinger wrote: On Thursday, 19 June 2014 at 12:13:12 UTC, Dicebot wrote: However if you application design implies thousands of RPC calls per second it is quite likely performance won't be good with any RPC implementation :) Backend people

Re: Some kind of RPC exists for D?

2014-06-20 Thread Dicebot via Digitalmars-d-learn
On Friday, 20 June 2014 at 08:05:01 UTC, Bienlein wrote: What data load profile do you expect? Vibe is tuned to handle thousands simultaneous incoming light requests (milliseconds), while distributed computing works better with exclusive heavy requests, at least minutes of work worth, BOINC

Re: C structs

2014-06-20 Thread Dicebot via Digitalmars-d-learn
By D specification you are always required to compiled all imported modules, it does not matter if those contain only definitions. Some of implicitly generated symbols (like T.init) will be in their object files.

Re: C structs

2014-06-20 Thread Dicebot via Digitalmars-d-learn
On Friday, 20 June 2014 at 12:17:22 UTC, Johann Lermer wrote: Agreed, but I assumed, that since all definitions in cairo.d are defined as extern (System), (same happens with extern (C), btw.), I would have expected, that D does not implicitly generate initialisation functions. D requires

Re: template mixins for boilerplate

2014-06-21 Thread Dicebot via Digitalmars-d-learn
On Saturday, 21 June 2014 at 13:45:14 UTC, Philippe Sigaud via Digitalmars-d-learn wrote: Out of curiosity, why use a mixin template containing a string mixin instead of, well, directly injecting a string mixin in your struct, with a function? Hiding non-hygienic implementation behind a more

Re: template mixins for boilerplate

2014-06-21 Thread Dicebot via Digitalmars-d-learn
Apart from what Artur has mentioned template mixins also give you opportunity to do qualified injection in case generated symbols conflict with existing ones: class A { void foo() {} mixin(void foo() {}); // error, need to add manual namespace wrapper mixin func!foo Sub; // does

Re: break on assertion in GDB?

2014-06-30 Thread Dicebot via Digitalmars-d-learn
On Monday, 30 June 2014 at 11:56:27 UTC, Vlad Levenfeld wrote: Is this possible? I find myself having to set breakpoints up the callchain and step through every invocation till I find the one that breaks. This is a really bad way to work, but when I fail an assertion in GDB, it just reports

Re: overloading InExpression

2014-07-02 Thread Dicebot via Digitalmars-d-learn
struct S { int opIn_r(int key) { return key*2; } } void main() { assert((42 in S.init) == 84); }

Re: overloading InExpression

2014-07-02 Thread Dicebot via Digitalmars-d-learn
On Wednesday, 2 July 2014 at 15:36:23 UTC, Kozzi11 wrote: Thanks! I wonder, why the _r and lack of documentation? Maybe something from old days? But in current a href=http://dlang.org/operatoroverloading.html#Binary; target=_blankdoc/a there is a opBinary: Yep, I think it is D1 legacy

Re: Introspecting a Module with Traits, allMembers

2014-07-09 Thread Dicebot via Digitalmars-d-learn
On Wednesday, 9 July 2014 at 20:52:29 UTC, Maxime Chevalier-Boisvert wrote: It's a bit of a hack, but it works. Is there any way to create some sort of alias for __traits(getMember, ir.ops, memberName) so that I don't have to write it out in full twice? Made some attempts but only got the

Re: Question about @nogc in D 2.066

2014-07-11 Thread Dicebot via Digitalmars-d-learn
On Friday, 11 July 2014 at 21:02:30 UTC, Timon Gehr wrote: He is allocating an immutable(int)[] here. There is no reason why it should allocate unless providing different addresses for different runs of the code is considered a feature, as the literal has a compile-time known value. It's just

Re: DStyle: Braces on same line

2014-07-12 Thread Dicebot via Digitalmars-d-learn
On Saturday, 12 July 2014 at 19:01:56 UTC, Danyal Zia wrote: Should I worry about it? Or is that's just a debatable style that won't really matter if it's persistent throughout library? Depends entirely on whenever you want to match style of standard library - no one will blame you for having

Re: linux n00b

2014-07-13 Thread Dicebot via Digitalmars-d-learn
On Sunday, 13 July 2014 at 13:38:34 UTC, Xiaoxi wrote: If I want to build a d program which works on all dists, can i build that from any linux machine since dmd links statically by default or should I chose the oldest, i.e rhel5 to build on? because of possible glibc issues? Using machine

Re: DStyle: Braces on same line

2014-07-13 Thread Dicebot via Digitalmars-d-learn
On Sunday, 13 July 2014 at 16:47:00 UTC, Joseph Rushton Wakeling via Digitalmars-d-learn wrote: On 13/07/14 14:23, Danyal Zia via Digitalmars-d-learn wrote: I'm going with Andrei's style of preference on his talks ;) Andrei can no doubt speak for himself about his preferences, but I'd be

Re: DStyle: Braces on same line

2014-07-14 Thread Dicebot via Digitalmars-d-learn
On Sunday, 13 July 2014 at 17:24:40 UTC, Timon Gehr wrote: but separate-line opening braces definitely make it easier to see where scopes begin and end. This is the only argument I have heard in favour of doing this, but it is not actually valid. This critique might apply to Lisp style. It

Re: Implement Interface dynamically

2014-07-14 Thread Dicebot via Digitalmars-d-learn
http://dlang.org/phobos/std_typecons.html#.BlackHole http://dlang.org/phobos/std_typecons.html#.WhiteHole http://dlang.org/phobos/std_typecons.html#.AutoImplement ?

Re: Compile-Time Interfaces (Concepts)

2014-07-17 Thread Dicebot via Digitalmars-d-learn
..and call it mixin interface :P

Re: Dump mixins (preprocessed/generated) code

2014-07-18 Thread Dicebot via Digitalmars-d-learn
While `static if` false branch does not get compiled or semantically evaluated it still should have a valid syntax. __FUNCTION__ gets replaced with a fully qualified name of a function which has dot inside - illegal identifier for a variable. This causes parser to freak out.

Re: Code spliting in module and packages

2014-07-21 Thread Dicebot via Digitalmars-d-learn
On Monday, 21 July 2014 at 18:02:33 UTC, bearophile wrote: Dicebot: Probably most idiomatic D way is to use files _instead_ of classes :) It is a bit idealistic though and is not yet 100% feasible in practice. What's stopping it from being feasible? Bye, bearophile Stuff like this :

Re: Building SDC from source

2014-07-27 Thread Dicebot via Digitalmars-d-learn
Is shared Phobos library in /opt/dmd known do ldconfig? Can you build a sample hello world program with -defaultlib=libphobos.so ?

Re: Building SDC from source

2014-07-27 Thread Dicebot via Digitalmars-d-learn
On Sunday, 27 July 2014 at 14:44:29 UTC, Joseph Rushton Wakeling via Digitalmars-d-learn wrote: Adding a dlang.conf file in /etc/ld.so.conf.d/ which adds the /opt/dmd/lib64 path solves things. One of many reasons why you don't usually want to circumvent package management system ;)

Re: monodevelop mono-d versions

2014-08-01 Thread Dicebot via Digitalmars-d-learn
On Friday, 1 August 2014 at 09:12:49 UTC, sclytrack wrote: I can't seem to install mono-d. It always seems to want a newer version of MonoDevelop. I'm on Ubuntu 14.04 LTS and it has version 4.0.12 of MonoDevelop. Has anybody else got this to work with this version? I have this file called

Re: monodevelop mono-d versions

2014-08-01 Thread Dicebot via Digitalmars-d-learn
On Friday, 1 August 2014 at 13:35:52 UTC, Colin wrote: Which is a pity, as it's otherwise a pretty nice IDE. Still, vim with NERDTree + dub on the command line. What more do you need? DCD vim plugin ;) https://github.com/Hackerpilot/DCD

Re: Threadpools, difference between DMD and LDC

2014-08-04 Thread Dicebot via Digitalmars-d-learn
On Monday, 4 August 2014 at 05:14:22 UTC, Philippe Sigaud via Digitalmars-d-learn wrote: I have another question: it seems I can spawn hundreds of threads (Heck, even 10_000 is accepted), even when I have 4-8 cores. Is there: is there a limit to the number of threads? I tried a threadpool

Re: Threadpools, difference between DMD and LDC

2014-08-04 Thread Dicebot via Digitalmars-d-learn
On Monday, 4 August 2014 at 12:05:31 UTC, Philippe Sigaud via Digitalmars-d-learn wrote: IIRC, there are fibers somewhere in core, I'll have a look. I also heard the vibe.d has them. http://dlang.org/phobos/core_thread.html#.Fiber vibe.d adds some own abstraction on top, for example Task

Re: Threadpools, difference between DMD and LDC

2014-08-04 Thread Dicebot via Digitalmars-d-learn
On Monday, 4 August 2014 at 14:56:36 UTC, Philippe Sigaud via Digitalmars-d-learn wrote: On Mon, Aug 4, 2014 at 3:36 PM, Dicebot via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: Most likely those threads either do nothing or are short living so you don't get actually 10 000

Re: Threadpools, difference between DMD and LDC

2014-08-04 Thread Dicebot via Digitalmars-d-learn
On Monday, 4 August 2014 at 16:38:24 UTC, Russel Winder via Digitalmars-d-learn wrote: Modern default approach is to have amount of worker threads identical or close to amount of CPU cores and handle internal scheduling manually via fibers or some similar solution. I have no current data, but

Re: Threadpools, difference between DMD and LDC

2014-08-04 Thread Dicebot via Digitalmars-d-learn
On Monday, 4 August 2014 at 18:22:47 UTC, Russel Winder via Digitalmars-d-learn wrote: Actually with CSP / actor model one can simply consider long-running CPU computation as form of I/O an apply same asynchronous design techniques. For example, have separate dedicated thread running the

Re: Threadpools, difference between DMD and LDC

2014-08-04 Thread Dicebot via Digitalmars-d-learn
On Monday, 4 August 2014 at 21:19:14 UTC, Philippe Sigaud via Digitalmars-d-learn wrote: Has anyone used (the fiber/taks of) vibe.d for something other than powering websites? Atila has implemented MQRR broker with it : https://github.com/atilaneves/mqtt It it still networking application

Re: extern (C++, N) is it implemented?

2014-08-06 Thread Dicebot via Digitalmars-d-learn
On Wednesday, 6 August 2014 at 06:50:59 UTC, Alexandr Druzhinin wrote: This dlang.org/cpp_interface.html says I can do the following // c++ namespace N { void someCppFunction(); } // d extern (C++, N) void someCppFunction(); but this http://dpaste.dzfl.pl/e2242263e1dc says I can't Is

Re: private selective imports

2014-08-06 Thread Dicebot via Digitalmars-d-learn
Most voted DMD bug : https://issues.dlang.org/show_bug.cgi?id=314

Re: private selective imports

2014-08-06 Thread Dicebot via Digitalmars-d-learn
On Wednesday, 6 August 2014 at 19:31:04 UTC, Jonathan M Davis wrote: On Wednesday, 6 August 2014 at 18:33:23 UTC, Dicebot wrote: Most voted DMD bug : https://issues.dlang.org/show_bug.cgi?id=314 Yeah, it's why I'd suggest that folks not use selective imports right now. But people seem to

Re: private selective imports

2014-08-06 Thread Dicebot via Digitalmars-d-learn
On Wednesday, 6 August 2014 at 22:24:24 UTC, H. S. Teoh via Digitalmars-d-learn wrote: My guess is that it requires knowledge of dmd internals that only few people have, and those few people have other fires to put out right now. Kenji has a PR with new symbol overload resolution system that

Re: Are there desktop appications being developed in D currently?

2014-08-09 Thread Dicebot via Digitalmars-d-learn
On Saturday, 9 August 2014 at 17:14:39 UTC, thedeemon wrote: We've got some. Photo processing app: http://www.infognition.com/blogsort/ Disk space visualizer and redundancy searcher: http://www.infognition.com/undup/ A tool for watching some folders and processing video files there:

Re: overloads and parents. __traits confusion

2014-08-11 Thread Dicebot via Digitalmars-d-learn
On Monday, 11 August 2014 at 13:00:27 UTC, John Colvin wrote: alias Parent = TypeTuple!(__traits(parent, foo!float))[0]; Say hello to optional parens - you are trying to call foo!float() here and apply result to trait.

Re: Capture parameter identifier name in a template?

2014-08-12 Thread Dicebot via Digitalmars-d-learn
On Tuesday, 12 August 2014 at 17:36:41 UTC, Maxime Chevalier-Boisvert wrote: In my JavaScript VM, I have a function whose purpose is to expose D/host constants to the JavaScript runtime code running inside the VM. This makes for somewhat redundant code, as follows:

Re: Appender is ... slow

2014-08-14 Thread Dicebot via Digitalmars-d-learn
On Thursday, 14 August 2014 at 17:16:42 UTC, Philippe Sigaud wrote: From time to time, I try to speed up some array-heavy code by using std.array.Appender, reserving some capacity and so on. It never works. Never. It gives me executables that are maybe 30-50% slower than bog-standard array

Re: Appender is ... slow

2014-08-14 Thread Dicebot via Digitalmars-d-learn
On Thursday, 14 August 2014 at 18:55:55 UTC, Philippe Sigaud via Digitalmars-d-learn wrote: btw, I saw your Dconf talk yesterday, nice content! And thanks for talking about Pegged! It might interest you to know that the code I'm trying to use Appender on is a new engine for Pegged, based on

Re: Appender is ... slow

2014-08-14 Thread Dicebot via Digitalmars-d-learn
On Thursday, 14 August 2014 at 19:29:28 UTC, Philippe Sigaud via Digitalmars-d-learn wrote: There is a misunderstanding there: I'm using clear only to flush the state at the beginning of the computation. The Appender is a class field, used by the class methods to calculate. If I do not clear

Re: Appender is ... slow

2014-08-14 Thread Dicebot via Digitalmars-d-learn
On Thursday, 14 August 2014 at 20:42:08 UTC, Philippe Sigaud via Digitalmars-d-learn wrote: You mean by using the shrinkTo method? (Appender does not have a length, that's a bit of a bother btw). I just did, it does not change anything. Too bad. Heck, my code is simpler to read and use *and*

Re: Appender is ... slow

2014-08-14 Thread Dicebot via Digitalmars-d-learn
On Thursday, 14 August 2014 at 20:50:37 UTC, Dicebot wrote: Oh crap I had std.array.Array in mind which does have `length` exposes. And Appender seems to indeed clear / shrink data in a horrible way: https://github.com/D-Programming-Language/phobos/blob/master/std/array.d#L2597

Re: core.thread.Fiber --- runtime stack overflow unlike goroutines

2014-08-14 Thread Dicebot via Digitalmars-d-learn
On Thursday, 14 August 2014 at 18:52:00 UTC, Sean Kelly wrote: On 64 bit, reserve a huge chunk of memory, set a SEGV handler and commit more as needed. Basically how kernel thread stacks work. I've been meaning to do this but haven't gotten around to it yet. I think using some sort of

Re: Appender is ... slow

2014-08-14 Thread Dicebot via Digitalmars-d-learn
On Thursday, 14 August 2014 at 21:34:04 UTC, Jonathan M Davis wrote: On Thursday, 14 August 2014 at 21:11:51 UTC, safety0ff wrote: IIRC it manages the capacity information manually instead of calling the runtime which reduces appending overhead. That would make some sense, though it must be

Re: Appender is ... slow

2014-08-15 Thread Dicebot via Digitalmars-d-learn
On Friday, 15 August 2014 at 08:35:41 UTC, Philippe Sigaud via Digitalmars-d-learn wrote: I wonder if using plain `Array` instead may be result in better performance where immutability is not needed. Hmm, no: ... It is very different with better compiler though : $ ldmd2 -release -O a.d $

Re: core.thread.Fiber --- runtime stack overflow unlike goroutines

2014-08-15 Thread Dicebot via Digitalmars-d-learn
On Friday, 15 August 2014 at 08:41:30 UTC, Kagamin wrote: On Thursday, 14 August 2014 at 07:46:29 UTC, Carl Sturtivant wrote: The default size of the runtime stack for a Fiber is 4*PAGESIZE which is very small, and a quick test shows that a Fiber suffers a stack overflow that doesn't lead to a

Re: core.thread.Fiber --- runtime stack overflow unlike goroutines

2014-08-15 Thread Dicebot via Digitalmars-d-learn
On Friday, 15 August 2014 at 14:45:02 UTC, Sean Kelly wrote: On Friday, 15 August 2014 at 14:28:34 UTC, Dicebot wrote: Won't that kind of kill the purpose of Fiber as low-cost context abstraction? Stack size does add up for thousands of fibers. As long as allocation speed is fast for large

Re: core.thread.Fiber --- runtime stack overflow unlike goroutines

2014-08-15 Thread Dicebot via Digitalmars-d-learn
On Friday, 15 August 2014 at 15:40:35 UTC, Sean Kelly wrote: On Friday, 15 August 2014 at 15:25:23 UTC, Dicebot wrote: No, I was referring to the proposal to supply bigger stack size to Fiber constructor - AFAIR it currently does allocate that memory eagerly (and does not use any OS CoW

Re: In the new D release why use free functions instead of properties?

2014-08-19 Thread Dicebot via Digitalmars-d-learn
On Tuesday, 19 August 2014 at 16:04:15 UTC, Gary Willoughby wrote: This kind of makes sense for `dup` because that could be applied across types but what about rehash, byKey, byValue, keys, values, etc of AA's? Surely these will only be used by AA's? Is this more about speed optimisation? I

Re: Variadic parameter of length 1

2014-08-20 Thread Dicebot via Digitalmars-d-learn
On Wednesday, 20 August 2014 at 15:34:30 UTC, Dominikus Dittes Scherkl wrote: And why historical? Is that not necessary anymore? What better solution is there today? Historical in a sense that distinct can be anything template parameter is probably a better approach but it is too late to

Re: Can you explain this?

2014-08-20 Thread Dicebot via Digitalmars-d-learn
On Wednesday, 20 August 2014 at 20:01:05 UTC, Colin wrote: I see 3 distinct parts playing a role in my confusion: A) The 'is' keyword. What does it do when you have is(expression); http://dlang.org/expression.html#IsExpression It is a tool for type checking. It has many options but plain

Re: RAII limitations in D?

2014-08-21 Thread Dicebot via Digitalmars-d-learn
http://dlang.org/phobos/std_typecons.html#.RefCounted

Re: core.thread.Fiber --- runtime stack overflow unlike goroutines

2014-08-22 Thread Dicebot via Digitalmars-d-learn
On Friday, 15 August 2014 at 15:50:30 UTC, Dicebot wrote: On Friday, 15 August 2014 at 15:40:35 UTC, Sean Kelly wrote: On Friday, 15 August 2014 at 15:25:23 UTC, Dicebot wrote: No, I was referring to the proposal to supply bigger stack size to Fiber constructor - AFAIR it currently does

Re: unit testing version statements

2014-08-22 Thread Dicebot via Digitalmars-d-learn
On Friday, 22 August 2014 at 09:37:30 UTC, Robert burner Schadek wrote: On Friday, 22 August 2014 at 09:33:10 UTC, Kagamin wrote: Compile and run the tests with different version options. that is not an option This is how version feature is intentionally designed to work

Re: Iterating over the tupleof of a struct

2014-08-22 Thread Dicebot via Digitalmars-d-learn
On Saturday, 23 August 2014 at 01:32:13 UTC, Meta wrote: On Saturday, 23 August 2014 at 01:24:10 UTC, Meta wrote: What is happening here? Are these two extra ulongs the offsets of the fields in the struct? And I just realized that that's obviously not the case. It's just an iteration

Re: Is this RDMD bug ?

2014-08-23 Thread Dicebot via Digitalmars-d-learn
On Saturday, 23 August 2014 at 17:37:39 UTC, sigod wrote: On Saturday, 23 August 2014 at 17:32:15 UTC, Vladimir Panteleev wrote: No, it is not an rdmd bug. etc is a standard D package name reserved for Phobos, the standard library. It is the same for std and core. Please, point us directly

Re: Learning D

2014-08-25 Thread Dicebot via Digitalmars-d-learn
On Monday, 25 August 2014 at 20:37:16 UTC, Ryan wrote: Then I thought I'd learn dub. Well, this is NOT going well... I did a git clone of gtk-d, then tried to build with dub (renamed the package.json to dub.json), and it told me Conflicting package multi-reference I have no clue and I've

Re: sdlang-d can not link after updating to dmd 2.066

2014-08-27 Thread Dicebot via Digitalmars-d-learn
May be dub issue not taken updated compiler into consideration and not rebuilding the deps. Try forcing it.

Re: C++ namespaces

2014-08-28 Thread Dicebot via Digitalmars-d-learn
On Friday, 29 August 2014 at 02:10:56 UTC, Vasileios Anagnostopoulos via Digitalmars-d-learn wrote: Hi, in the 2.066 changelog I saw something for supporting c++ namespaces. I thought this was not possible. Which implementation does this refer? (compiler/architecture) thank you very

Re: Both shared local classes, method selection

2014-08-29 Thread Dicebot via Digitalmars-d-learn
http://dpaste.dzfl.pl/2a17662ce5b0 Doing completely separate implementation based on sharedness may be a bit more tricky. std.typecons.Proxy comes to my mind immediately but it does not allow proxying two objects with same method names. At the same time it does not sound like a good idea to

Re: Both shared local classes, method selection

2014-08-29 Thread Dicebot via Digitalmars-d-learn
On Friday, 29 August 2014 at 14:16:51 UTC, Etienne wrote: On 2014-08-29 9:39 AM, Dicebot wrote: based on shared qualified I'd call it a smart ass one and never accepted it through code review :) Such things really need to be explicit, magic is worst enemy of multi-threading The other option

Re: D daemon GC?

2014-08-30 Thread Dicebot via Digitalmars-d-learn
I had similar issues. Thing is D compiler places runtime cleanup initialization code into binary constructor sections (fini_array) which is needed to support shared libraries properly. But the same code gets triggered when you run `exit` in a fork resulting in attempt to terminate other

Re: D daemon GC?

2014-08-30 Thread Dicebot via Digitalmars-d-learn
On Saturday, 30 August 2014 at 19:52:24 UTC, JD wrote: I tested it again, and it works fine in both 2.065 and 2.066. Be aware that you should comment out: // close(STDOUT_FILENO); // close(STDERR_FILENO); A daemon normally detaches itself from the terminal by closing the STD*

Re: D1: Error: duplicate union initialization for size

2014-08-30 Thread Dicebot via Digitalmars-d-learn
On Sunday, 31 August 2014 at 02:53:35 UTC, Ali Çehreli wrote: On 08/30/2014 06:05 PM, jicman wrote: Really is or how one can fix it? This is the only time that I have found myself without answers with D. Strange. Maybe folks are not that into D1, but D1 was before D2. Any thoughts would

Re: alias and mixin

2014-08-31 Thread Dicebot via Digitalmars-d-learn
On Sunday, 31 August 2014 at 12:01:43 UTC, evilrat wrote: On Sunday, 31 August 2014 at 11:43:03 UTC, ketmar via Digitalmars-d-learn wrote: On Sun, 31 Aug 2014 11:26:47 + evilrat via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: alias myint = mixin(int); // - basic type

Re: alias and mixin

2014-08-31 Thread Dicebot via Digitalmars-d-learn
On Sunday, 31 August 2014 at 14:46:00 UTC, Philippe Sigaud via Digitalmars-d-learn wrote: It is basically just an annoying grammar limitation that does not allow to use mixin / __traits as an identifier. The usual helper template: ``` alias helper(alias a) = a; ``` helps for aliasing

  1   2   >