Re: AliasSeq in UDA

2019-03-10 Thread Basile B. via Digitalmars-d-learn
On Sunday, 10 March 2019 at 16:05:19 UTC, Sebastiaan Koppe wrote: On Sunday, 10 March 2019 at 13:41:32 UTC, Basile B. wrote: It looks like a bug, a "reject-valid" one. Try the same code with enum A = 0; and it work, despite of B being still opaque. The problem may be related to the fact t

Re: AliasSeq in UDA

2019-03-10 Thread Basile B. via Digitalmars-d-learn
On Sunday, 10 March 2019 at 17:04:20 UTC, Sebastiaan Koppe wrote: On Sunday, 10 March 2019 at 16:46:43 UTC, Basile B. wrote: Yes I see. I've refined a bit the test case and maybe I'll took a look this week. Cool. Is it normal to create a testcase that doesn't depend on phobos? I suppose it is

Re: Setting the GtkD Include Path in dexed?

2019-03-13 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 12 March 2019 at 15:48:14 UTC, Ron Tarrant wrote: I managed to get dexed to compile a single-file dub project, but for completeness sake, I'm also trying to configure it to use dmd (non-dub) to compile GtkD projects using Compilation (menu) > Compile File and Run. To that end, I h

Re: Setting the GtkD Include Path in dexed?

2019-03-14 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 12 March 2019 at 15:48:14 UTC, Ron Tarrant wrote: I managed to get dexed to compile a single-file dub project, but for completeness sake, I'm also trying to configure it to use dmd (non-dub) to compile GtkD projects using Compilation (menu) > Compile File and Run. To that end, I h

Re: Setting the GtkD Include Path in dexed?

2019-03-14 Thread Basile B. via Digitalmars-d-learn
On Thursday, 14 March 2019 at 15:50:55 UTC, Ron Tarrant wrote: Thanks for replying, Basile. It's always nice to get info straight from the original code author. :) On Wednesday, 13 March 2019 at 11:59:11 UTC, Basile B. wrote: 1. "Compile File and Run" It's for the scripts-like program, i.e s

Re: Setting the GtkD Include Path in dexed?

