Re: @nogc inconsistent for array comparison depending on mutability of elements

2016-04-08 Thread Dicebot via Digitalmars-d-learn
On Friday, 8 April 2016 at 09:56:41 UTC, Nick Treleaven wrote: Semantically, array literals are always allocated on the heap. In this case, the optimizer can obviously place the array on the stack or even make it static/global. So @nogc is enforced by the optimizer? Yes, sadly. To make it sa

Re: Fiber and Thread Communication

2016-04-08 Thread Dicebot via Digitalmars-d-learn
On Friday, 8 April 2016 at 10:51:49 UTC, Nordlöw wrote: Are there any plans to unite fiber-to-fiber communication with thread-to-thread communication in Phobos? Does vibe.d give any solutions here? Doesn't std.concurrency support both right now? I remember seeing PR that adds message box

Re: @nogc inconsistent for array comparison depending on mutability of elements

2016-04-08 Thread Dicebot via Digitalmars-d-learn
On Friday, 8 April 2016 at 12:45:59 UTC, Xinok wrote: On Friday, 8 April 2016 at 10:15:10 UTC, Dicebot wrote: On Friday, 8 April 2016 at 09:56:41 UTC, Nick Treleaven wrote: Semantically, array literals are always allocated on the heap. In this case, the optimizer can obviously place the array

Re: Fiber and Thread Communication

2016-04-08 Thread Dicebot via Digitalmars-d-learn
On Friday, 8 April 2016 at 11:18:11 UTC, Nordlöw wrote: On Friday, 8 April 2016 at 11:01:21 UTC, Dicebot wrote: Doesn't std.concurrency support both right now? I remember seeing PR that adds message box support to fibers ages ago. See https://issues.dlang.org/show_bug.cgi?id=12090 and https:/

Re: Fiber and Thread Communication

