Re: Alternative to Interfaces

2019-01-25 Thread Sebastien Alaiwan via Digitalmars-d-learn
On Saturday, 19 January 2019 at 09:24:21 UTC, Kagamin wrote: On Friday, 18 January 2019 at 18:48:46 UTC, Jonathan M Davis wrote: Yes, but some D features will use the GC They would like to allocate, but they don't know nor care where it's allocated from, if the developer uses custom memory m

Re: D vs perl6

2018-11-22 Thread Sebastien Alaiwan via Digitalmars-d-learn
On Thursday, 22 November 2018 at 09:03:19 UTC, Gary Willoughby wrote: On Monday, 19 November 2018 at 06:46:55 UTC, dangbinghoo wrote: So, can you experts give a more comprehensive compare with perl6 and D? Sure! 1). You can actually read and understand D code. Also, D can be parsed. See: P

Re: testing for deprecation

2017-08-28 Thread Sebastien Alaiwan via Digitalmars-d-learn
On Thursday, 1 September 2016 at 11:11:15 UTC, Cauterite wrote: How does one test whether a symbol is deprecated? I would have expected something like: __traits(isDeprecated, foo). Such a trait makes it possible to write code that will break, just because something has been marked as deprecate

Re: Tools to help me find memory leaks?

2017-08-25 Thread Sebastien Alaiwan via Digitalmars-d-learn
I always use "valgrind --tool=massif" + "massif-visualizer". Gives me a nice timeline allowing to find quickly who the big memory consumers (allocation sites) are.

Re: D doesn't read the first character of a file (reads everything but the first chararacter) with either read() or readText()

2017-07-18 Thread Sebastien Alaiwan via Digitalmars-d-learn
On Tuesday, 18 July 2017 at 02:21:59 UTC, Enjoys Math wrote: DMD32 D Compiler v2.074.1 import std.file; void main() { string bigInput = readText("input.txt"); } The file is 7 MB of ascii text, don't know if that matters... Should I upgrade versions? Could you please share the first 32-b

Re: Is it possible to generate a pool of random D or D inline assembler programs, run them safely?

2017-07-18 Thread Sebastien Alaiwan via Digitalmars-d-learn
On Tuesday, 18 July 2017 at 17:35:17 UTC, Enjoys Math wrote: Without them crashing the app running them? Say by wrapping with try / catch? and, most probably a timeout, as you're certainly going to run into infinite loops. Reason is so I don't have to make my own VM. Why not reuse an ex

Re: Alias template parameter to a private function

2017-06-29 Thread Sebastien Alaiwan via Digitalmars-d-learn
On Thursday, 29 June 2017 at 20:21:13 UTC, Ali Çehreli wrote: A workaround is to use a lambda: filter!(a => isValid(a))(array) Thanks! Nice trick, this is definitely going into my company's codebase :-) Such limitations are pretty annoying. There were a number of similar issues in recent

Re: Alias template parameter to a private function

2017-06-29 Thread Sebastien Alaiwan via Digitalmars-d-learn
up please!

Accessing function frame from struct

2017-06-25 Thread Sebastien Alaiwan via Digitalmars-d-learn
Hi guys, here's my full code below. My problem is that last "auto Y = X" assignment, that the compiler won't accept: yo.globalFunction.DirectStruct.IndirectStruct.indirectMemberFunc cannot access frame of function yo.globalFunction I was expecting X to be accessible from here. Suprisingly, i

Alias template parameter to a private function

2017-06-24 Thread Sebastien Alaiwan via Digitalmars-d-learn
Hi, I'm trying to call std.algorithm.iteration.filter with a private function as a predicate. Here's a reduced example code: // yo.d import std.algorithm; void moduleEntryPoint() { privateFunction1(); privateFunction2(); } private: void privateFunction1() { auto array = [0, 1, 2, 3, 4

Re: GDC generate wrong .exe ("not a valid win32 application")