2019-03-14 Thread Basile B. via Digitalmars-d-learn
On Thursday, 14 March 2019 at 20:06:08 UTC, Ron Tarrant wrote: On Thursday, 14 March 2019 at 16:02:01 UTC, Basile B. wrote: You must register put the static library file, not the object I thing, anyway, i just made you a video showing exactly what to do since finally the linker error is gone (

Re: Efficient enum array keys?

2019-04-10 Thread Basile B. via Digitalmars-d-learn
On Thursday, 11 April 2019 at 06:20:05 UTC, Julian wrote: Hello, When reading through the following D blog post, I noticed in the feature chart that D had "Arrays beginning at arbitrary indices" as a +1 feature, the same as in Ada. https://dlang.org/blog/2018/06/20/how-an-engineering-company-

Re: Efficient enum array keys?

2019-04-11 Thread Basile B. via Digitalmars-d-learn
On Thursday, 11 April 2019 at 07:56:42 UTC, Julian wrote: On Thursday, 11 April 2019 at 06:45:23 UTC, Basile B. wrote: On Thursday, 11 April 2019 at 06:20:05 UTC, Julian wrote: I don't see a difference in micro-benchmarks. *shrug* Your enum is int so in machine code it's exactly like processi

Re: Performance of tables slower than built in?

2019-05-22 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 22 May 2019 at 08:25:58 UTC, Basile B. wrote: On Wednesday, 22 May 2019 at 00:22:09 UTC, JS wrote: I am trying to create some fast sin, sinc, and exponential routines to speed up some code by using tables... but it seems it's slower than the function itself?!? [...] Hi, lookup

Re: Performance of tables slower than built in?

2019-05-22 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 22 May 2019 at 00:22:09 UTC, JS wrote: I am trying to create some fast sin, sinc, and exponential routines to speed up some code by using tables... but it seems it's slower than the function itself?!? [...] Hi, lookup tables ARE faster but the problem you have here, and I'm su

Re: Bitfields

2019-05-22 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 22 May 2019 at 08:54:45 UTC, Russel Winder wrote: On Tue, 2019-05-21 at 19:14 +, Era Scarecrow via Digitalmars-d-learn wrote: […] I worked on/with bitfields in the past, the limit sizes is more or less for natural int types that D supports. Rust bitfield crate and it's

Re: import and call

2019-06-02 Thread Basile B. via Digitalmars-d-learn
On Sunday, 2 June 2019 at 19:38:11 UTC, Amex wrote: Tired of having to import a single function to call it. Since mod.foo(x); doesn't work since mod is not defined. we have to do import mod : foo; foo(x); Why not mod:foo(x)? or mod#foo(x) or mod@foo(x) or whatever Reduces 50% of the

Re: Very simple null reference escape

2019-06-02 Thread Basile B. via Digitalmars-d-learn
On Sunday, 2 June 2019 at 07:55:27 UTC, Amex wrote: A.B If A is null, crash. A?.B : writeln("HAHA"); No crash, ignored, equivalent to if (A is null) writeln("HAHA"); else A.B; safeAccess from iz does this : https://github.com/Basile-z/iz/blob/master/import/iz/sugar.d#L1666

Re: D compiler need -nogc witch and document of library also need nogc button

2019-06-11 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 11 June 2019 at 08:05:31 UTC, dangbinghoo wrote: hi there, I think that D compiler needs -nogc switch to fully disable gc for a project, and document of phobos also needs a friendly way to list-out all @nogc API. we already have -betterC, and betterC disabled GC, why we could no

Re: D compiler need -nogc witch and document of library also need nogc button

2019-06-11 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 11 June 2019 at 08:08:14 UTC, Basile B. wrote: On Tuesday, 11 June 2019 at 08:05:31 UTC, dangbinghoo wrote: hi there, I think that D compiler needs -nogc switch to fully disable gc for a project, and document of phobos also needs a friendly way to list-out all @nogc API. we alre

Re: Is it possible to escape a reserved keyword in Import/module?

2019-06-19 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 19 June 2019 at 19:07:30 UTC, Jonathan M Davis wrote: On Wednesday, June 19, 2019 12:56:57 PM MDT BoQsc via Digitalmars-d-learn wrote: I would like to make sure that my modules do not interfere with d lang. Is there any way to escape reserved words? https://dlang.org/spec/lex.htm

Re: Is it possible to escape a reserved keyword in Import/module?

2019-06-19 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 19 June 2019 at 21:21:53 UTC, XavierAP wrote: On Wednesday, 19 June 2019 at 18:56:57 UTC, BoQsc wrote: I would like to make sure that my modules do not interfere with d lang. Is there any way to escape reserved words? The only reason C# allows this is for interop or code genera

Re: Mixin mangled name

2019-07-03 Thread Basile B. via Digitalmars-d-learn
On Monday, 1 July 2019 at 23:52:49 UTC, Andrey wrote: Hello, Is it possible to mixin in code a mangled name of some entity so that compiler didn't emit undefined symbol error? For example mangled function name or template parameter? Yes. An example from the DMD test suite itself : https://ru

Re: Is there any way to define an interface that can implicitly convert to Object?

2019-07-10 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 10 July 2019 at 08:03:30 UTC, Nathan S. wrote: I want to be able to do things like: --- bool isSame(Object a, Object b) { return a is b; } interface SomeInterface { int whatever(); } bool failsToCompile(SomeInterface a, SomeInterface b) { return isSame(a, b); } --- Error: func

strange static assert failure

2017-07-02 Thread Basile B. via Digitalmars-d-learn
I played with some strange stuff that are allowed, i.e "super" and "this" as BasicType, when I've reached this: class B { super ringuard(){return null;} void foo() { auto crate = ringuard(); pragma(msg, typeof(crate)); static assert(typeof(crate).stringof == O

Re: strange static assert failure

2017-07-02 Thread Basile B. via Digitalmars-d-learn
On Sunday, 2 July 2017 at 08:55:42 UTC, Basile B. wrote: The second assert fails. Do you know why ? pass your way, i've forgot the typeof()... everything is okay actually.

Re: Funny issue with casting double to ulong

2017-07-02 Thread Basile B via Digitalmars-d-learn
On Monday, 3 July 2017 at 03:50:14 UTC, Saurabh Das wrote: Consider this snippet: void main() { import std.stdio; auto a = 6.2151; auto b = a * 1; auto c = cast(ulong)b; writeln("a: ", typeof(a).stringof, " ", a); writeln("b: ", typeof(b).stringof, " ", b); writel

Re: safe method overloading with different refness of its arguments

2017-07-04 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 4 July 2017 at 10:40:42 UTC, drug wrote: ``` struct Foo { ubyte width, length; // by reference bool opEquals(ref const(Foo) other) const pure @safe { if (width != other.width) return false; if (length != other.length) return fal

Re: char e string em linguagem D

2017-07-13 Thread Basile B. via Digitalmars-d-learn
On Thursday, 13 July 2017 at 22:30:29 UTC, crimaniak wrote: On Thursday, 13 July 2017 at 21:49:40 UTC, dark777 wrote: char[] stalman() { return cast(char[])` ((__-^^-,-^^-__)) *---***---* *--|o o|--* \

Re: Check whether string value represents a type

2017-07-24 Thread Basile B. via Digitalmars-d-learn
On Friday, 21 July 2017 at 14:21:37 UTC, Timoses wrote: I'd love to check whether a string value is the name of a type at run-time. [...] The goal is to identify whether a string represents a custom type within a package. I'm also trying to iterate over all modules within the package to get th

Re: How to make autocompletion for IDE?

2017-07-25 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 25 July 2017 at 10:32:11 UTC, unDEFER wrote: On Tuesday, 25 July 2017 at 10:24:13 UTC, Andrea Fontana wrote: On Tuesday, 25 July 2017 at 10:23:33 UTC, Andrea Fontana wrote: On Tuesday, 25 July 2017 at 10:06:47 UTC, unDEFER wrote: Any ideas? I think you should use/contribute to DC

Re: call Pascal DLL functions from D

2017-10-24 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 25 October 2017 at 03:12:56 UTC, Oleg B wrote: Hello. I have DLL written on Pascal and "headers" for use it (types and functions signatures definitions). How I can port "headers" to D? Calling convention is `stdcall` (`extern (Windows)` for D), arguments of some functions is str

Re: call Pascal DLL functions from D

2017-10-25 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 25 October 2017 at 10:47:56 UTC, Oleg B wrote: On Wednesday, 25 October 2017 at 04:30:12 UTC, Basile B. wrote: If I wrote `array[5..7] of ...` I get array that can be indexed by `5`, `6` and `7`, right? It means that array have 3 elements. If A=5, B=7 then length of array is B-A+1

Re: opCast fails when this is null.

2017-10-28 Thread Basile B. via Digitalmars-d-learn
On Saturday, 28 October 2017 at 13:24:49 UTC, Mike Wey wrote: The following code runs correctly when compiled with ldc (1.4.0) but fails with an assert error when compiled with dmd (2.076 and ldc 1.2.0) ``` class A { } class B { T opCast(T)() { return this;

Re: "version" private word

2017-11-01 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 31 October 2017 at 13:46:40 UTC, Igor Shirkalin wrote: Hello! We need some conditional compilation using 'version'. Say we have some code to be compiled for X86 and X86_64. How can we do that using predefined (or other) versions? Examples: version(X86 || X86_64) // failed vers

Re: Any book recommendation for writing a compiler?

2017-11-02 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 1 November 2017 at 20:53:44 UTC, Dr. Assembly wrote: Hey guys, if I were to get into dmd's source code to play a little bit (just for fun, no commercial use at all), which books/resources do you recommend to start out? You don't need to read books to write a compiler, a bit of th

Re: private keyword dont appear to do anything

2017-11-04 Thread Basile B. via Digitalmars-d-learn
On Friday, 3 November 2017 at 12:43:15 UTC, rikki cattermole wrote: Visibility modifiers like private, and public are to the module not the scope. "Symbols with private visibility can only be accessed from within the same module." This is how module based languages work, Pascal has "strict

Re: Any book recommendation for writing a compiler?

2017-11-04 Thread Basile B. via Digitalmars-d-learn
On Thursday, 2 November 2017 at 14:24:01 UTC, Basile B. wrote: On Wednesday, 1 November 2017 at 20:53:44 UTC, Dr. Assembly wrote: Hey guys, if I were to get into dmd's source code to play a little bit (just for fun, no commercial use at all), which books/resources do you recommend to start out?

Re: Any book recommendation for writing a compiler?

2017-11-06 Thread Basile B. via Digitalmars-d-learn
On Saturday, 4 November 2017 at 20:28:17 UTC, Ola Fosheim Grøstad wrote: On Saturday, 4 November 2017 at 15:51:30 UTC, Basile B. wrote: People who say that after reading the dragon book, you will program your own programming language are lying. Well, you most certainly can write your own progr

Re: Inline assembly question

2017-11-12 Thread Basile B. via Digitalmars-d-learn
On Sunday, 12 November 2017 at 11:01:39 UTC, Dibyendu Majumdar wrote: Hi, [...] The assembly code uses static allocation of registers, but because of the differences in how registers are used in Win64 versus Unix X64 - different registers are assigned depending on the architecture. dynasm make

Re: Inline assembly question

2017-11-12 Thread Basile B. via Digitalmars-d-learn
On Sunday, 12 November 2017 at 12:17:51 UTC, Dibyendu Majumdar wrote: On Sunday, 12 November 2017 at 11:55:23 UTC, Eugene Wissner wrote: [...] Thank you - I probably could use something like this. It is uglier than the simpler approach in dynasm of course. How about when I need to combine t

Re: Automatic insertion of D-style multiline-comments in Emacs

2017-11-12 Thread Basile B. via Digitalmars-d-learn
On Sunday, 12 November 2017 at 12:52:48 UTC, Nordlöw wrote: Have anybody added logic to Emacs' `comment-dwim` that automagically inserts a (Ddoc-style) multi-line comment like /** ... */ void foo { } if the cursor is currently in front of a (function) definition (or declaration)? I realize

Re: Class allocators

2017-11-12 Thread Basile B. via Digitalmars-d-learn
On Sunday, 12 November 2017 at 18:46:54 UTC, Per Nordlöw wrote: On Sunday, 12 November 2017 at 18:34:42 UTC, Eduard Staniloiu wrote: On Saturday, 11 November 2017 at 14:26:34 UTC, Nordlöw wrote: Have anybody used allocators to construct class instances? I might be wrong, but I think you are l

Re: Inline assembly question

2017-11-12 Thread Basile B. via Digitalmars-d-learn
On Sunday, 12 November 2017 at 21:27:28 UTC, Dibyendu Majumdar wrote: On Sunday, 12 November 2017 at 18:48:02 UTC, Eugene Wissner wrote: https://dlang.org/spec/iasm.html#agregate_member_offsets aggregate.member.offsetof[someregister] Sorry I didn't phrase my question accurately. Presumably to

Re: Inline assembly question

2017-11-12 Thread Basile B. via Digitalmars-d-learn
On Sunday, 12 November 2017 at 22:20:46 UTC, Dibyendu Majumdar wrote: On Sunday, 12 November 2017 at 22:00:58 UTC, Basile B. wrote: On Sunday, 12 November 2017 at 21:27:28 UTC, Dibyendu Majumdar I am not sure I have understood above; will DMD generate the right Win64 unwind info for this contri

Re: Inline assembly question

2017-11-13 Thread Basile B. via Digitalmars-d-learn
On Sunday, 12 November 2017 at 11:01:39 UTC, Dibyendu Majumdar wrote: Hi, I have recently started work on building a VM for Lua (actually a derivative of Lua) in X86-64 assembly. I am using the dynasm tool that is part of LuaJIT. I was wondering whether I could also write this in D's inline a

Re: Inline assembly question

2017-11-13 Thread Basile B. via Digitalmars-d-learn
On Monday, 13 November 2017 at 18:40:42 UTC, Basile B. wrote: On Sunday, 12 November 2017 at 11:01:39 UTC, Dibyendu Majumdar wrote: [...] TBH I wonder if this is not worth a enhancement (or even a DIP) to have in asm blocks a special alias syntax... { asm { version(...)

Re: Strange behavior of cast(int[]) json["my int list"].array

2017-11-15 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 15 November 2017 at 19:54:20 UTC, Enjoys Math wrote: I had it working in an earlier program. Now I have: main.d -- import std.json; import std.file; int main() { JSONValue settings; settings = parseJSON("settings.txt"); auto intList = cast(int[]) settings["int lis

Re: betterC and noboundscheck

2017-11-23 Thread Basile B. via Digitalmars-d-learn
On Friday, 24 November 2017 at 00:17:31 UTC, codephantom wrote: On Wednesday, 22 November 2017 at 15:10:40 UTC, Oleg B wrote: If I add -noboundscheck flag all works fine. dmd version is 2.076.1 Why -betterC flag not 'include' -noboundscheck flag? It's bug or in some cases it's useful? Inter

Instructions to build DMD from source don't work (anymore) here

2017-11-30 Thread Basile B. via Digitalmars-d-learn
Hi, I've recently switched from a linux distribution to another (F27). During the last 2 years i used a script to build DMD, unfortunately i forgot to include it in my backup. Initially i thought "No problem, there's the instructions in the wiki, it's more or less about calling make with a coup

Re: Instructions to build DMD from source don't work (anymore) here

2017-11-30 Thread Basile B. via Digitalmars-d-learn
On Thursday, 30 November 2017 at 08:38:15 UTC, Basile B. wrote: [...] All required tools are setup. I do not set AUTOBOOTSTRAP=1 since dmd 2.077 is setup. I needed gcc-c++... I don't know why but since "which g++" gave a valid file name i thought it was enough. What's the difference ?

Re: Problems with ctRegex

2017-11-30 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 28 November 2017 at 19:12:29 UTC, crimaniak wrote: First problem: it doesn't understand enums, it seems to be a bug: or just "to!string(TopicMask.publishMask)" would have worked too. [...] Is there any change to use regex inside or pure function? I just need some pure bool test()

Re: Instructions to build DMD from source don't work (anymore) here

2017-11-30 Thread Basile B. via Digitalmars-d-learn
On Thursday, 30 November 2017 at 10:47:57 UTC, Jacob Carlborg wrote: On 2017-11-30 09:56, Basile B. wrote: On Thursday, 30 November 2017 at 08:38:15 UTC, Basile B. wrote: [...] All required tools are setup. I do not set AUTOBOOTSTRAP=1 since dmd 2.077 is setup. I needed gcc-c++... I don't kn

Re: How to declare immutable struct outside of try catch and reference it later

2017-12-03 Thread Basile B. via Digitalmars-d-learn
On Sunday, 3 December 2017 at 05:49:54 UTC, Fra Mecca wrote: I have this code: Configuration conf = void ; try { conf = parse_config("config.sdl"); } catch (Exception e) { std.stdio.stderr.writeln("Error reading configuration file: ", e.msg); exit(1); }

Re: git workflow for D

2017-12-03 Thread Basile B. via Digitalmars-d-learn
On Sunday, 3 December 2017 at 20:05:47 UTC, bitwise wrote: I've finally started learning git, due to our team expanding beyond one person - awesome, right? Anyways, I've got things more or less figured out, which is nice, because being clueless about git is a big blocker for me trying to do any

Re: How to declare immutable struct outside of try catch and reference it later

2017-12-03 Thread Basile B. via Digitalmars-d-learn
On Sunday, 3 December 2017 at 22:33:40 UTC, kdevel wrote: On Sunday, 3 December 2017 at 14:58:03 UTC, Basile B. wrote: In this case i'd go for a typed pointer, e.g --- immutable struct Configuration { this(string){/*load some file...*/} int value; } Configuration* config; void main()

Re: git workflow for D

2017-12-03 Thread Basile B. via Digitalmars-d-learn
On Sunday, 3 December 2017 at 22:22:47 UTC, Arun Chandrasekaran wrote: Git CLI is arcane and esoteric. I've lost my commits before (yeah, my mistake). Who hasn't ;) Happened to me last time because i tried a command supposed to remove untracked files in submodules...but used "reset" in a wron

Re: git workflow for D

2017-12-04 Thread Basile B. via Digitalmars-d-learn
On Monday, 4 December 2017 at 04:45:01 UTC, Patrick Schluter wrote: On Monday, 4 December 2017 at 01:54:57 UTC, ketmar wrote: Basile B. wrote: On Sunday, 3 December 2017 at 22:22:47 UTC, Arun Chandrasekaran wrote: Git CLI is arcane and esoteric. I've lost my commits before (yeah, my mistake).

Re: Is std.container.array more or less an equivalent of C#'s List?

2017-12-04 Thread Basile B. via Digitalmars-d-learn
On Monday, 4 December 2017 at 16:26:02 UTC, A Guy With a Question wrote: Reading this, the interface seems very similar, but I'm not sure. There's only like a two sentence general description, then it goes on to talk about a boolean specialization... https://dlang.org/phobos/std_container_arra

SHould this work ?

2017-12-04 Thread Basile B. via Digitalmars-d-learn
void main() { import std.algorithm.iteration, std.typecons, std.stdio; [tuple(dchar(0), uint(0))].reduce!((a,b) => a[1]+b[1])(tuple(dchar(0), uint(0))).writeln; }

Re: Does D have class' attributes like C#'s?

2017-12-16 Thread Basile B. via Digitalmars-d-learn
On Saturday, 16 December 2017 at 21:11:43 UTC, Marc wrote: On Saturday, 16 December 2017 at 20:05:15 UTC, Anonymouse wrote: On Saturday, 16 December 2017 at 19:57:30 UTC, Marc wrote: C# has a quite nice way to store metadata about a property by a feature called atributes[1]. For example, I can

Re: DLang Tour : Functions as arguments

2017-12-28 Thread Basile B. via Digitalmars-d-learn
On Thursday, 28 December 2017 at 01:37:16 UTC, Tony wrote: On this page: https://tour.dlang.org/tour/en/basics/delegates there is: void doSomething(int function(int, int) doer) { // call passed function doer(5,5); } doSomething(ad

Re: structs inheriting from and implementing interfaces

2017-12-29 Thread Basile B. via Digitalmars-d-learn
On Friday, 29 December 2017 at 12:03:59 UTC, Mike Franklin wrote: In C#, structs can inherit from and implement interfaces. using System; interface IPrint { void Print(); } struct MyStruct : IPrint { public void Print() { Console.WriteLine(ToString()); } } public

Re: structs inheriting from and implementing interfaces

2017-12-29 Thread Basile B. via Digitalmars-d-learn
On Friday, 29 December 2017 at 13:08:38 UTC, rikki cattermole wrote: On 29/12/2017 12:59 PM, rjframe wrote: On Fri, 29 Dec 2017 12:39:25 +, Nicholas Wilson wrote: On Friday, 29 December 2017 at 12:03:59 UTC, Mike Franklin wrote: The problem is that interfaces are a runtime thing (e.g. yo

Possible dmd 2.078 regression ?

2018-01-12 Thread Basile B. via Digitalmars-d-learn
I have a simple program that only compiles if the dependency is not pre-compiled as a static library. It worked fine before. Please test this --- if [ ! -d "iz" ]; then git clone https://www.github.com/BBasile/iz.git fi cd iz/scripts sh compile.sh cd ../ #fails to link dmd samples/diction

Re: Possible dmd 2.078 regression ?

2018-01-12 Thread Basile B. via Digitalmars-d-learn
On Friday, 12 January 2018 at 17:58:30 UTC, Stefan Koch wrote: On Friday, 12 January 2018 at 14:13:22 UTC, Basile B. wrote: I have a simple program that only compiles if the dependency is not pre-compiled as a static library. It worked fine before. I guess a mangle problem ? Yes and quite old

Re: Possible dmd 2.078 regression ?

2018-01-12 Thread Basile B. via Digitalmars-d-learn
On Friday, 12 January 2018 at 18:50:10 UTC, Basile B. wrote: On Friday, 12 January 2018 at 17:58:30 UTC, Stefan Koch wrote: On Friday, 12 January 2018 at 14:13:22 UTC, Basile B. wrote: I have a simple program that only compiles if the dependency is not pre-compiled as a static library. It worke

Re: compile-time checked format strings

2018-01-13 Thread Basile B. via Digitalmars-d-learn
On Saturday, 13 January 2018 at 19:40:09 UTC, Adam D. Ruppe wrote: On Saturday, 13 January 2018 at 19:15:49 UTC, kdevel wrote: dmd checks the types but does not count the arguments. so note that dmd doesn't actually do any checks here - it is all done in library code. The implementation is

Re: New integer promotion rules

2018-01-17 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 17 January 2018 at 20:30:07 UTC, rumbu wrote: And here is why is bothering me: auto max = isNegative ? cast(Unsigned!T)(-T.min) : cast(Unsigned!T)T.max); The generic code above (which worked for all signed integral types T in 2.077) must be rewritten like this in 2.078: stati

Re: Is it possible to obtain textual representation of an arbitary code?

2018-01-26 Thread Basile B. via Digitalmars-d-learn
On Friday, 26 January 2018 at 11:32:42 UTC, Mike Parker wrote: On Friday, 26 January 2018 at 11:18:21 UTC, Oleksii Skidan wrote: I could imagine a mixin-based solution in D: ```d // Usage: ASSERT!"a == b"; ``` But it seems a bit alien to me. First of all, it kind of stringly-typed one. Secon

Re: Possible dmd 2.078 regression ?

2018-01-26 Thread Basile B. via Digitalmars-d-learn
On Friday, 26 January 2018 at 21:52:30 UTC, timotheecour wrote: On Friday, 12 January 2018 at 18:51:31 UTC, Basile B. wrote: On Friday, 12 January 2018 at 18:50:10 UTC, Basile B. wrote: On Friday, 12 January 2018 at 17:58:30 UTC, Stefan Koch wrote: On Friday, 12 January 2018 at 14:13:22 UTC, B

Re: Possible dmd 2.078 regression ?

2018-01-26 Thread Basile B. via Digitalmars-d-learn
On Friday, 26 January 2018 at 22:15:15 UTC, Basile B. wrote: On Friday, 26 January 2018 at 21:52:30 UTC, timotheecour wrote: On Friday, 12 January 2018 at 18:51:31 UTC, Basile B. wrote: On Friday, 12 January 2018 at 18:50:10 UTC, Basile B. wrote: On Friday, 12 January 2018 at 17:58:30 UTC, Stef

sys_write in betterC doesn't write anything

2018-02-03 Thread Basile B. via Digitalmars-d-learn
compiles with -betterC -m32 module runnable; __gshared static msg = "betterC"; __gshared static len = 7; extern(C) int main(int argc, char** args) { asm { naked; mov EDX, len ;//message length mov ECX, msg ;//message to write mov EBX, 1 ;//file descript

Re: sys_write in betterC doesn't write anything

2018-02-03 Thread Basile B. via Digitalmars-d-learn
On Saturday, 3 February 2018 at 15:30:10 UTC, Basile B. wrote: compiles with -betterC -m32 module runnable; __gshared static msg = "betterC"; __gshared static len = 7; extern(C) int main(int argc, char** args) { asm { naked; mov EDX, len ;//message length mov EC

Re: sys_write in betterC doesn't write anything

2018-02-03 Thread Basile B. via Digitalmars-d-learn
On Saturday, 3 February 2018 at 15:38:02 UTC, Adam D. Ruppe wrote: On Saturday, 3 February 2018 at 15:30:10 UTC, Basile B. wrote: __gshared static msg = "betterC"; That's a D string mov ECX, msg ;//message to write And that's the address of a D string, instead of the address of

x86_64 iasm cannot directly load global variable with PIC code

2018-02-03 Thread Basile B. via Digitalmars-d-learn
``` __gshared a = "sdfg"; void main() { asm { mov RCX, [a]; } } ``` Error: cannot directly load global variable 'a' with PIC code How can i do that indirectly then ?

Re: x86_64 iasm cannot directly load global variable with PIC code

2018-02-03 Thread Basile B. via Digitalmars-d-learn
On Sunday, 4 February 2018 at 05:03:31 UTC, Basile B. wrote: ``` __gshared a = "sdfg"; void main() { asm { mov RCX, [a]; } } ``` Error: cannot directly load global variable 'a' with PIC code How can i do that indirectly then ? Also consider that there's no RIP: https:/

Re: Strange things allowed in iasm

2018-02-03 Thread Basile B. via Digitalmars-d-learn
On Sunday, 4 February 2018 at 05:45:02 UTC, Basile B. wrote: 1/ void foo() { asm pure nothrow { naked; mov RAX, [0x10][0x20] R8; ret; } } generates ;--- SUB 00449468h --- 00449468h mov eax, 0030h 0044946Dh ret ;-

Strange things allowed in iasm

2018-02-03 Thread Basile B. via Digitalmars-d-learn
1/ void foo() { asm pure nothrow { naked; mov RAX, [0x10][0x20] R8; ret; } } generates ;--- SUB 00449468h --- 00449468h mov eax, 0030h 0044946Dh ret ;- 2/ void foo() { asm pure n

Re: Strange things allowed in iasm

2018-02-05 Thread Basile B. via Digitalmars-d-learn
On Sunday, 4 February 2018 at 05:45:02 UTC, Basile B. wrote: 1/ void foo() { asm pure nothrow { naked; mov RAX, [0x10][0x20] R8; ret; } } generates ;--- SUB 00449468h --- 00449468h mov eax, 0030h 0044946Dh ret ;-

Re: Linking multiple libraries

2018-02-11 Thread Basile B. via Digitalmars-d-learn
On Sunday, 11 February 2018 at 01:38:41 UTC, b2.temp wrote: On Sunday, 26 November 2017 at 11:15:58 UTC, Jacob Carlborg wrote: On 2017-11-25 23:31, Mike Parker wrote: For "ld" on macOS the order does not matter. For "ld" on Linux the order does matter, but, if necessary, the following flags c

Re: static opSlice is not possible

2018-02-16 Thread Basile B. via Digitalmars-d-learn
On Thursday, 15 February 2018 at 22:49:56 UTC, Alex wrote: Hi all, a short question about an old bug: https://issues.dlang.org/show_bug.cgi?id=11877 Are there reasons, which speaks against this feature? And maybe another one, more general: Is there any place, where it is documented, which opera

Re: static opSlice is not possible

2018-02-16 Thread Basile B. via Digitalmars-d-learn
On Friday, 16 February 2018 at 13:23:09 UTC, Basile B. wrote: On Thursday, 15 February 2018 at 22:49:56 UTC, Alex wrote: Hi all, a short question about an old bug: https://issues.dlang.org/show_bug.cgi?id=11877 Are there reasons, which speaks against this feature? And maybe another one, more g

Re: std.traits.isBoolean

2018-02-19 Thread Basile B. via Digitalmars-d-learn
On Monday, 19 February 2018 at 13:07:08 UTC, Tony wrote: It doesn't appear that BooleanTypeof is documented on dlang.org (outside of it's placement on the isBooleanType page). At least it isn't coming up in a "BooleanTypeOf site:dlang.org" search and not on the traits page: https://dlang.org/

Re: Could that bug be catch using D's way?

2018-02-19 Thread Basile B. via Digitalmars-d-learn
On Monday, 19 February 2018 at 13:51:50 UTC, Simen Kjærås wrote: On Monday, 19 February 2018 at 13:33:34 UTC, rikki cattermole wrote: https://dlang.org/phobos/std_experimental_checkedint.html#.Checked.min Can't seem to get that to work, so I assumed it's not meant to be used that way: impor

Re: Could that bug be catch using D's way?

2018-02-19 Thread Basile B. via Digitalmars-d-learn
On Monday, 19 February 2018 at 21:34:04 UTC, Simen Kjærås wrote: On Monday, 19 February 2018 at 14:20:16 UTC, Basile B. wrote: I had never used Checked and i discover that strangely there's no hook for opAssign. onLowerBound and onUpperBound works for +=, -=, *=, /=, %=, ^^=, &=, |=, ^=, <<=, >

Re: Going from string to identifier

2018-02-21 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 21 February 2018 at 22:22:55 UTC, Meta wrote: (I'm not sure if the available compiler implementations actually enforce this) Yes it does, example ``` enum s = q{€}; ``` gives: `Error: character 0x20ac is not a valid token`

Re: howto run unittest of a single module in dub driven project?

2018-03-04 Thread Basile B. via Digitalmars-d-learn
On Sunday, 4 March 2018 at 10:43:06 UTC, Arjan wrote: Is it somehow possible to only run the unittests of a single d file within a dub project? Of course without resorting to typing the complete commandline with all versions includes switches etc. In Coedit yes. 1/ The path to the other sour

Re: howto run unittest of a single module in dub driven project?

2018-03-04 Thread Basile B. via Digitalmars-d-learn
On Sunday, 4 March 2018 at 11:38:37 UTC, Basile B. wrote: On Sunday, 4 March 2018 at 10:43:06 UTC, Arjan wrote: [...] In Coedit yes. 1/ The path to the other source (usually the path>/src/ or /source/) folder must be registered in the library manager. 2/ Menu "Compilation" item "Run file uni

Re: howto run unittest of a single module in dub driven project?

2018-03-04 Thread Basile B. via Digitalmars-d-learn
On Sunday, 4 March 2018 at 12:22:35 UTC, Basile B. wrote: On Sunday, 4 March 2018 at 11:38:37 UTC, Basile B. wrote: On Sunday, 4 March 2018 at 10:43:06 UTC, Arjan wrote: [...] In Coedit yes. 1/ The path to the other source (usually the path>/src/ or /source/) folder must be registered in th

Re: howto run unittest of a single module in dub driven project?

2018-03-05 Thread Basile B. via Digitalmars-d-learn
On Monday, 5 March 2018 at 09:19:52 UTC, Arjan wrote: On Sunday, 4 March 2018 at 16:51:06 UTC, Basile B. wrote: [1] https://github.com/BBasile/Coedit/commit/f8c5e686c8c6aaa7dc2c770121767e3e59806a0e Thanks for givin me the idea original poster. Guess I will have to give coedit another try the

Re: How can I get notified when an process created by spawnShell() has exit?

2018-03-07 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 7 March 2018 at 15:03:28 UTC, Marc wrote: I do need to start (up to 4 a time) processes in parallel but I'd like to get notified (similar to C#'s Process.Exited Event) when the process exits. How can I do that in D? You can use pipeShell and a control loop to check when the Proc

How to fake a const method ?

2018-03-09 Thread Basile B. via Digitalmars-d-learn
I would need this to work: ``` struct Foo { TypeInfo typeCache; TypeInfo getTypeCache() { alias NotThePoint = ubyte; if (typeCache is null) typeCache = typeid(NotThePoint); return typeCache; } TypeInfo type() const { alias Noth

Re: How to fake a const method ?

2018-03-09 Thread Basile B. via Digitalmars-d-learn
On Friday, 9 March 2018 at 13:47:34 UTC, Basile B. wrote: - `type()` really has to be const because it's used in an opEquals that's used by an AA (key is const so opEquals has to as well) And the most annoying is that the non reduced Foo has a custom toHash that hashes a payload so the cast t

Re: How to fake a const method ?

2018-03-09 Thread Basile B. via Digitalmars-d-learn
On Friday, 9 March 2018 at 13:54:07 UTC, Basile B. wrote: On Friday, 9 March 2018 at 13:47:34 UTC, Basile B. wrote: - `type()` really has to be const because it's used in an opEquals that's used by an AA (key is const so opEquals has to as well) And the most annoying is that the non reduced F

Re: How to fake a const method ?

2018-03-09 Thread Basile B. via Digitalmars-d-learn
On Friday, 9 March 2018 at 13:47:34 UTC, Basile B. wrote: I would need this to work: ``` struct Foo { TypeInfo typeCache; TypeInfo getTypeCache() { alias NotThePoint = ubyte; if (typeCache is null) typeCache = typeid(NotThePoint); return typeCache

Re: How do you call an eponymous template that has a secondary template arg?

2018-03-11 Thread Basile B. via Digitalmars-d-learn
On Sunday, 11 March 2018 at 12:05:56 UTC, aliak wrote: Eg: template aliasOf(T) { enum aliasOf(alias a) = is(typeof(a) == T); } The use case for this is for std.meta.allSatisfy for variadic args, i.e. template T(values...) if (allSatisfy!(aliasOf!string, values) { ... } But how do you

Re: Issues using the in-line assembler

2018-04-04 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 4 April 2018 at 21:00:44 UTC, solidstate1991 wrote: I have this code: asm @nogc{ movqXMM0, xy; paddd XMM0, sXY; // xy + sXY movqXMM3, xy0; psubd XMM0, XMM3; // xy + sXY - x0y0 movq

Re: Issues using the in-line assembler

2018-04-04 Thread Basile B. via Digitalmars-d-learn
On Thursday, 5 April 2018 at 04:48:02 UTC, Basile B. wrote: On Wednesday, 4 April 2018 at 21:00:44 UTC, solidstate1991 wrote: void main() { import std.stdio; (new Foo).foo(0,0).writeln; } ``` Ah sorry, the params must be removed ((new Foo).foo().writeln;)... I was actually trying to

Re: Source expression passed to a lazy parameter

2018-04-09 Thread Basile B. via Digitalmars-d-learn
On Monday, 9 April 2018 at 08:27:50 UTC, Per Nordlöw wrote: Is it possible to get the source expression sent to a lazy function? So that I can implement something like show(Arg)(lazy Arg arg) { writeln(arg.sourceof, arg); } used as show(1+2+3); will print 1+2+3:6 No (afaik),

Re: %s not producing string representation of enum?

2015-12-10 Thread Basile B. via Digitalmars-d-learn
On Thursday, 10 December 2015 at 14:24:43 UTC, Shriramana Sharma wrote: Hello. I'm using DMD 2.069.2. As per http://ddili.org/ders/d.en/enum.html the following code is supposed to output the *names* of the suits: import std.stdio; void main() { enum Suit { spades, hearts, diamonds, clubs }

Re: %s not producing string representation of enum?

2015-12-10 Thread Basile B. via Digitalmars-d-learn
On Thursday, 10 December 2015 at 14:46:26 UTC, Basile B. wrote: On Thursday, 10 December 2015 at 14:24:43 UTC, Shriramana Sharma wrote: Hello. I'm using DMD 2.069.2. As per http://ddili.org/ders/d.en/enum.html the following code is supposed to output the *names* of the suits: import std.stdio

Re: isTemplate and isValue?

2015-12-12 Thread Basile B. via Digitalmars-d-learn
On Saturday, 12 December 2015 at 14:17:52 UTC, Shriramana Sharma wrote: Hello. Re my posting just now re AliasSeq being able to contain a template identifier too, I wonder whether it is possible to have a std.traits template to identify whether something is a template or not? In connection wi

Re: Error 42: Symbol Undefined __lseeki64

2015-12-17 Thread Basile B. via Digitalmars-d-learn
On Thursday, 17 December 2015 at 04:11:56 UTC, tcak wrote: On Wednesday, 16 December 2015 at 18:30:41 UTC, Byron Heads wrote: On Wednesday, 16 December 2015 at 18:21:33 UTC, Byron Heads wrote: On Wednesday, 16 December 2015 at 18:14:35 UTC, Byron Heads I searched the function "__lseek64" under

Re: Scope of D packages

2015-12-18 Thread Basile B. via Digitalmars-d-learn
On Friday, 18 December 2015 at 23:20:34 UTC, Jakob Jenkov wrote: I'm coming from Java where "packages" are not that much more than directories. Each class can be exposed or hidden inside a package etc. In Java it is common that an API consists of many packages and subpackages. All classes are

<    1   2   3   4   5   6   7   8   >