Re: Easier way to add libraries to visual d?

2016-05-26 Thread Basile B. via Digitalmars-d-learn
On Thursday, 26 May 2016 at 17:06:03 UTC, Basile B. wrote: On Thursday, 26 May 2016 at 17:02:06 UTC, TheDGuy wrote: On Thursday, 26 May 2016 at 16:53:42 UTC, Basile B. wrote: [...] Thanks, now i found it. If i try to add for example 'colorize' as a package i get: Fetching serial-port

Re: Easier way to add libraries to visual d?

2016-05-26 Thread Basile B. via Digitalmars-d-learn
On Thursday, 26 May 2016 at 17:02:06 UTC, TheDGuy wrote: On Thursday, 26 May 2016 at 16:53:42 UTC, Basile B. wrote: [...] Thanks, now i found it. If i try to add for example 'colorize' as a package i get: Fetching serial-port ~master... Placing serial-port ~master to

Re: Easier way to add libraries to visual d?

2016-05-26 Thread Basile B. via Digitalmars-d-learn
On Thursday, 26 May 2016 at 16:53:42 UTC, Basile B. wrote: On Thursday, 26 May 2016 at 16:21:30 UTC, TheDGuy wrote: On Thursday, 26 May 2016 at 16:01:22 UTC, Basile B. wrote: To register a DUB package, you can either fetch (DUB icon) or clone the repo, open the DUB JSON project, compile the

Re: Easier way to add libraries to visual d?

2016-05-26 Thread Basile B. via Digitalmars-d-learn
On Thursday, 26 May 2016 at 16:21:30 UTC, TheDGuy wrote: On Thursday, 26 May 2016 at 16:01:22 UTC, Basile B. wrote: To register a DUB package, you can either fetch (DUB icon) or clone the repo, open the DUB JSON project, compile the right config, then in the libman there's a icon with a gray

Re: Easier way to add libraries to visual d?

2016-05-26 Thread Basile B. via Digitalmars-d-learn
On Thursday, 26 May 2016 at 15:41:45 UTC, TheDGuy wrote: On Thursday, 26 May 2016 at 15:21:40 UTC, Basile B. wrote: Use Coedit: the widget "library manager" allow to register libraries in a single click and then they are usable on the fly, in the projects or in a runnable modules, without

Re: Why do some T.init evaluate to true while others to false?

2016-05-26 Thread Basile B. via Digitalmars-d-learn
On Thursday, 26 May 2016 at 15:48:18 UTC, Basile B. wrote: On Thursday, 26 May 2016 at 15:34:50 UTC, ArturG wrote: On Thursday, 26 May 2016 at 15:29:52 UTC, Basile B. wrote: float.init is not equal to 0.0f. In D FP points values are initialized to nan (not a number). By the way for

Re: Why do some T.init evaluate to true while others to false?

2016-05-26 Thread Basile B. via Digitalmars-d-learn
On Thursday, 26 May 2016 at 15:34:50 UTC, ArturG wrote: On Thursday, 26 May 2016 at 15:29:52 UTC, Basile B. wrote: float.init is not equal to 0.0f. In D FP points values are initialized to nan (not a number). By the way for strings it works, it's like the array case I described in the

Re: Why do some T.init evaluate to true while others to false?

2016-05-26 Thread Basile B. via Digitalmars-d-learn
On Thursday, 26 May 2016 at 15:34:50 UTC, ArturG wrote: On Thursday, 26 May 2016 at 15:29:52 UTC, Basile B. wrote: float.init is not equal to 0.0f. In D FP points values are initialized to nan (not a number). By the way for strings it works, it's like the array case I described in the

Re: Easier way to add libraries to visual d?

2016-05-26 Thread Basile B. via Digitalmars-d-learn
On Thursday, 26 May 2016 at 15:11:05 UTC, TheDGuy wrote: Hi, i use Visual D as a plugin for visual studio to create D applications. But what bothers me a bit is that i have to tell visual D the exact link to the .lib file for every lib i want to use in the project (!). So these are the steps

Re: Why do some T.init evaluate to true while others to false?

2016-05-26 Thread Basile B. via Digitalmars-d-learn
On Thursday, 26 May 2016 at 15:25:03 UTC, arturg wrote: On Thursday, 26 May 2016 at 15:15:57 UTC, Basile B. wrote: On Thursday, 26 May 2016 at 15:14:21 UTC, Basile B. wrote: On Thursday, 26 May 2016 at 15:11:50 UTC, Basile B. wrote: On Thursday, 26 May 2016 at 14:03:16 UTC, ArturG wrote:

Re: Why do some T.init evaluate to true while others to false?

2016-05-26 Thread Basile B. via Digitalmars-d-learn
On Thursday, 26 May 2016 at 15:14:21 UTC, Basile B. wrote: On Thursday, 26 May 2016 at 15:11:50 UTC, Basile B. wrote: On Thursday, 26 May 2016 at 14:03:16 UTC, ArturG wrote: [...] [...] - integral(*): if (i) <=> if (i > 0) I obviously meant: - integral(*): if (i) <=> if (i <> 0) and

