Re: Really easy optimization with std.experimental.allocator

2017-01-07 Thread Dicebot via Digitalmars-d-learn
On Sunday, 18 September 2016 at 01:44:10 UTC, Ryan wrote: I think it works because each time you call dispose it tells the GC to mark that memory as available, without the GC needing to do a collection sweep. This could be a really useful tip in the allocators section, as I see converting to

Re: Rust-like collect in D

2016-10-06 Thread Dicebot via Digitalmars-d-learn
On Thursday, 6 October 2016 at 16:56:26 UTC, Nordlöw wrote: Is there a way to do this, or do we need something similar to `collect` in Phobos? Something like import std.container.array : Array; 0.iota(n).collect!Array You mean semantics like this? Container collect(Container, Range) (Range

Re: Rust-like collect in D

2016-10-06 Thread Dicebot via Digitalmars-d-learn
On Thursday, 6 October 2016 at 14:32:44 UTC, Nordlöw wrote: Is there a concept in D similar to Rust's `collect`: https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.collect If not, I'm eager to implement it to support D-style containers. What would the desired interface look like?

Re: dmd -o- option meaning changed recently? Now not creating OBJ but also not creating EXE

2016-10-03 Thread Dicebot via Digitalmars-d-learn
On Sunday, 2 October 2016 at 21:05:25 UTC, A D dev wrote: One last point: If that was always the behavior (in all versions from 2010 - or earlier), i.e. -o- generates neither .OBJ nor .EXE, then what is the purpose of the option? does it act as just a syntax check? Purpose is to skip code

Re: mutable destructor? WAT???

2016-08-29 Thread Dicebot via Digitalmars-d-learn
And this segfaults (on Linux): void main() @safe { auto s = const(S)("abcd"); foo(s); } I'd call it a clear bug. Most obvious fix would be to require const destructor if non-default destructor is present AND immutable/const instance is attempted to be created.

Re: mutable destructor? WAT???

2016-08-28 Thread Dicebot via Digitalmars-d-learn
Looks correct to me. This const annotation does not prevent you from deleting memory or free'ing external resources - but it does ensure no transitive mutations for data reachable from struct fields. If it allowed destroying with mutable destructor, type system hole like this would be legal:

Re: Proper concurrent nearly lock free efficient nogc storage structures?

2016-08-27 Thread Dicebot via Digitalmars-d-learn
On Saturday, 27 August 2016 at 21:23:04 UTC, Illuminati wrote: On Saturday, 27 August 2016 at 17:27:19 UTC, Dicebot wrote: On Friday, 26 August 2016 at 23:38:02 UTC, Illuminati wrote: Does D have any such thing? I'm having to recreate the wheel here and it isn't fun ;/ Getting in the way of

Re: How to avoid ctRegex (solved)

2016-08-27 Thread Dicebot via Digitalmars-d-learn
On Saturday, 27 August 2016 at 17:35:04 UTC, cy wrote: On Wednesday, 24 August 2016 at 05:29:57 UTC, ag0aep6g wrote: The plain regex function doesn't have such a requirement. It also works with a pattern that's generated at run time, e.g. from user input. But you can use it with a compile time

Re: Proper concurrent nearly lock free efficient nogc storage structures?

2016-08-27 Thread Dicebot via Digitalmars-d-learn
On Friday, 26 August 2016 at 23:38:02 UTC, Illuminati wrote: Does D have any such thing? I'm having to recreate the wheel here and it isn't fun ;/ Getting in the way of real work ;/ Surely you would think that with the power D has such things would exist by now? There doesn't seem to be

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: `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); }

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

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

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) {// <--

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.

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

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

Re: parameter pack to inputRange

2016-05-06 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 () {

Re: parameter pack to inputRange

2016-05-06 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: 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

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

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

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

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

Re: Picking specific D compiler with rdmd

2015-10-06 Thread Dicebot via Digitalmars-d-learn
--compiler

Re: Do users need to install VS runtime redistributable if linking with Microsoft linker?

2015-09-28 Thread Dicebot via Digitalmars-d-learn
Maybe LDC uses dynamic linking by default and DMD static one, same as on Linux?

Re: Unexpected behavior when casting away immutable

2015-09-23 Thread Dicebot via Digitalmars-d-learn
On Wednesday, 23 September 2015 at 14:34:07 UTC, bachmeier wrote: I was not aware that you could "violate" immutable. In that case, it's not immutable. You can violate absolutely everything in a system language with casts and pointers. That is exactly what makes it system language. But you

Re: Combining Unique type with concurrency module

2015-09-14 Thread Dicebot via Digitalmars-d-learn
On Monday, 14 September 2015 at 00:11:07 UTC, Ali Çehreli wrote: There is a misconception. Unique guarantees that the object will not be copied. It does not provide any guarantee that only one thread will access the object. It is possible to write a type that acquires a lock during certain

Re: Combining Unique type with concurrency module

2015-09-14 Thread Dicebot via Digitalmars-d-learn
On Monday, 14 September 2015 at 00:11:07 UTC, Ali Çehreli wrote: send(childTid2, cast(shared(Unique!S*))); And yeah this violates the idea of Unique. Sadly, I am not aware of any way to prohibit taking address of an aggregate.

Re: const-correct structs, best practices?

2015-08-21 Thread Dicebot via Digitalmars-d-learn
On Friday, 21 August 2015 at 15:00:04 UTC, Nick Sabalausky wrote: Is there a good posting somewhere that summarizes the current best practices for making const-correct (ie works for all of mutable/const/immutable) structs? - mark methods const - avoid reference type fields ;)

Re: dmd.conf... again

2015-08-12 Thread Dicebot via Digitalmars-d-learn
On Wednesday, 12 August 2015 at 13:04:25 UTC, Atila Neves wrote: On Wednesday, 12 August 2015 at 12:29:46 UTC, Dicebot wrote: More info about what gets placed where please. I have special dev layout on my system that co-exists with system-wide installation of dmd. It is as simple as having

Re: dmd.conf... again

2015-08-12 Thread Dicebot via Digitalmars-d-learn
More info about what gets placed where please. I have special dev layout on my system that co-exists with system-wide installation of dmd. It is as simple as having ~/dlang/{dmd|druntime|phobos}, linking ~/dlang/dmd/src/dmd to ~/bin/dmd-dev and placing dmd.conf in ~/bin which adds all those

Re: Concurrency Confusion

2015-08-04 Thread Dicebot via Digitalmars-d-learn
On Tuesday, 4 August 2015 at 10:29:57 UTC, 岩倉 澪 wrote: On Tuesday, 4 August 2015 at 08:35:10 UTC, Dicebot wrote: auto output = receiveOnly!(immutable(Bar)[]); Won't message passing like this result in an expensive copy, or does the cast to immutable via assumeUnique avoid that?

Re: Concurrency Confusion

2015-08-04 Thread Dicebot via Digitalmars-d-learn
import std.concurrency; import std.typecons : Unique; import std.exception : assumeUnique; struct Foo { } struct Bar { } void bar_generator (Tid ownerTid) { receive( (shared(Foo)* input) { auto output = new Bar[100]; // compute output .. // ..

Re: Concurrency Confusion

2015-08-04 Thread Dicebot via Digitalmars-d-learn
On Tuesday, 4 August 2015 at 11:33:11 UTC, 岩倉 澪 wrote: On Tuesday, 4 August 2015 at 10:37:39 UTC, Dicebot wrote: std.concurrency does by-value message passing (in this case just ptr+length), it never deep copies automatically I assumed that it would deep copy (in the case of mutable data)

Re: Thread communication

2015-08-04 Thread Dicebot via Digitalmars-d-learn
receiveTimeout

Re: Struct that destroys its original handle on copy-by-value

2015-08-03 Thread Dicebot via Digitalmars-d-learn
On Monday, 3 August 2015 at 08:54:32 UTC, Kagamin wrote: On Saturday, 1 August 2015 at 11:47:29 UTC, Joseph Rushton Wakeling wrote: Yea, but that's not what I'm trying to achieve. I know how I can pass something to `take` so as to e.g. obtain reference semantics or whatever; what I'm trying

Re: Struct that destroys its original handle on copy-by-value

2015-08-01 Thread Dicebot via Digitalmars-d-learn
On Saturday, 1 August 2015 at 17:50:28 UTC, John Colvin wrote: I'm not sure how good an idea it is to totally enforce a range to be non-copyable, even if you could deal with the function call chain problem. Even in totally save-aware code, there can still be valid assignment of a range type.

Re: Struct that destroys its original handle on copy-by-value

2015-07-31 Thread Dicebot via Digitalmars-d-learn
On Friday, 31 July 2015 at 18:13:04 UTC, Ali Çehreli wrote: To make sure, I didn't mean that I know of structs in Phobos that behave that way. Although, it would be interesting to identify them. :) Ali Things like Unique, Scoped, RefCounted - pretty much everything which wraps reference

Re: Struct that destroys its original handle on copy-by-value

2015-07-31 Thread Dicebot via Digitalmars-d-learn
On Friday, 31 July 2015 at 18:23:39 UTC, H. S. Teoh wrote: It seems that what the language (originally) defines structs to be, is not entirely consistent with how it has come to be used (which also entailed later extensions to the struct definition), and this has been a source of problems.

Re: Struct that destroys its original handle on copy-by-value

2015-07-31 Thread Dicebot via Digitalmars-d-learn
On Friday, 31 July 2015 at 17:21:40 UTC, Ali Çehreli wrote: On 07/26/2015 04:29 AM, Joseph Rushton Wakeling via Digitalmars-d-learn wrote: is this design idea even feasible in principle, or just a bad idea from the get-go? As I understand it, it is against one of fundamental D principles:

Re: Why hide a trusted function as safe?

2015-07-26 Thread Dicebot via Digitalmars-d-learn
I remember doing something like that in druntime because of objects - you can't override @safe method prototype with @trusted one.

Re: static opCall not working?

2015-07-20 Thread Dicebot via Digitalmars-d-learn
On Sunday, 19 July 2015 at 10:26:04 UTC, TC wrote: What is wrong here? Docs or behavior? Tested it on asm.dlang.org where it fails with all compiler versions. Docs are wrong here. `static opCall` was never intended to be used as constructor and I consider it a bad style in general. This is

Re: Why aren't Ranges Interfaces?

2015-06-26 Thread Dicebot via Digitalmars-d-learn
On Friday, 26 June 2015 at 19:26:57 UTC, Jack Stouffer wrote: How much of a performance hit are we talking about? Is the difference between using an interface and not using one noticeable? It can be huge difference if you take inlning in mind. LDC is capable of flattening most simple

Re: Typed Message Passing between D Processes

2015-06-26 Thread Dicebot via Digitalmars-d-learn
std.concurrency was supposed to be able to handle that by design but it is impossible to do without any sort of standard serialization utility in Phobos (and, ideally, very fast binary serialization utility)

Re: Does anyone get line numbers in stack traces on Linux?

2015-06-17 Thread Dicebot via Digitalmars-d-learn
druntime has never had support for file/line info in traces on Linux AFAIR gdb usually saves the day

Re: pthread and GC

2015-05-13 Thread Dicebot via Digitalmars-d-learn
On Wednesday, 13 May 2015 at 07:04:39 UTC, tcak wrote: I am using pthread somewhere in program, and it creates an object. After a while, I see core.thread.scanAllTypeImpl error on gdb. Does this mean that pthread and GC are incompatible? Any solution without making too much code changes?

Re: vibed: how to use pure HTML instead of template engine?

2015-05-06 Thread Dicebot via Digitalmars-d-learn
On Wednesday, 6 May 2015 at 20:45:10 UTC, John Colvin wrote: On Wednesday, 6 May 2015 at 14:28:26 UTC, Adam D. Ruppe wrote: On Wednesday, 6 May 2015 at 14:23:27 UTC, Chris wrote: Especially this: http://vibed.org/templates/diet#embedded-code I think that's a misfeature... if I used vibe.d,

Re: CTFE template predicates

2015-05-03 Thread Dicebot via Digitalmars-d-learn
On Sunday, 3 May 2015 at 21:46:11 UTC, Robert M. Münch wrote: 3. TupleType is a very missleading name when you are learning these things, because the tuple can hold values as well. Or is there a more extensive explanation for the name I don't get? Legacy we are trying to get rid of. See also:

Re: User defined properties signatures

2015-04-21 Thread Dicebot via Digitalmars-d-learn
On Tuesday, 21 April 2015 at 13:27:48 UTC, Marc Schütz wrote: On Monday, 20 April 2015 at 20:22:40 UTC, Jonathan M Davis wrote: There may be languages out there which take the the return type into account when overloading, but I've never seen one. Rust does, as far as I know. And this is

Re: User defined properties signatures

2015-04-21 Thread Dicebot via Digitalmars-d-learn
This isn't about type system per se but about preferred style of syntax. Original example that caused my hatred looked like this: `let i : uint = from_str(42)`. Fortunately this has been deprecated in favor of `parse` but same principle applies - Rust authors encourage you to use declaration

Re: Linking C++ standard library works with GDC... but not DMD. (Linux)

2015-04-17 Thread Dicebot via Digitalmars-d-learn
On Thursday, 16 April 2015 at 12:39:07 UTC, Jacob Carlborg wrote: On 2015-04-16 11:56, Dicebot wrote: Simple issue but unpleasant fix. You always must use C++ library that matches base C++ compiler. For GDC it is GCC (which is used by default). For DMD it is DMC (Digital Mars C compiler). For

Re: Linking C++ standard library works with GDC... but not DMD. (Linux)

2015-04-16 Thread Dicebot via Digitalmars-d-learn
On Thursday, 16 April 2015 at 08:51:15 UTC, TheGag96 wrote: Hi, I've got this project that requires me to link into a C++ backend. It works just fine when using GDC: gdc *.d [client libraries] However, this command using DMD does not work: dmd -L-lstdc++ *.d [client libraries] I still get

Re: Make a type tuple from an array

2015-04-11 Thread Dicebot via Digitalmars-d-learn
On Saturday, 11 April 2015 at 09:05:19 UTC, Nordlöw wrote: On Saturday, 11 April 2015 at 07:18:26 UTC, John Colvin wrote: Why not use isStaticArray instead of isInputRange here? Because that would be completely different. Static arrays aren't even input ranges... Ahh, my mistake. Could

Re: D1 - D2 Code converter

2015-04-06 Thread Dicebot via Digitalmars-d-learn
On Monday, 6 April 2015 at 20:25:39 UTC, jicman wrote: Greetings! Has anyone written any quick program to convert d1 code to d2? I believe it will be a fine piece of program. :-) Thanks. josé It is surprisingly difficult, to the point of being almost impossible, to write such program.

Re: using vibe.d to parse json

2015-03-25 Thread Dicebot via Digitalmars-d-learn
On Thursday, 26 March 2015 at 00:41:50 UTC, Laeeth Isharc wrote: Yeah, it is not very intuitive. But it works. Thanks. Next question - how can I correctly deal with inconsiderately chosen JSON field names like 'private' (which conflict in a struct declaration with D language keywords). A

Re: Looking for MQTT client library

2015-03-12 Thread Dicebot via Digitalmars-d-learn
If it isn't on http://code.dlang.org it is unlikely to exist in easy to use form. Starting with C bindings is probably the easiest approach - you may want to check out https://github.com/jacob-carlborg/dstep if you haven't already.

Re: New package behaviour in 2.067

2015-03-10 Thread Dicebot via Digitalmars-d-learn
Looks like bug, investigating.

Re: New package behaviour in 2.067

2015-03-10 Thread Dicebot via Digitalmars-d-learn
https://issues.dlang.org/show_bug.cgi?id=14275

Re: D : dmd vs gdc : which one to choose?

2015-02-19 Thread Dicebot via Digitalmars-d-learn
On Thursday, 19 February 2015 at 08:46:11 UTC, Mayuresh Kathe wrote: How do I (a newbie to D) figure out which compiler set to use? I am running Ubuntu 14.10, and intend to stick with it in the long term. Should I choose DMD or go with GDC? I would like to know the rationale for suggestions

Re: Is this possible in D?

2015-02-19 Thread Dicebot via Digitalmars-d-learn
Most practical approach I am currently aware of is wrapping actual implementation (in most restrictive version): class Test { private static void foo_() {} version (Static) { static void foo() { foo_(); } } else { void foo() { foo_(); } } private void bar_() shared { } version

Re: GC deadlocks on linux

2015-02-18 Thread Dicebot via Digitalmars-d-learn
Any chance you are using gdm-3.12.x? I was so mad when I have encountered this: https://issues.dlang.org/show_bug.cgi?id=4890

Re: To write such an expressive code D

2015-02-10 Thread Dicebot via Digitalmars-d-learn
On Tuesday, 10 February 2015 at 08:40:38 UTC, Dennis Ritchie wrote: Because I was arguing with one quiet a stubborn person who does not like D, on this forum: http://www.cyberforum.ru/holywars/thread1367892-page13.html He asked me to write such a program using only the language features and

Re: core.exception.InvalidMemoryOperationError@(0)

2015-01-26 Thread Dicebot via Digitalmars-d-learn
On Monday, 26 January 2015 at 15:54:12 UTC, Bayan Rafeh wrote: I apologize, I thought the point of invariant was to ensure correctness of the object's state It is simply matter of internal correctness vs in-program correctness. Sorry, documentation should probably mention that explicitly. I

Re: vibe.d Subdirectory?

2015-01-15 Thread Dicebot via Digitalmars-d-learn
On Thursday, 15 January 2015 at 14:38:16 UTC, Steven Schveighoffer wrote: Pardon me for asking kind of a side question, but is there any online information on how to do this? I am contemplating migrating my in-house php-based application to vibe.d, but I wondered if I have to do it whole-sale

Re: Tuple/Typedef question

2015-01-11 Thread Dicebot via Digitalmars-d-learn
I use this Typedef implementation instead: /// one with non-default initializer template Typedef(T, istring name, T initval) { static assert (name.length, Can't create Typedef with an empty identifier); enum Typedef = (struct ~ name ~ { ~

Re: Any chance of a linux dtoh?

2015-01-06 Thread Dicebot via Digitalmars-d-learn
On Tuesday, 6 January 2015 at 14:22:54 UTC, ketmar via Digitalmars-d-learn wrote: On Tue, 06 Jan 2015 14:08:30 + Laeeth Isharc via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: I realize Walter has far better things to work on, but value of having a translation tool is

Re: Any chance of a linux dtoh?

2015-01-06 Thread Dicebot via Digitalmars-d-learn
On Tuesday, 6 January 2015 at 14:14:28 UTC, Laeeth Isharc wrote: On Tuesday, 6 January 2015 at 14:11:19 UTC, Dicebot wrote: dstep is your only realistic chance currently. htod is completely unmaintained, even on Windows. Please report any issues found with it in relevant issue tracker. I got

Re: Any chance of a linux dtoh?

2015-01-06 Thread Dicebot via Digitalmars-d-learn
dstep is your only realistic chance currently. htod is completely unmaintained, even on Windows. Please report any issues found with it in relevant issue tracker.

Re: Unittest in a windows app

2014-12-20 Thread Dicebot via Digitalmars-d-learn
Can it be because Windows main wrapper consumes exceptions or spawn a separate thread for that or something like that?

Re: Memoizing methods

2014-12-19 Thread Dicebot via Digitalmars-d-learn
On Friday, 19 December 2014 at 02:45:13 UTC, kyle wrote: If you memoize a method inside a class definition using std.functional.memoize is caching done in a per-object manner, or do all objects of this class share cached return values? Thank you. Memoize uses one hash table per symbol it is

Re: DUB build questions

2014-12-19 Thread Dicebot via Digitalmars-d-learn
On Saturday, 20 December 2014 at 04:15:00 UTC, Rikki Cattermole wrote: b) Can I do parallel builds with dub. CMake gives me Makefiles so I can make -j does dub have a similar option? No Worth noting that it is not actually a dub problem as much, it is simply not worth adding parallel

Re: core.bitop.bt not faster than ?

2014-12-18 Thread Dicebot via Digitalmars-d-learn
Having quick read through the http://en.wikipedia.org/wiki/Word_%28computer_architecture%29 may help re-calibrating the way you thing about bit operations and optimization.

Re: Why do std.traits use template foo(args...) instead of foo(alias arg) ?

2014-12-18 Thread Dicebot via Digitalmars-d-learn
On Thursday, 18 December 2014 at 15:48:02 UTC, Mathias LANG wrote: An exemple being fullyQualifiedName: https://github.com/D-Programming-Language/phobos/blob/master/std/traits.d#L415 I don't get this pattern. Is it documented somewhere ? Full pattern looks like this: template foo(T...)

Re: Why do std.traits use template foo(args...) instead of foo(alias arg) ?

2014-12-18 Thread Dicebot via Digitalmars-d-learn
On Thursday, 18 December 2014 at 17:20:28 UTC, Mathias LANG wrote: Thanks for the precision. Is it something that is going to be fixed, or is it by design ? It is something that most likely would have been designed differently if we had another chance (aka D3) but unlikely to change in D2 as

Re: Garbage collector collects live objects

2014-12-09 Thread Dicebot via Digitalmars-d-learn
It may happen if only reference to an object is stored in memory block marked as data-only (using ubyte[] for a buffer is probably most common reason I have encountered)

Re: Does the compiler always semantically analyze everything in a project?

2014-11-13 Thread Dicebot via Digitalmars-d-learn
Apart from unused templates - yes. In abscence of .di files separate compilation only affects generated object files

Re: Russian translation of the range term?

2014-11-11 Thread Dicebot via Digitalmars-d-learn
On Tuesday, 11 November 2014 at 14:52:56 UTC, Kagamin wrote: I was thinking about list comprehension, which is what programming on ranges is. Isn't it? No, not really. It only applies to specific subset of ranges and specific interpretation of list term. There is no straightforward

Re: Russian translation of the range term?

2014-11-11 Thread Dicebot via Digitalmars-d-learn
On Tuesday, 11 November 2014 at 16:00:56 UTC, Ivan Kazmenko wrote: The suggested translations диапазон (diapason), список (list), последовательность (sequence), набор (collection) all have something in common with the range concept, but all of them seem to have a defined meaning in either

Re: Russian translation of the range term?

2014-11-11 Thread Dicebot via Digitalmars-d-learn
On Tuesday, 11 November 2014 at 16:09:06 UTC, ketmar via Digitalmars-d-learn wrote: набор ручек для писания, for example, as set of pens from which one pen can be taken and used (or another pen added to be used later). pretty similar to what range in D is, methinks. Only if

Re: Russian translation of the range term?

2014-11-11 Thread Dicebot via Digitalmars-d-learn
On Tuesday, 11 November 2014 at 16:14:10 UTC, Chris wrote: Does that entail the concept that ranges (in D) are homogeneous (i.e. every member/item is of the same type)? Yes (if you mean static type) ElementType!Range is used extensively in Phobos

Re: Russian translation of the range term?

2014-11-11 Thread Dicebot via Digitalmars-d-learn
On Tuesday, 11 November 2014 at 18:39:09 UTC, Ali Çehreli wrote: The separate concepts collection and range better have separate words. Ali This is especially important because collection tends to have certain connotation with container and confusion between ranges and containers is a

Re: Destructor/Finalizer Guarantees

2014-11-11 Thread Dicebot via Digitalmars-d-learn
As for guarantees for class destructors - you have hard guarantees that if memory is reclaimed, destructor was called before. But no guarantees memory will actually be reclaimed.

Re: Destructor/Finalizer Guarantees

2014-11-11 Thread Dicebot via Digitalmars-d-learn
There is an issue with structs that are directly allocated on heap - destructors are never called for those. You will want to change those into classes for GC to do at least something about it. See also this bug report : https://issues.dlang.org/show_bug.cgi?id=2834

Re: Strictness of language styling

2014-11-10 Thread Dicebot via Digitalmars-d-learn
Hard styling rules only apply to Phobos contributions. Any other project can have their own, for example, vibe.d requires own style which is incompatible with Phobos. For ported 3d party library value of minimizing the diff is indeed more important than styling.

Re: Reason for mypackage/package.d instead of mypackage.d

2014-11-10 Thread Dicebot via Digitalmars-d-learn
On Monday, 10 November 2014 at 21:25:32 UTC, Jonathan Marler wrote: I was perusing a PR for phobos where std/range.d was split into submodules and std/range.d was moved to std/range/package.d I was wondering why a package module had to be called package.d instead of just being the package

Re: Pointer across threads

2014-11-04 Thread Dicebot via Digitalmars-d-learn
There is assumeUnique which effectively does cast to immutable but is more clear to the reader in a sense why breaking type system was considered legit. I recommend using it over raw cast.

Re: object hijacked ?

2014-10-09 Thread Dicebot via Digitalmars-d-learn
I think this is an issue with the import resolution, not module system. The way it is implemented right now DMD stops searching for object.d / object.di once it has found one. So while your module name is not interpreted as object _original_ object.di does not get imported and you get lot of

Re: D1: Error: duplicate union initialization for size

2014-09-01 Thread Dicebot via Digitalmars-d-learn
On Sunday, 31 August 2014 at 03:06:48 UTC, Dicebot wrote: My guess is that it hasn't been ported to the D1 compiler yet. Dicebot or any other people who work for Sociomantic should be most helpful. At this point, I recommend that you ask on the main D forum. Ali I have not encountered such

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

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

  1   2   >