2017-06-22 Thread Sebastien Alaiwan via Digitalmars-d-learn
On Thursday, 22 June 2017 at 05:57:59 UTC, bauss wrote: On Wednesday, 21 June 2017 at 15:55:27 UTC, David Nadlinger wrote: On Monday, 19 June 2017 at 14:08:56 UTC, Patric Dexheimer wrote: Fresh install of GDC. (tried with 32x ad 32_64x) Where did you get the GDC executable from? The GDC proje

Re: GDC options

2017-06-05 Thread Sebastien Alaiwan via Digitalmars-d-learn
On Wednesday, 22 March 2017 at 13:42:21 UTC, Matthias Klumpp wrote: This is why most of my work in Meson to get D supported is adding weird hacks to translate compiler flags between GNU <-> non-GNU <-> DMD. It sucks quite badly, and every now and then I hit a weird corner case where things brea

Re: htod for linux

2017-04-21 Thread Sebastien Alaiwan via Digitalmars-d-learn
On Friday, 21 April 2017 at 11:40:45 UTC, Mike Parker wrote: On Friday, 21 April 2017 at 10:54:26 UTC, سليمان السهمي (Soulaïman Sahmi) wrote: Is there an htod for linux or an equivalent that works with Cpp, there is dstep but it does not support Cpp. From the very bottom of the htod doc page [

Re: GDC options

2017-03-21 Thread Sebastien Alaiwan via Digitalmars-d-learn
On Monday, 13 March 2017 at 11:06:53 UTC, Russel Winder wrote: It is a shame that dmd and ldc do not just use the standard GCC option set. Totally agreed. Moreover, funny stuff like "dmd -of" (instead of standard "-o ") breaks automatic Msys path conversion hack (the code translates Unix path

Re: [Semi-OT] I don't want to leave this language!

2016-12-07 Thread Sebastien Alaiwan via Digitalmars-d-learn
On Wednesday, 7 December 2016 at 21:52:22 UTC, Jonathan M Davis wrote: On Wednesday, December 07, 2016 15:17:21 Picaud Vincent via Digitalmars-d- learn wrote: That being said, if someone wants to make their life harder by insisting on using D without even druntime, then that's their choice. I t

Re: strange -fPIC compilation error

2016-10-31 Thread Sebastien Alaiwan via Digitalmars-d-learn
Hello, From GCC 6.2, -fpie is becoming the default setting at compile and at link time. As dmd uses GCC to link, now the code needs to be compiled with a special option. Which means you need, at the moment, to add the following options to your dmd.conf: -defaultlib=libphobos2.so -fPIC (the ch

Re: Transform/Compile to C/CPP as a target

2016-07-28 Thread Sebastien Alaiwan via Digitalmars-d-learn
On Monday, 25 July 2016 at 07:53:17 UTC, Stefan Koch wrote: On Saturday, 23 July 2016 at 12:27:24 UTC, ParticlePeter wrote: Is there any kind of project or workflow that converts D (subset) to C/CPP ? The short answer is no, not for any recent version of D. The long answer is it's kind of po

Re: inout, delegates, and visitor functions.

2015-10-24 Thread Sebastien Alaiwan via Digitalmars-d-learn
Hi ponce, Thanks for your suggestion. I think I may have found the beginning of a solution: class E { import std.traits; void apply(this F, U)(void delegate(U e) f) if(is(Unqual!U == E)) { f(this); } int val; } int main() { void setToZero(E e) { e.val = 0; } void

inout, delegates, and visitor functions.

2015-10-24 Thread Sebastien Alaiwan via Digitalmars-d-learn
Hi all, I'm trying to get the following code to work. (This code is a simplified version of some algebraic type). Is it possible to only declare one version of the 'apply' function? Or should I declare the const version and the non-const version? I tried using "inout", but I got the following

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

2015-02-19 Thread Sebastien Alaiwan via Digitalmars-d-learn
On Thursday, 19 February 2015 at 08:46:11 UTC, Mayuresh Kathe wrote: Should I choose DMD or go with GDC? I work with projects whose code is half written in C, half written in D. I use GNU make to build them. I found out that using GDC was a much better choice for several reasons: - project