Re: Why do some T.init evaluate to true while others to false?

2016-05-26 Thread Basile B. via Digitalmars-d-learn
On Thursday, 26 May 2016 at 15:11:50 UTC, Basile B. wrote: On Thursday, 26 May 2016 at 14:03:16 UTC, ArturG wrote: [...] [...] - integral(*): if (i) <=> if (i > 0) I obviously meant: - integral(*): if (i) <=> if (i <> 0) and "<=>" stands for "equivalence"

Re: Why do some T.init evaluate to true while others to false?

2016-05-26 Thread Basile B. via Digitalmars-d-learn
On Thursday, 26 May 2016 at 14:03:16 UTC, ArturG wrote: for example: if(any floatingpoint.init) will be true if(any char.init) also true if("") also true while others are false e.g. string s; if(s) will be false all others are also false or did i miss any? It's a shortcut that works for

Re: Effect of declaring a class immutable ?

2016-05-26 Thread Basile B. via Digitalmars-d-learn
On Thursday, 26 May 2016 at 14:12:23 UTC, chmike wrote: I couldn't find any information about this on the dlang web site. What is the effect adding the immutable attribute to a class like this immutable class MyClass { ... } The compiler doesn't complain. Will it add the immutable

Re: Newbie to D, first impressions and feedback on the 5 (and more) first minutes.

2016-05-24 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 24 May 2016 at 15:27:45 UTC, llaine wrote: Hi everybody, [...] 5 - Tools I've seen your comment on the DCD issue related to DUB (#198). It mays be the plugin (and not DCD ) that doesn't register well vibe-d. Also it's possible that it didn't work because vibe-d was not yet

Re: Problem with .debug info in program

2016-05-24 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 24 May 2016 at 13:17:22 UTC, chmike wrote: After closer examination it seam that the second line with 9 is a bogus insertion. Removing it should fix the code line table. app.d 9 0x43aafb app.d 11

Re: Overload new and delete to not use GC?

2016-05-22 Thread Basile B. via Digitalmars-d-learn
On Sunday, 22 May 2016 at 07:35:32 UTC, Rusty wrote: I know it's possible to do [explicit object allocation](http://wiki.dlang.org/Memory_Management#Explicit_Class_Instance_Allocation) on the heap, but I find that quite cumbersome. So.. is it possible to overload 'new' and 'delete' to not use

immutable shared not accepted as TypeCtor ?

2016-05-19 Thread Basile B. via Digitalmars-d-learn
void main() { alias T = immutable(shared(int)); static assert(is(T==immutable)); static assert(is(T==shared)); } It probably doesn't make sense to have immutable shared data but the grammar indicates that there can be many of them without any explicit restriction. Is it

Re: Code example for function/delegate as template argument ?

2016-05-04 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 4 May 2016 at 11:19:59 UTC, chmike wrote: I think you misunderstood the second question. Here is another attempt with an example. // function accepting a function as argument void foo(function void fg(int)) { fg(5); } // A class with a none static method with the same

Re: Code example for function/delegate as template argument ?

2016-05-04 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 4 May 2016 at 10:58:04 UTC, chmike wrote: On Wednesday, 4 May 2016 at 06:59:00 UTC, Basile B. wrote: . . . void main(string[] args) { alias fun = (a) => a.writeln; auto foo = Foo!fun("hello"); } Is this equivalent to Foo!(a => a.writeln) or is it required to split this

Re: Code example for function/delegate as template argument ?

2016-05-04 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 4 May 2016 at 06:21:36 UTC, chmike wrote: Hello, I failed to find some code example for a template class/struct that accept a function/delegate as template argument. All examples I could find use simple value types like int or double. I piggy bag another question. Defining a

Re: Code example for function/delegate as template argument ?

2016-05-04 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 4 May 2016 at 06:21:36 UTC, chmike wrote: Hello, I failed to find some code example for a template class/struct that accept a function/delegate as template argument. All examples I could find use simple value types like int or double. I piggy bag another question. Defining a

Re: inferred size for static array initialization

2016-05-03 Thread Basile B. via Digitalmars-d-learn
On Monday, 2 May 2016 at 17:43:56 UTC, Namespace wrote: I still like auto s(T, size_t n)(T[n] arr) { return arr; } Wooah, this trick is awesome. But actually it does the same thing that what I've proposed before. Exactly the same code is generated. So I'd say that it's rather a

Re: inferred size for static array initialization

2016-05-02 Thread Basile B via Digitalmars-d-learn
On Monday, 2 May 2016 at 13:22:01 UTC, Basile B wrote: On Monday, 2 May 2016 at 13:00:27 UTC, Erik Smith wrote: Is there a way to initialize a static array and have it's size inferred (and that works for arrays of structs using braced literals)? This would make it easier to maintain longer

Re: inferred size for static array initialization