2016-04-08 Thread Dicebot via Digitalmars-d-learn
On Friday, 8 April 2016 at 14:08:39 UTC, Nordlöw wrote: So a TId can represent either a thread or a fiber? AFAIR, yes (I haven't used std.concurrency in a long while, telling all from memory only).

Re: Fiber and Thread Communication

2016-04-08 Thread Dicebot via Digitalmars-d-learn
On Friday, 8 April 2016 at 19:46:17 UTC, tcak wrote: On Friday, 8 April 2016 at 15:33:46 UTC, Dicebot wrote: On Friday, 8 April 2016 at 14:08:39 UTC, Nordlöw wrote: So a TId can represent either a thread or a fiber? AFAIR, yes (I haven't used std.concurrency in a long while, telling all from

Re: Fiber and Thread Communication

2016-04-08 Thread Dicebot via Digitalmars-d-learn
On Friday, 8 April 2016 at 20:25:11 UTC, Ali Çehreli wrote: On 04/08/2016 01:16 PM, Dicebot wrote: On Friday, 8 April 2016 at 19:46:17 UTC, tcak wrote: On Friday, 8 April 2016 at 15:33:46 UTC, Dicebot wrote: On Friday, 8 April 2016 at 14:08:39 UTC, Nordlöw wrote: So a TId can represent either

Re: Is there a way to disable 'dub test' for applications?

2016-04-18 Thread Dicebot via Digitalmars-d-learn
On Monday, 18 April 2016 at 04:25:25 UTC, Jon D wrote: I have an dub config file specifying a targetType of 'executable'. There is only one file, the file containing main(), and no unit tests. When I run 'dub test', dub builds and runs the executable. This is not really desirable. Is there a

Re: Is there a way to disable 'dub test' for applications?

2016-04-18 Thread Dicebot via Digitalmars-d-learn
On Monday, 18 April 2016 at 18:19:32 UTC, Jon D wrote: On Monday, 18 April 2016 at 11:47:42 UTC, Dicebot wrote: On Monday, 18 April 2016 at 04:25:25 UTC, Jon D wrote: I have an dub config file specifying a targetType of 'executable'. There is only one file, the file containing main(), and no u

Re: parameter pack to inputRange

2016-05-05 Thread Dicebot via Digitalmars-d-learn
Unless parameter list is very (very!) long, I'd suggest to simply copy it into a stack struct. Something like this: auto toInputRange (T...) (T args) { struct Range { T args; size_t index; T[0] front () { return args[index]; } void popFront () { ++index;

Re: parameter pack to inputRange

2016-05-05 Thread Dicebot via Digitalmars-d-learn
On Friday, 6 May 2016 at 06:08:24 UTC, Dicebot wrote: Unless parameter list is very (very!) long, I'd suggest to simply copy it into a stack struct. Something like this: auto toInputRange (T...) (T args) { struct Range { T args; size_t index; T[0] front () { ret

Re: Async or event library

2016-05-06 Thread Dicebot via Digitalmars-d-learn
On Thursday, 5 May 2016 at 08:19:26 UTC, chmike wrote: At the bottom of the wiki page there is an innocent question regarding TLS which is quite devastating. A worker thread pool system would not support affinity between threads and callback context. Unfortunately, D relies on Thread Local Stor

Re: Async or event library

2016-05-06 Thread Dicebot via Digitalmars-d-learn
On Thursday, 5 May 2016 at 09:21:04 UTC, rikki cattermole wrote: Event loops needs to be thread local not per process. So many API's such as WinAPI for e.g. GUI's have this requirement in it that its just not worth fighting over. It is implementation detail. You can have global event loop and

Re: parameter pack to inputRange

2016-05-08 Thread Dicebot via Digitalmars-d-learn
On Sunday, 8 May 2016 at 14:11:31 UTC, Ali Çehreli wrote: On 05/05/2016 11:08 PM, Dicebot wrote: > Unless parameter list is very (very!) long, I'd suggest to simply copy > it into a stack struct. Something like this: > > auto toInputRange (T...) (T args) > { > struct Range > { >

Re: parameter pack to inputRange

2016-05-08 Thread Dicebot via Digitalmars-d-learn
On Sunday, 8 May 2016 at 14:11:31 UTC, Ali Çehreli wrote: E front() { final switch (index) { /* static */ foreach (i, arg; Args) { case i: return arg; } } } AFAIK, this will do fu

Re: parameter pack to inputRange

2016-05-09 Thread Dicebot via Digitalmars-d-learn
On Sunday, 8 May 2016 at 23:48:01 UTC, Erik Smith wrote: Thanks! The static array version works for me too. It would be good to understand more about what is going on. It looks like the cost of the static array is an extra copy for each element. Maybe there is still a way to avoid that. T

Re: parameter pack to inputRange

2016-05-09 Thread Dicebot via Digitalmars-d-learn
On Monday, 9 May 2016 at 12:36:00 UTC, Ali Çehreli wrote: On 05/09/2016 03:44 AM, Dicebot wrote: > Ali version generates a compile-time switch for index I think it's a run-time switch, generated by a compile-time foreach: E front() { final switch (index) {// <-- RUNTI

Re: Async or event library

2016-05-10 Thread Dicebot via Digitalmars-d-learn
On Tuesday, 10 May 2016 at 13:34:36 UTC, chmike wrote: My initial question is if there is a working group I could join to work on this pure D async library. I'm interested in working on the subject. Considering libasync is only native D async library supported by vibe.d right now, focusing on

Re: `return ref`, DIP25, and struct/class lifetimes

2016-05-16 Thread Dicebot via Digitalmars-d-learn
tl; dr: DIP25 is so heavily under-implemented in its current shape it can be considered 100% broken and experimenting will uncover even more glaring holes. To be more precise, judging by experimental observation, currently dip25 only works when there is explicitly a `ref` return value in func

Re: `return ref`, DIP25, and struct/class lifetimes

2016-05-16 Thread Dicebot via Digitalmars-d-learn
There is also another counter-obvious bit regarding current implementation - it only tracks lifetime of actual references. Check this example: ref int wrap ( return ref int input ) { return input; } int badWrapper() { int z; { int x = 42; z = wrap(x); } retu

Re: Linux and htod

2016-06-16 Thread Dicebot via Digitalmars-d-learn
On Thursday, 16 June 2016 at 12:23:09 UTC, fbmac wrote: How people use it on Linux, if htod is required to import C libraries and windows only?f People don't use htod. https://github.com/jacob-carlborg/dstep is best what one can be for plain binding generation.

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 ha

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

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 transit

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 so

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 - https://github.com/D-Programming-

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. Exam

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 wh

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 (http://en.wikipedia.org/wiki/Structural_typ

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: test.d(

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 wrote: If you need to store the tuple as an array to some variable, then you would use that syntax. It all depends on what you're tr

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 this

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 wrote: Can someone explain why this can't/doesn't work? Thanks. hm. why it should? there is no 'default' constructors in D, and you specifia

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 ma

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 = Tuple!(string,"str

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 wrote: ... Then take a look at one of my projects in which i've ported C headers to D. https://github.com/nomad-software/tcltk I notice

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 and

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 be

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 sho

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 () of type const() to " and this is a reduced example ( also on http://dpaste.dzfl.pl/f2f3bd921989): module test; import std.stdio; class Foo {

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 has

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 appl

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 is

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) u

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 ca

Re: Some kind of RPC exists for D?

2014-06-18 Thread Dicebot via Digitalmars-d-learn
On Wednesday, 18 June 2014 at 19:24:03 UTC, Bienlein wrote: Hello, I'm looking for a way to do some kind of RPC in D. Some way of being able to say aFoo.bar(int i, ...) with receiver object and method being marshalled at the sender's site and being unmarshalled and invoked at the receiver's s

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 at

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 u

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 that

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; //

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 "pr

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 http://dlang.org/operatoroverloading.html#Binary"; target="_blank">doc there is a opBinary: Yep, I think it is D1 legacy approach. op

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 compi

Re: Question about @nogc in D 2.066

2014-07-11 Thread Dicebot via Digitalmars-d-learn
Key difference is that type of string literal is immutable(char)[] so it is perfectly legal to keep it in binary text segment. Type of array literal is just T[] (int[] here) and you can possibly mutate their elements. Because of this each assignment of array literal needs to allocate a new copy

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 t

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 w

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 wary

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: Dump mixins (preprocessed/generated) code

2014-07-18 Thread Dicebot via Digitalmars-d-learn
On Friday, 18 July 2014 at 14:25:57 UTC, Domingo Alvarez Duarte wrote: Thanks for all you answers, I think I found the problem. The constant __FUNCTION__ was not a compiler reserved word at the time MiniD/Croc was created and it was introduced later on dmd2, it was clashing with it. I rename

Re: Code spliting in module and packages

2014-07-21 Thread Dicebot via Digitalmars-d-learn
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.

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 : http

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 becau

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" c

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 wrote: Most likely those threads either do nothing or are short living so you don't get actually 10 000 threads running simultaneousl

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, bu

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 comput

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 tho

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

2014-08-05 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 real

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: http://w

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: vm.defRTConst("OBJ_MIN_CAP"

Re: safe pure unittest

2014-08-13 Thread Dicebot via Digitalmars-d-learn
On Wednesday, 13 August 2014 at 12:26:02 UTC, simendsjo wrote: This is the first time I've seen attributes on unittests: https://github.com/D-Programming-Language/phobos/pull/2349/files#diff-ba05e420ac1da65db044e79304d641b6R179 Has this always been supported? I guess it's good practice to add t

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 cod

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 GLL

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 it

  1   2   3   >