2016-05-02 Thread Basile B via Digitalmars-d-learn
On Monday, 2 May 2016 at 13:00:27 UTC, Erik Smith wrote: Is there a way to initialize a static array and have it's size inferred (and that works for arrays of structs using braced literals)? This would make it easier to maintain longer static array definitions. The code below doesn't work

Re: Using private constructor with std.experimental.allocater:make

2016-05-02 Thread Basile B via Digitalmars-d-learn
On Monday, 2 May 2016 at 04:19:48 UTC, earthfront wrote: On Sunday, 1 May 2016 at 19:18:38 UTC, Basile B wrote: CT make(CT, Alloc, A...)(auto ref Alloc al, A a) This works. Thank you. Good point about __ctor alone not being sufficient. auto memory = al.allocate(size); ...

Re: Using private constructor with std.experimental.allocater:make

2016-05-01 Thread Basile B via Digitalmars-d-learn
On Sunday, 1 May 2016 at 11:17:27 UTC, earthfront wrote: Hello! This code fails: - void main(){ class A { int b; private this(int a){b=a;} } //{ int b; this(int a){b=a;} } import std.conv:emplace; import std.experimental.allocator.mallocator:Mallocator; import

Re: Using a string generated at compile-time in a @nogc function

2016-05-01 Thread Basile B via Digitalmars-d-learn
On Sunday, 1 May 2016 at 13:22:27 UTC, Mithun Hunsur wrote: On Sunday, 1 May 2016 at 10:37:23 UTC, Anonymouse wrote: On Sunday, 1 May 2016 at 05:28:36 UTC, Mithun Hunsur wrote: Hi all, I'm working on removing the string mixins from my code, but have run into an issue:

Re: relative benefit of .reserve and .length

2016-04-28 Thread Basile B. via Digitalmars-d-learn
On Thursday, 28 April 2016 at 12:56:24 UTC, Jay Norwood wrote: I timed some code recently and found that .reserve made almost no improvement when appending. It appears that the actual change to the length by the append had a very high overhead of something over 200 instructions executed,

Re: Linker error for d.o: relocation R_X86_64_32 against `__dmd_personality_v0'

2016-04-23 Thread Basile B. via Digitalmars-d-learn
On Saturday, 23 April 2016 at 17:06:07 UTC, rcorre wrote: On Saturday, 23 April 2016 at 00:55:07 UTC, rcorre wrote: On Friday, 22 April 2016 at 10:25:34 UTC, Chris wrote: [...] No luck with cmain.d. Its definitely an environmental problem -- I have an almost identical Archlinux desktop that

Re: Enabling Only Top-Level Unittests

2016-04-23 Thread Basile B via Digitalmars-d-learn
On Friday, 22 April 2016 at 18:18:39 UTC, Basile B. wrote: I think a DMD option should be added to allow the tests to be compiled but never called, something like -runTests. Because the first solution is much more attractive. Actually the first solution works with:

Re: Enabling Only Top-Level Unittests

2016-04-22 Thread Basile B. via Digitalmars-d-learn
On Thursday, 21 April 2016 at 19:38:21 UTC, Nordlöw wrote: On Thursday, 21 April 2016 at 12:35:42 UTC, Anonymouse wrote: Then dmd -unittest -version=TestDeps if you want them run. This doesn't make things easier. I want to disable the builtin unittests of the modules I've imported. This

Re: foreach of classes

2016-04-09 Thread Basile B. via Digitalmars-d-learn
On Saturday, 9 April 2016 at 11:03:54 UTC, Nicholas Wilson wrote: On Saturday, 9 April 2016 at 10:56:34 UTC, Lucien wrote: On Saturday, 9 April 2016 at 10:28:05 UTC, Basile B. wrote: On Saturday, 9 April 2016 at 10:10:19 UTC, Lucien wrote: Hello. FYI the things that you can put there (in

Re: foreach of classes

2016-04-09 Thread Basile B. via Digitalmars-d-learn
On Saturday, 9 April 2016 at 10:10:19 UTC, Lucien wrote: Hello. When I do: - class MyClass{..} class YourClass{..} class OurClass{..} YourClass yc = new YourClass(); foreach (auto id; [ typeid(MyClass), typeid(YourClass), typeid(OurClass) ]) { if (typeid(yc) == id)

Re: More binary I/O problems

2016-04-08 Thread Basile B. via Digitalmars-d-learn
On Saturday, 9 April 2016 at 03:15:58 UTC, Charles Hixson wrote: On 04/08/2016 07:42 PM, Basile B. via Digitalmars-d-learn wrote: On Friday, 8 April 2016 at 20:58:06 UTC, Charles Hixson wrote: [...] And that worked, but suddenly (after a compiler upgrade, did that matter? I'd also changed

Re: More binary I/O problems

2016-04-08 Thread Basile B. via Digitalmars-d-learn
On Friday, 8 April 2016 at 20:58:06 UTC, Charles Hixson wrote: [...] And that worked, but suddenly (after a compiler upgrade, did that matter? I'd also changed the program, though in ways that shouldn't have affected this.) it stopped working with the message: let4a.d(138): Error: no []

Re: What's the rationale for considering "0x1.max" as invalid ?

2016-04-05 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 5 April 2016 at 21:10:47 UTC, Basile B. wrote: On Tuesday, 5 April 2016 at 20:56:54 UTC, Alex Parrill wrote: On Tuesday, 5 April 2016 at 19:00:43 UTC, Basile B. wrote: 0x1.max // exponent expected in hex float 0x1 .max // OK 1.max // OK What's the ambiguity when it's an hex

Re: What's the rationale for considering "0x1.max" as invalid ?

2016-04-05 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 5 April 2016 at 20:56:54 UTC, Alex Parrill wrote: On Tuesday, 5 April 2016 at 19:00:43 UTC, Basile B. wrote: 0x1.max // exponent expected in hex float 0x1 .max // OK 1.max // OK What's the ambiguity when it's an hex literal ? It's potentially ambiguous with hexadecimal floating

Re: What's the rationale for considering "0x1.max" as invalid ?

2016-04-05 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 5 April 2016 at 19:00:43 UTC, Basile B. wrote: 0x1.max // exponent expected in hex float 0x1 .max // OK 1.max // OK What's the ambiguity when it's an hex literal ? https://issues.dlang.org/show_bug.cgi?id=15880

What's the rationale for considering "0x1.max" as invalid ?

2016-04-05 Thread Basile B. via Digitalmars-d-learn
0x1.max // exponent expected in hex float 0x1 .max // OK 1.max // OK What's the ambiguity when it's an hex literal ?

Re: Convert wchar* to wstring?

2016-04-05 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 5 April 2016 at 01:21:55 UTC, Thalamus wrote: I'm sorry for this total newbie question, but for some reason this is eluding me. [...] You've been given the right answer by the other participants but I'd like to share this simple helper range from my user lib: auto

Re: Async read an output stream but how many bytes ?

2016-03-31 Thread Basile B. via Digitalmars-d-learn
On Thursday, 31 March 2016 at 13:48:46 UTC, Steven Schveighoffer wrote: stdio.readf is buffered. It does not deal with async io properly I think. -Steve Yes, I must use core.sys.posix.unistd.read, which was actually what A.D.Ruppe suggested, I think.

Re: Async read an output stream but how many bytes ?

2016-03-30 Thread Basile B. via Digitalmars-d-learn
On Thursday, 31 March 2016 at 01:12:50 UTC, Adam D. Ruppe wrote: On Thursday, 31 March 2016 at 00:50:16 UTC, Basile B. wrote: There should be a way to know how many bytes are available ? You are already using poll()... I'd just use read() directly on the file number too. It will read as much

Async read an output stream but how many bytes ?

2016-03-30 Thread Basile B. via Digitalmars-d-learn
Hey, I have a class that wraps a process and implements two events. One of them is called after poll() for example if new data are available. The event is called correctly but I don't know how exactly how to read the data: - per buffer of fixed size ? - using the stream information ? If i

Re: char array weirdness

2016-03-29 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 30 March 2016 at 00:05:29 UTC, Steven Schveighoffer wrote: On 3/29/16 7:42 PM, H. S. Teoh via Digitalmars-d-learn wrote: On Tue, Mar 29, 2016 at 11:15:26PM +, Basile B. via Digitalmars-d-learn wrote: On Monday, 28 March 2016 at 22:34:31 UTC, Jack Stouffer wrote: void main

Re: char array weirdness

2016-03-29 Thread Basile B. via Digitalmars-d-learn
On Monday, 28 March 2016 at 22:34:31 UTC, Jack Stouffer wrote: void main () { import std.range.primitives; char[] val = ['1', '0', 'h', '3', '6', 'm', '2', '8', 's']; pragma(msg, ElementEncodingType!(typeof(val))); pragma(msg, typeof(val.front)); } prints char dchar

Re: How do I extend an enum?

2016-03-19 Thread Basile B. via Digitalmars-d-learn
On Saturday, 19 March 2016 at 17:40:27 UTC, Lass Safin wrote: Why: enum Base { A, B, } enum Derived : Base { C, // Gives error, says it can't implicitly convert expression to Base. D = 1, // Same error E = cast(Base)294, // Finally works. Can only be cast(Derived)

Re: size_t index=-1;

2016-03-19 Thread Basile B. via Digitalmars-d-learn
On Saturday, 19 March 2016 at 10:24:41 UTC, Ola Fosheim Grøstad wrote: On Saturday, 19 March 2016 at 10:01:41 UTC, Basile B. wrote: On Saturday, 19 March 2016 at 09:33:25 UTC, tsbockman wrote: [...] The reason that *attempting* such a comparison produces such weird results, is because the

Re: size_t index=-1;

2016-03-19 Thread Basile B. via Digitalmars-d-learn
On Saturday, 19 March 2016 at 09:33:25 UTC, tsbockman wrote: [...] The reason that *attempting* such a comparison produces such weird results, is because the signed value is being implicitly cast to an unsigned type. Yes and that's the opposite that should happend: when signed and unsigned

Re: How to list all version identifiers?

2016-03-13 Thread Basile B. via Digitalmars-d-learn
On Sunday, 13 March 2016 at 16:28:50 UTC, Iakh wrote: On Sunday, 13 March 2016 at 15:50:47 UTC, Basile B. wrote: trivial answer, let's say you have dcd-server running in the background: dcd-client -c8 <<< "version(" Thanks. Will try. But it was a joke actually. It works but this is not

Re: How to return a const handle (view) to a mutable member of an agregate

2016-03-13 Thread Basile B. via Digitalmars-d-learn
On Sunday, 13 March 2016 at 20:10:57 UTC, Basile B. wrote: Unless the result is explicitly cast later it can't me modified. import std.stdio, std.container.array; struct Foo { private Array!int arr; ref const(Array!int) view() { return arr; } } void main(string[]

Re: How to return a const handle (view) to a mutable member of an agregate

2016-03-13 Thread Basile B. via Digitalmars-d-learn
On Sunday, 13 March 2016 at 19:37:42 UTC, ParticlePeter wrote: I have a struct that privately warps an std.container.array. I would like to return a read-only reference of this array, it should not be duplicated. How can I do this? Cheers, ParticlePeter ref const(Array!Type) view(){}

Re: How to list all version identifiers?

2016-03-13 Thread Basile B. via Digitalmars-d-learn
On Sunday, 13 March 2016 at 15:15:22 UTC, Iakh wrote: There is trick for gcc: gcc -dM -E - < /dev/null It shows all default #defines Is there way to show all version identifiers for D? For all or any compiler you know trivial answer, let's say you have dcd-server running in the background:

Re: In D, lexically, which are the chars that can follow $, exactly ?

2016-03-13 Thread Basile B. via Digitalmars-d-learn
On Sunday, 13 March 2016 at 14:55:36 UTC, Marc Schütz wrote: On Sunday, 13 March 2016 at 14:07:31 UTC, Basile B. wrote: '$' is only valid in an indexExpression (https://dlang.org/spec/grammar.html#IndexExpression), so it can only be followed by - ' ' - ']' - operators , usually '-' but also

In D, lexically, which are the chars that can follow $, exactly ?

2016-03-13 Thread Basile B. via Digitalmars-d-learn
'$' is only valid in an indexExpression (https://dlang.org/spec/grammar.html#IndexExpression), so it can only be followed by - ' ' - ']' - operators , usually '-' but also '/', '+', '>>' etc Is that right ? I'd like to relax the lexical rule for C.E static macros which currently is -

Re: BZ2 library

2016-03-12 Thread Basile B. via Digitalmars-d-learn
On Saturday, 12 March 2016 at 09:53:36 UTC, stunaep wrote: On Saturday, 12 March 2016 at 07:56:03 UTC, Mike Parker wrote: [...] On Saturday, 12 March 2016 at 09:04:08 UTC, stunaep wrote: On Saturday, 12 March 2016 at 07:56:03 UTC, Mike Parker wrote: [...] If I do "dflags" :

Re: BZ2 library

2016-03-11 Thread Basile B. via Digitalmars-d-learn
On Saturday, 12 March 2016 at 05:16:37 UTC, stunaep wrote: I'm really having a hard time using bzp (and later I need gzip and lzma). So I added this bzip2 D interface to my DUB dependencies "dependencies" : { "bzip2": "~>0.1.0" } I downloaded the bzip2 source code and compiled

Re: Reserving capacity in associative arrays

2016-02-16 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 16 February 2016 at 16:37:07 UTC, Steven Schveighoffer wrote: There is not a public way to access these methods unfortunately. It would be a good addition to druntime I believe. Recently, I added a clear method to the AA, which does not reduce capacity. So if you frequently build

Re: How to warn of unused imports?

2016-02-09 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 9 February 2016 at 17:54:30 UTC, Basile B. wrote: On Tuesday, 9 February 2016 at 15:21:59 UTC, Basile B. wrote: On Monday, 8 February 2016 at 20:48:29 UTC, cy wrote: On Monday, 8 February 2016 at 18:57:52 UTC, Basile B. wrote: Otherwise, it sounds like a decent enhancement request

Re: How to warn of unused imports?

2016-02-09 Thread Basile B. via Digitalmars-d-learn
On Monday, 8 February 2016 at 20:48:29 UTC, cy wrote: On Monday, 8 February 2016 at 18:57:52 UTC, Basile B. wrote: Otherwise, it sounds like a decent enhancement request for DMD. I know other compilers who do this warning. It definitely does sound like a decent enhancement request. I didn't

Re: How to warn of unused imports?

2016-02-09 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 9 February 2016 at 15:21:59 UTC, Basile B. wrote: On Monday, 8 February 2016 at 20:48:29 UTC, cy wrote: On Monday, 8 February 2016 at 18:57:52 UTC, Basile B. wrote: Otherwise, it sounds like a decent enhancement request for DMD. I know other compilers who do this warning. It

Re: How do you reference variables in an AA of Variants?

2016-02-08 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 9 February 2016 at 03:49:11 UTC, Enjoys Math wrote: This: double b = 1.0; Variant[string] aa = ["b": ]; writeln(aa["b"]); fails with: Error: cannot implicitly convert expression(["b":]) of type double*[string] to VariantN!20u[string] Helps please!

Re: Can D interface with Free Pascal?

2016-02-08 Thread Basile B. via Digitalmars-d-learn
On Thursday, 28 January 2016 at 04:26:26 UTC, Taylor Hillegeist wrote: Just curious... I had a thought that perhaps since Objective C was a replacement for Pascal on the mac. that they might have the same interface. but I'm not savvy enough with fpc to figure out how to try it. As said in

Re: How to warn of unused imports?

2016-02-08 Thread Basile B. via Digitalmars-d-learn
On Monday, 8 February 2016 at 08:50:17 UTC, Daniel Kozak wrote: V Mon, 08 Feb 2016 08:25:09 + cy via Digitalmars-d-learn napsáno: When I factor out code from my modules, it really, really often leaves import statements that just sit there doing

Re: Capturing a variable by value?

2016-02-03 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 3 February 2016 at 18:09:52 UTC, ZombineDev wrote: I think these two links, more or less, answer my question: http://stackoverflow.com/questions/29759419/closures-in-loops-capturing-by-reference https://issues.dlang.org/show_bug.cgi?id=2043 Another approach: import std.range,

Re: is(some template instantiation) is true, but the actual instantiation fails

2016-01-29 Thread Basile B. via Digitalmars-d-learn
On Friday, 29 January 2016 at 15:28:29 UTC, Adrian Matoga wrote: How can I reliably test if CallsFoo can be instantiated? You can use a constraint to prevent invalid instantiation: struct HasFoo { void foo() {} } struct NoFoo {} struct CallsFoo(T) if (__traits(hasMember, T, "foo")) {

Re: is(some template instantiation) is true, but the actual instantiation fails

2016-01-29 Thread Basile B. via Digitalmars-d-learn
On Friday, 29 January 2016 at 17:01:46 UTC, Adrian Matoga wrote: On Friday, 29 January 2016 at 16:36:01 UTC, Steven Schveighoffer wrote: On 1/29/16 10:28 AM, Adrian Matoga wrote: [...] is(T) is supposed to be false if T is not a valid type. I would agree with you that the static assert

Re: opApply @safety

2016-01-29 Thread Basile B. via Digitalmars-d-learn
On Friday, 29 January 2016 at 17:44:34 UTC, Chris Wright wrote: I want to create an opApply for a type. I've marked my code @safe, because everything I wrote was @safe. The body of opApply is @safe, but it calls a delegate that may or may not be @safe. How do I make it so I can iterate

Re: how to allocate class without gc?

2016-01-28 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 27 January 2016 at 22:39:54 UTC, Igor wrote: But doesn't this ultimately defeat the purpose of having manual memory management if one has to add it to the GC to be scanned? You can make the LOC related to the GC optional with an additional bool template parameter and a static

Re: how to allocate class without gc?

2016-01-26 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 26 January 2016 at 01:09:50 UTC, Igor wrote: Is there any examples that shows how to properly allocate an object of a class type with the new allocators and then release it when desired? This is more or less the same answer as you've get previously except that I don't use emplace

Re: Variable below zero but if statement doesn't grab?

2016-01-15 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 5 January 2016 at 23:52:05 UTC, Basile B. wrote: On Monday, 28 December 2015 at 18:02:53 UTC, jkpl wrote: On Monday, 28 December 2015 at 15:50:06 UTC, Basile B. wrote: On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote: On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote:

Fuck the brits

2016-01-15 Thread Basile B. via Digitalmars-d-learn
On Friday, 15 January 2016 at 22:16:09 UTC, Basile B. wrote: On Tuesday, 5 January 2016 at 23:52:05 UTC, Basile B. wrote: On Monday, 28 December 2015 at 18:02:53 UTC, jkpl wrote: On Monday, 28 December 2015 at 15:50:06 UTC, Basile B. wrote: On Monday, 28 December 2015 at 15:07:08 UTC, jkpl

Re: version in enum

2016-01-09 Thread Basile B. via Digitalmars-d-learn
On Saturday, 9 January 2016 at 12:43:32 UTC, Øivind wrote: Hi, Why doesn't this work? Seems like it should: enum { A = 1, version(xx) { B = 2 } } It's not allowed in the grammar but I agree with you, it could be useful. Recent example where it could:

Re: Convert a hex string into a ubyte[] or OutBuffer

2016-01-07 Thread Basile B. via Digitalmars-d-learn
On Thursday, 7 January 2016 at 21:00:06 UTC, zabruk70 wrote: Hello. In modern phobos ver 2.069.1 exists template hexString https://dlang.org/phobos/std_conv.html#.hexString to convert hex string to bytes. It works in compile time only. But what if i need it in run time? Is the answer in this

Re: Convert a hex string into a ubyte[] or OutBuffer

2016-01-07 Thread Basile B. via Digitalmars-d-learn
On Thursday, 7 January 2016 at 21:00:06 UTC, zabruk70 wrote: Hello. In modern phobos ver 2.069.1 exists template hexString https://dlang.org/phobos/std_conv.html#.hexString to convert hex string to bytes. It works in compile time only. But what if i need it in run time? Is the answer in this

Re: GTKD Cairo get pixel color

2016-01-05 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 5 January 2016 at 17:16:10 UTC, TheDGuy wrote: On Tuesday, 5 January 2016 at 16:43:00 UTC, Basile B. wrote: On Tuesday, 5 January 2016 at 16:25:01 UTC, TheDGuy wrote: But how do i know which line or column my pixel is in? - study D operator overloading, I've given you the

Re: GTKD Cairo get pixel color

2016-01-05 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 5 January 2016 at 15:04:57 UTC, TheDGuy wrote: But i get "only one index allowed to index char". So it looks like there is no 2D array but just a char. If i try like this: The data is just a contiguous memory area. You have to implement your own opIndexAssign()/opIndex() to

Re: GTKD Cairo get pixel color

2016-01-05 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 5 January 2016 at 16:25:01 UTC, TheDGuy wrote: But how do i know which line or column my pixel is in? - study D operator overloading, I've given you the solution. And what is 't' in 'opIndexAssign'? - t is what you want to assign. It can be an uint or maybe a float[4]. Look at my

Re: GTKD Cairo get pixel color

2016-01-05 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 5 January 2016 at 17:37:04 UTC, TheDGuy wrote: On Tuesday, 5 January 2016 at 17:34:06 UTC, Basile B. wrote: On Tuesday, 5 January 2016 at 17:16:10 UTC, TheDGuy wrote: On Tuesday, 5 January 2016 at 16:43:00 UTC, Basile B. wrote: [...] Okay, but what is this? "import iz.memory,

Re: GTKD Cairo get pixel color

2016-01-05 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 5 January 2016 at 18:19:08 UTC, Basile B. wrote: On Tuesday, 5 January 2016 at 17:39:41 UTC, Basile B. wrote: IDK, except D I only speek/talk Object Pascal (FPC/Delphi). "I didn't know, apart D, I only speak/talk Object Pascal (FPC/Delphi)." Was what I meant. ^^

Re: GTKD Cairo get pixel color

2016-01-05 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 5 January 2016 at 17:39:41 UTC, Basile B. wrote: IDK, except D I only speek/talk Object Pascal (FPC/Delphi). "I didn't know, apart D, I only speak/talk Object Pascal (FPC/Delphi)." Was what I meant. ^^

Re: Lots of D code

2016-01-05 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 23 December 2015 at 00:59:53 UTC, steven kladitis wrote: I have 843 programs written in D. 805 actually create an 32 bit exe in windows 10. I am running the latest D. Some just start to link and the linker disappears. Some just have issues I am not able figure out. I can attach

Re: GTKD Cairo get pixel color

2016-01-05 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 5 January 2016 at 21:24:51 UTC, Ola Fosheim Grøstad wrote: On Tuesday, 5 January 2016 at 21:01:55 UTC, Basile B. wrote: Awww... I'm so sorry. https://youtu.be/uyMUck2RRjw du bist normal oder idiot ? https://www.youtube.com/watch?v=nGLwBCMSXys

Re: GTKD Cairo get pixel color

2016-01-05 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 5 January 2016 at 22:08:52 UTC, Ola Fosheim Grøstad wrote: On Tuesday, 5 January 2016 at 22:02:47 UTC, Basile B. wrote: du bist normal oder idiot ? https://youtu.be/7kjTXMecCrM Ding dong! https://en.wikipedia.org/wiki/Turing_Award Si tu crois que tu es un génie, il y a de

Re: GTKD Cairo get pixel color

2016-01-05 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 5 January 2016 at 19:13:35 UTC, Basile B. wrote: On Tuesday, 5 January 2016 at 18:19:08 UTC, Basile B. wrote: On Tuesday, 5 January 2016 at 17:39:41 UTC, Basile B. wrote: IDK, except D I only speek/talk Object Pascal (FPC/Delphi). "I didn't know, apart D, I only speak/talk Object

Re: GTKD Cairo get pixel color

2016-01-05 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 5 January 2016 at 19:47:02 UTC, Basile B. wrote: On Tuesday, 5 January 2016 at 19:13:35 UTC, Basile B. wrote: On Tuesday, 5 January 2016 at 18:19:08 UTC, Basile B. wrote: On Tuesday, 5 January 2016 at 17:39:41 UTC, Basile B. wrote: IDK, except D I only speek/talk Object Pascal

Re: GTKD Cairo get pixel color

2016-01-05 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 5 January 2016 at 23:36:16 UTC, Ola Fosheim Grøstad wrote: On Tuesday, 5 January 2016 at 23:26:12 UTC, Basile B. wrote: access to pix is easy... This is the learn forum. Maybe one should be able to figure it out without asking, but there is nothing wrong with asking in depth on

Re: GTKD Cairo get pixel color

2016-01-05 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 5 January 2016 at 22:40:22 UTC, Basile B. wrote: On Tuesday, 5 January 2016 at 22:08:52 UTC, Ola Fosheim Grøstad wrote: On Tuesday, 5 January 2016 at 22:02:47 UTC, Basile B. wrote: du bist normal oder idiot ? https://youtu.be/7kjTXMecCrM Ding dong!

Re: Variable below zero but if statement doesn't grab?

2016-01-05 Thread Basile B. via Digitalmars-d-learn
On Monday, 28 December 2015 at 18:02:53 UTC, jkpl wrote: On Monday, 28 December 2015 at 15:50:06 UTC, Basile B. wrote: On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote: On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote: On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote:

Re: GTKD Cairo get pixel color

2016-01-04 Thread Basile B. via Digitalmars-d-learn
On Friday, 1 January 2016 at 22:00:04 UTC, TheDGuy wrote: On Friday, 1 January 2016 at 19:32:40 UTC, Basile B. wrote: On Wednesday, 30 December 2015 at 23:20:23 UTC, Basile B. wrote: On Wednesday, 30 December 2015 at 20:44:44 UTC, TheDGuy wrote: Hello, is there any way to get the pixel color

Re: Size of Compiled Program

2016-01-04 Thread Basile B. via Digitalmars-d-learn
On Monday, 4 January 2016 at 13:49:03 UTC, Martin Tschierschke wrote: When I was writing a small speed test - D versus Ruby, calculating the first n prime numbers, I realized, that for small n Ruby may be faster, than compiling and executing with D. But for n = 1,000,000 D outperforms Ruby by

Re: GTKD Cairo get pixel color

2016-01-01 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 30 December 2015 at 23:20:23 UTC, Basile B. wrote: On Wednesday, 30 December 2015 at 20:44:44 UTC, TheDGuy wrote: Hello, is there any way to get the pixel color of a single pixel by x and y coordinates of a context? render to a png back buffer. see

Re: GTKD Cairo get pixel color

2015-12-30 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 30 December 2015 at 20:44:44 UTC, TheDGuy wrote: Hello, is there any way to get the pixel color of a single pixel by x and y coordinates of a context? render to a png back buffer. see cairo_image_surface_create_for_data then you'll be able to access the data and, at the same

Re: Lots of D code

2015-12-28 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 23 December 2015 at 00:59:53 UTC, steven kladitis wrote: I have 843 programs written in D. 805 actually create an 32 bit exe in windows 10. I am running the latest D. Some just start to link and the linker disappears. Some just have issues I am not able figure out. I can attach

are MRV as an optimization well known ?

2015-12-28 Thread Basile B. via Digitalmars-d-learn
While working on a framework, I've found that Multiple Return Values (MRV) are clearly an optimization. I'de like to write a small D blog post about this but I don't know If it's clever enough or if it's a well know fact. My base D material is this: --- #!runnable-flags: -O -boundscheck=off

Re: are MRV as an optimization well known ?

2015-12-28 Thread Basile B. via Digitalmars-d-learn
I mean it's maybe "just" a special case of RVO, since tuples are processed as structs ?

Re: Multiple selective imports on one line

2015-12-28 Thread Basile B. via Digitalmars-d-learn
On Monday, 28 December 2015 at 14:16:36 UTC, Basile B. wrote: On Monday, 28 December 2015 at 14:09:30 UTC, Joakim wrote: I wish dfmt could do this for us, so that you develop with all the modules imported at the top, then run dfmt and it scopes all the imports and adds the selective import of

Re: Multiple selective imports on one line

2015-12-28 Thread Basile B. via Digitalmars-d-learn
On Monday, 28 December 2015 at 14:09:30 UTC, Joakim wrote: I wish dfmt could do this for us, so that you develop with all the modules imported at the top, then run dfmt and it scopes all the imports and adds the selective import of symbols. I've been thinking about implementing a tool to do

Re: are MRV as an optimization well known ?

2015-12-28 Thread Basile B. via Digitalmars-d-learn
On Monday, 28 December 2015 at 12:40:09 UTC, Basile B. wrote: I mean it's maybe "just" a special case of RVO, since tuples are processed as structs ? Also in the second version the stack size is modified by 78 bytes. Not when using MRV.

Re: Variable below zero but if statement doesn't grab?

2015-12-28 Thread Basile B. via Digitalmars-d-learn
On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote: On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote: On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote: Any idea what i am doing wrong? https://www.youtube.com/watch?v=j_VCa-5VeP8 You could post the code also, personnaly

<    2   3   4   5   6   7   8   >