Re: Creating D bindings for a C library

2015-11-25 Thread ponce via Digitalmars-d-learn
On Tuesday, 24 November 2015 at 23:22:24 UTC, Joseph Rushton Wakeling wrote: On Tuesday, 24 November 2015 at 23:14:14 UTC, Joseph Rushton Wakeling wrote: I'm considering creating some D bindings for a C library. I should probably clarify that I know what to do assuming I have to write all

Re: How to use readText to read utf16 file?

2015-11-17 Thread ponce via Digitalmars-d-learn
On Tuesday, 17 November 2015 at 05:37:55 UTC, Domain wrote: Thank you! Now another question: how to handle endianness? If your file follow a file format: the endianness should be defined there. else it's a random text file: either it will have a BOM with endianness, or you will

Re: OSX Foundation framework D binding

2015-11-12 Thread ponce via Digitalmars-d-learn
On Wednesday, 11 November 2015 at 16:06:57 UTC, Jacob Carlborg wrote: On 2015-11-11 10:29, Daniel Kozak via Digitalmars-d-learn wrote: I find only this one: http://code.dlang.org/packages/derelict-cocoa Also, there's no point in complicate the bindings by using function pointers like this.

Re: Feature for paranoids

2015-11-10 Thread ponce via Digitalmars-d-learn
On Tuesday, 10 November 2015 at 13:09:09 UTC, Fyodor Ustinov wrote: Hi! Is it possible when using the "-release" indicate that this one in/out/invariant/assert should not to be disabled? WBR, Fyodor. Since assert(false) is special (cf.

Re: Feature for paranoids

2015-11-10 Thread ponce via Digitalmars-d-learn
On Tuesday, 10 November 2015 at 20:37:00 UTC, Fyodor Ustinov wrote: assert(false) AKA assert(0) - is a part of this language that I think it is absolute evil. WBR, Fyodor. I would say it's a minor evil, that create problems by needing an explanation. At this point it has been

Re: Why my app require MSVCR120.dll?

2015-11-06 Thread ponce via Digitalmars-d-learn
On Friday, 6 November 2015 at 13:16:46 UTC, Suliman wrote: I wrote Application in D. That use next components: "colorize": ">=1.0.5", "ddbc": ">=0.2.11", "vibe-d": "~>0.7.26" On Windows 7 it's work fine. On Windows 10 (clean install) it's do not start and require MSVCR120.dll And I can't

Re: Playing audio files and related functions?

2015-10-26 Thread ponce via Digitalmars-d-learn
On Monday, 26 October 2015 at 21:25:58 UTC, Cleverson wrote: Hello, Is there any library or module for easily managing basic audio functions, e.g., play/pause/stop a sound? I can't find it amongst the standard library and the packages colection, or maybe I don't know how to search properly,

Re: inout, delegates, and visitor functions.

2015-10-24 Thread ponce via Digitalmars-d-learn
On Saturday, 24 October 2015 at 11:28:17 UTC, Sebastien Alaiwan wrote: 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

Re: inout, delegates, and visitor functions.

2015-10-24 Thread ponce via Digitalmars-d-learn
On Saturday, 24 October 2015 at 08:51:58 UTC, Sebastien Alaiwan wrote: 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

Re: Interval Arithmetic

2015-10-02 Thread ponce via Digitalmars-d-learn
On Thursday, 1 October 2015 at 21:13:30 UTC, Marco Leise wrote: Nice to have in Phobos. I assume you have to set the correct control word depending on whether you perform math on the FPU or via SSE (as is standard for x86_64)? And I assume further that DMD always uses FPU math and other

Re: Interval Arithmetic

2015-10-01 Thread ponce via Digitalmars-d-learn
On Thursday, 1 October 2015 at 11:40:28 UTC, Marco Leise wrote: Note that the FP control word is per thread and any external code you call or even buggy interrupt handlers could change or reset it to defaults. Known cases include a faulty printer driver and Delphi's runtime, which enables FP

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

2015-09-29 Thread ponce via Digitalmars-d-learn
On Monday, 28 September 2015 at 16:01:54 UTC, Sebastiaan Koppe wrote: I could not find out which redistributable I had to install (what version of VS did you have installed / on what version of windows are you?). I decided to install them all, but couldn't install the one for 2015 (due to

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

2015-09-29 Thread ponce via Digitalmars-d-learn
On Tuesday, 29 September 2015 at 09:44:58 UTC, Sebastiaan Koppe wrote: On Tuesday, 29 September 2015 at 09:15:29 UTC, ponce wrote: On Monday, 28 September 2015 at 16:01:54 UTC, Sebastiaan Koppe wrote: I could not find out which redistributable I had to install (what version of VS did you have

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

2015-09-28 Thread ponce via Digitalmars-d-learn
On Monday, 28 September 2015 at 15:10:25 UTC, ponce wrote: Does it also affect executable made with DMD and linked with MS linker? Just tested: no.

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

2015-09-28 Thread ponce via Digitalmars-d-learn
On Monday, 28 September 2015 at 16:01:54 UTC, Sebastiaan Koppe wrote: On Monday, 28 September 2015 at 15:10:25 UTC, ponce wrote: On Tuesday, 22 September 2015 at 09:38:12 UTC, thedeemon wrote: On Monday, 21 September 2015 at 15:00:24 UTC, ponce wrote: All in the title. DMD 64-bit links with

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

2015-09-28 Thread ponce via Digitalmars-d-learn
On Tuesday, 22 September 2015 at 09:38:12 UTC, thedeemon wrote: On Monday, 21 September 2015 at 15:00:24 UTC, ponce wrote: All in the title. DMD 64-bit links with the VS linker. Do users need to install the VS redistributable libraries? I think they don't. Generated .exe seems to depend only

Re: Threading Questions

2015-09-26 Thread ponce via Digitalmars-d-learn
Sorry I don't know the answers but these questions are interesting so BUMP ;) On Friday, 25 September 2015 at 15:19:27 UTC, bitwise wrote: 1) Are the following two snippets exactly equivalent(not just in observable behaviour)? a) Mutex mut; mut.lock(); scope(exit) mut.unlock(); b) Mutex

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

2015-09-22 Thread ponce via Digitalmars-d-learn
On Tuesday, 22 September 2015 at 09:38:12 UTC, thedeemon wrote: I think they don't. Generated .exe seems to depend only on kernel32.dll and shell32.dll, i.e. things users already have. Great then.

OS minimum version

2015-09-21 Thread ponce via Digitalmars-d-learn
1. What is the minimum Windows version required by programs created with DMD? 2. What is the minimum Windows version required by programs created with LDC? 3. What is the minimum OS X version required by programs created with LDC? You would believe such information would be easy to find,

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

2015-09-21 Thread ponce via Digitalmars-d-learn
All in the title. DMD 64-bit links with the VS linker. Do users need to install the VS redistributable libraries?

Re: OS minimum version

2015-09-21 Thread ponce via Digitalmars-d-learn
On Monday, 21 September 2015 at 18:47:10 UTC, anonymous wrote: On Monday 21 September 2015 14:47, ponce wrote: 1. What is the minimum Windows version required by programs created with DMD? http://dlang.org/dmd-windows.html says: "Windows XP or later, 32 or 64 bit". Thanks to all.

Re: Question about Object.destroy

2015-09-20 Thread ponce via Digitalmars-d-learn
On Sunday, 20 September 2015 at 17:43:01 UTC, Lambert Duijst wrote: Is it because: - The GC did decide to run and cleanup memory straight after the call to s.destroy() - An object being in an invalid state means the program segfaults when the object is used ? - Another reason.. All

Re: Debugging D shared libraries

2015-09-20 Thread ponce via Digitalmars-d-learn
On Saturday, 19 September 2015 at 17:02:37 UTC, Russel Winder wrote: English and Spanish meanings of the word are very different. In UK (not sure about Canada, USA, Australia, New Zealand, South Africa,…) it is generally a somewhat derogatory term. In French it means "to rub down with

Re: Tried release build got ICE, does anyone have a clue what might cause this?

2015-09-19 Thread ponce via Digitalmars-d-learn
On Friday, 18 September 2015 at 22:54:43 UTC, Random D user wrote: So I tried to build my project in release for the first time in a long while. It takes like 25x longer to compile and finally the compiler crashes. It seems to go away if I disable the optimizer. I get: tym = x1d Internal

Re: How do you get the min / max of two numbers a, b?

2015-09-19 Thread ponce via Digitalmars-d-learn
On Saturday, 19 September 2015 at 03:53:12 UTC, Enjoys Math wrote: I know there's fmax for floats, but what about ints? Thanks. http://p0nce.github.io/d-idioms/#Minimum-or-maximum-of-numbers

Re: broken program, silly error messages, dub

2015-09-19 Thread ponce via Digitalmars-d-learn
On Saturday, 19 September 2015 at 01:54:08 UTC, Joel wrote: I accidentally wiped off a small source file. I've been trying to put it back together. Now I get unrelated errors. I've tried resetting dub. To reset DUB state completely: - remove .dub/ directory in the project directory -

Re: Get AA key and value type

2015-09-19 Thread ponce via Digitalmars-d-learn
On Saturday, 19 September 2015 at 12:50:51 UTC, Pierre wrote: So how can I get types without instance ? Thanks for help. -->8- template AATypes(T) { // todo: static assert if T is no AA type here alias ArrayElementType!(typeof(T.init.keys)) key; alias

Re: Debugging D shared libraries

2015-09-19 Thread ponce via Digitalmars-d-learn
On Saturday, 19 September 2015 at 10:45:22 UTC, Russel Winder wrote: Calling D from Python. I have two functions in D, compiled to a shared object on Linux using LDC (but I get same problem using DMD). The sequential code: extern(C) double sequential(const int n, const double delta)

Re: Debugging D shared libraries

2015-09-19 Thread ponce via Digitalmars-d-learn
On Saturday, 19 September 2015 at 16:32:18 UTC, Russel Winder wrote: (*) ponce is arguably not the most positive or constructive name to go by. Friend call me like this IRL since forever. It seems to be a swear word in english?

Re: Debugging D shared libraries

2015-09-19 Thread ponce via Digitalmars-d-learn
On Saturday, 19 September 2015 at 15:42:15 UTC, Russel Winder wrote: Hummm… I now do not get a segfault, and the code runs as expected : -) but the program never terminates. :-( Where is it stuck? Also, what would I need to cover the DMD and the GDC situations? I don't know. :(

Re: Debugging D shared libraries

2015-09-19 Thread ponce via Digitalmars-d-learn
On Saturday, 19 September 2015 at 16:25:28 UTC, Laeeth Isharc wrote: What is the difference between shared static this and the global constructor ? Russell, if you use shared static this for dmd does it work ? Laeeth. Would like to know too. On OSX I've found that shared static this()

Re: How not to run after a DUB build ?

2015-09-18 Thread ponce via Digitalmars-d-learn
On Thursday, 17 September 2015 at 19:44:36 UTC, BBasile wrote: On Thursday, 17 September 2015 at 19:36:10 UTC, BBasile wrote: Each time I execute `dub.exe --build=release` (or any other the build type) DUB tries to run the project after the build. This generates often generates an error when

Re: shared array?

2015-09-14 Thread ponce via Digitalmars-d-learn
On Monday, 14 September 2015 at 20:54:55 UTC, Jonathan M Davis wrote: So, you _can_ have low heap allocation in a C++ program, and many people do, but from what I've seen, that really isn't the norm across the C++ community in general. - Jonathan M Davis Fully agreed, C++ in the wild

Re: shared array?

2015-09-13 Thread ponce via Digitalmars-d-learn
On Sunday, 13 September 2015 at 15:35:07 UTC, Jonathan M Davis wrote: But the idea that your average D program is going to run into problems with the GC while using Phobos is just plain wrong. The folks who need to care are the rare folks who need extreme enough performance that they can't

Re: shared array?

2015-09-13 Thread ponce via Digitalmars-d-learn
On Sunday, 13 September 2015 at 17:00:30 UTC, Ola Fosheim Grøstad wrote: On Sunday, 13 September 2015 at 16:53:20 UTC, ponce wrote: GC is basically ok for anything soft-realtime, where you already spend a lot of time to go fast enough. And if you want hard-realtime, well you wouldn't want

Re: shared array?

2015-09-13 Thread ponce via Digitalmars-d-learn
On Sunday, 13 September 2015 at 19:39:20 UTC, Ola Fosheim Grostad wrote: The theoretical limit for 10ms mark sweep collection on current desktop cpus is 60 megabytes at peak performance. That means you'll have to stay below 30 MiB in total memory use with pointers. 30 MiB of scannable

Re: class destruction

2015-09-09 Thread ponce via Digitalmars-d-learn
On Wednesday, 9 September 2015 at 07:19:58 UTC, Q wrote: Hi. I'm playing around with D for a while and I would like to switch. But here is one thing, I need an answer for. In the Docs is mentioned that it is not sure that the DTor of a class is called. But what if I have struct, which holds a

Re: class destruction

2015-09-09 Thread ponce via Digitalmars-d-learn
On Wednesday, 9 September 2015 at 14:36:24 UTC, Q wrote: But if others use my code they must think about finalizing the classes? That is very awkward. classes, yes but structs, no. I'll take a look at Rust and otherwise I will stick with C++. Thanks for you answer. :) Well, resource

Re: What is the difference between D and C++ regarding Unique, RefCounted and Scoped?

2015-09-09 Thread ponce via Digitalmars-d-learn
On Wednesday, 9 September 2015 at 20:17:44 UTC, cym13 wrote: This is subtly missing the main question: isn't C++-like memory management of D classes possible with Unique, RefCounted and Scoped? - Unique C++ has move semantics which make moves explicit. D's Unique is more like the

Re: What is the difference between D and C++ regarding Unique, RefCounted and Scoped?

2015-09-09 Thread ponce via Digitalmars-d-learn
On Wednesday, 9 September 2015 at 19:53:55 UTC, ponce wrote: Oops, posted by mistake. On Wednesday, 9 September 2015 at 19:48:00 UTC, cym13 wrote: Hi, I know C++ and D without being a C++ or D guru (I know way more about D though). When talking about memory management the problem of RAII is

Re: What is the difference between D and C++ regarding Unique, RefCounted and Scoped?

2015-09-09 Thread ponce via Digitalmars-d-learn
On Wednesday, 9 September 2015 at 19:48:00 UTC, cym13 wrote: Hi, I know C++ and D without being a C++ or D guru (I know way more about D though). When talking about memory management the problem of RAII is often mentioned along with the fact that classes use the GC. I know well the

Re: Access Violation while trying to use OpenGL

2015-09-03 Thread ponce via Digitalmars-d-learn
On Wednesday, 2 September 2015 at 18:31:32 UTC, spec00 wrote: On Wednesday, 2 September 2015 at 01:07:01 UTC, Mike Parker wrote: To compile 64-bit programs on Windows, DMD requires the Microsoft toolchain. The easiest thing to do is to install the Community Edition of Visual Studio 2013 (DMD

Re: Prefer Signed or Unsigned in D?

2015-09-02 Thread ponce via Digitalmars-d-learn
On Wednesday, 2 September 2015 at 21:22:59 UTC, John Carter wrote: On Wednesday, 2 September 2015 at 11:03:00 UTC, ponce wrote: Everything Bjarne said still applies equally to D code, since integer promotion is identical with C from what I understand. Hmm. What Robert Elder says also

Re: Prefer Signed or Unsigned in D?

2015-09-02 Thread ponce via Digitalmars-d-learn
On Tuesday, 1 September 2015 at 23:06:50 UTC, John Carter wrote: C/C++ discussion here http://blog.robertelder.org/signed-or-unsigned-part-2/ D rules here... http://dlang.org/type.html#integer-promotions Everything Bjarne said still applies equally to D code, since integer

Re: How disruptive is the GC?

2015-08-01 Thread ponce via Digitalmars-d-learn
On Wednesday, 29 July 2015 at 09:25:50 UTC, Snape wrote: I'm in the early stages of building a little game with OpenGL (in D) and I just want to know the facts about the GC before I decide to either use it or work around it. Lots of people have said lots of things about it, but some of that

Re: Functional oriented programming in D

2015-07-16 Thread ponce via Digitalmars-d-learn
On Thursday, 16 July 2015 at 09:49:03 UTC, Jarl André Hübenthal wrote: Why? The syntax for delegate literals with braces is listenHTTP(settings, (req, res) { res.writeBody(Hello, World!); });

Is it legal to have a function taking two aliased slices?

2015-07-10 Thread ponce via Digitalmars-d-learn
Example: void process(float[] input, float[] output) { // do stuff } I'd like to sometimes have overlapping slices, and don't want the compiler to assume they do not overlap.

Re: Is it legal to have a function taking two aliased slices?

2015-07-10 Thread ponce via Digitalmars-d-learn
On Friday, 10 July 2015 at 13:54:47 UTC, Steven Schveighoffer wrote: On 7/10/15 9:20 AM, ponce wrote: Example: void process(float[] input, float[] output) { // do stuff } I'd like to sometimes have overlapping slices, and don't want the compiler to assume they do not

Re: Which XMM are safe to erase in asm{} blocks?

2015-07-08 Thread ponce via Digitalmars-d-learn
On Wednesday, 8 July 2015 at 05:22:34 UTC, ketmar wrote: On Tue, 07 Jul 2015 12:33:38 +, ponce wrote: Is this secret knowledge? yes. ;-) i believe that there are not so many people doing asm in D, and many of them using write and forget technique (i.e. write and don't touch if it

Re: Which XMM are safe to erase in asm{} blocks?

2015-07-07 Thread ponce via Digitalmars-d-learn
On Monday, 6 July 2015 at 08:54:48 UTC, ponce wrote: What registers can I safely modify in asm {} blocks? Especially XMM registers. I can't find the information on http://dlang.org/iasm.html Note that this question isn't for function-call boundaries but asm{} boundaries since I do not use

Which XMM are safe to erase in asm{} blocks?

2015-07-06 Thread ponce via Digitalmars-d-learn
What registers can I safely modify in asm {} blocks? Especially XMM registers. I can't find the information on http://dlang.org/iasm.html Note that this question isn't for function-call boundaries but asm{} boundaries since I do not use naked;

Re: code review based on what I learned from D

2015-07-06 Thread ponce via Digitalmars-d-learn
On Sunday, 5 July 2015 at 06:53:36 UTC, Szabo Bogdan wrote: you don't want to crash the user app, because this will make the user unhappy. This type reasoning is always flawed. It's like saying that the Earth is flat. http://p0nce.github.io/d-idioms/#Unrecoverable-vs-recoverable-errors

Re: Porting from D1 to D2

2015-06-30 Thread ponce via Digitalmars-d-learn
On Sunday, 28 June 2015 at 21:26:52 UTC, Walter Bright wrote: On 6/28/2015 2:48 AM, ponce wrote: I don't quite get what code could be generating that reference, since I don't call format or toString on a Throwable. You can grep the .obj files for the symbol. Thanks. Fixed by upgrading. I

Porting from D1 to D2

2015-06-28 Thread ponce via Digitalmars-d-learn
I have a program that is almost ported from D1 to D2 but there is still a problem with a reference to object.Throwable.toString(scope void delegate(in string) sink); With OPTLINK (32-bit): Error 42: Symbol Undefined _D6object9Throwable8toStringMxFMDFxAyaZvZv (const(void function(scope void

Re: Clean way to tell whether a destructor is called by the GC

2015-05-14 Thread ponce via Digitalmars-d-learn
On Wednesday, 13 May 2015 at 11:24:10 UTC, Kagamin wrote: On Tuesday, 12 May 2015 at 12:53:59 UTC, ponce wrote: I already have such a dispose() function. The problem is that to support Unique! and scoped! and friends, the destructor must call dispose(). Thus my need for a way to separate the

Clean way to tell whether a destructor is called by the GC

2015-05-12 Thread ponce via Digitalmars-d-learn
I need a robust isCalledByGC function to leak intentionally when a destructor is called as a result of the GC. It is a way to enforce deterministic destruction without ever relying on accidental correctness. class A { ~this() { if(iscalledByGC()) { [leak

Re: Clean way to tell whether a destructor is called by the GC

2015-05-12 Thread ponce via Digitalmars-d-learn
On Tuesday, 12 May 2015 at 12:31:35 UTC, Adam D. Ruppe wrote: Let me suggest a completely different option: make a destructor that works while the GC is running by managing the resources manually in both construction and destruction. I see, but not all ressources can be disposed by any

Re: GC has a barbaric destroyng model, I think

2015-02-12 Thread ponce via Digitalmars-d-learn
On Thursday, 12 February 2015 at 08:14:49 UTC, Mike Parker wrote: On 2/12/2015 6:42 AM, ketmar wrote: this problem has very easy solition: we should stop calling class dtors destructors, and rename them to finalizers. Absolutely. So many people coming from C++ see destructor and want to

Re: GC has a barbaric destroyng model, I think

2015-02-12 Thread ponce via Digitalmars-d-learn
On Thursday, 12 February 2015 at 09:50:39 UTC, ketmar wrote: On Thu, 12 Feb 2015 09:04:27 +, ponce wrote: http://p0nce.github.io/d-idioms/#The-trouble-with-class-destructors I've also made one for D can't do real-time because it has a stop-the-world GC

Re: GC has a barbaric destroyng model, I think

2015-02-12 Thread ponce via Digitalmars-d-learn
On Thursday, 12 February 2015 at 10:24:38 UTC, Mike Parker wrote: On 2/12/2015 6:09 PM, weaselcat wrote: On Thursday, 12 February 2015 at 08:33:35 UTC, Kagamin wrote: Truth be told, D has no guideline for deterministic destruction of managed resources. +1 don't complain about people

Re: Better native D 2D graphics library?

2015-02-09 Thread ponce via Digitalmars-d-learn
On Saturday, 7 February 2015 at 22:09:03 UTC, Gan wrote: Is there a better D graphics library in the works? I'm using SFML(which is very easy and has lots of features) but it seems to use a lot of ram(if you leave it running for a while on a graphic intensive scene) and trying to make it

Re: How to ensure a thread cannot be blocked by the GC?

2014-12-04 Thread ponce via Digitalmars-d-learn
On Thursday, 4 December 2014 at 02:01:26 UTC, Ola Fosheim Grøstad wrote: On Thursday, 4 December 2014 at 01:36:13 UTC, Ola Fosheim Grøstad wrote: So I suppose none of your threads are suspended unless you suspend it with Thread on call_back entry? But why suspend a @nogc thread? What a mess

Re: How to ensure a thread cannot be blocked by the GC?

2014-12-03 Thread ponce via Digitalmars-d-learn
On Wednesday, 3 December 2014 at 22:53:48 UTC, ponce wrote: I have a DLL written in D that gets called by two different threads, created by a non-D host program (audio plugin). I did not create those threads, but my understanding is that they get attached to the D runtime. Thread A is a

How to ensure a thread cannot be blocked by the GC?

2014-12-03 Thread ponce via Digitalmars-d-learn
I have a DLL written in D that gets called by two different threads, created by a non-D host program (audio plugin). I did not create those threads, but my understanding is that they get attached to the D runtime. Thread A is a real-time callback and should not ever block. @nogc seems

Re: Audio file read/write?

2014-11-07 Thread ponce via Digitalmars-d-learn
COn Friday, 7 November 2014 at 02:58:15 UTC, Daren Scot Wilson wrote: What's the current recommended way to read and write audio files? I don't need to play it on the speakers or deal with anything real time - just read a file's data into an array, fiddle with it, and write it out to a file.

Re: D int and C/C++ int etc not really compatible when interfacing to C/C++

2014-11-02 Thread ponce via Digitalmars-d-learn
On Sunday, 2 November 2014 at 12:37:13 UTC, Mike Parker wrote: On 11/2/2014 8:59 PM, Marc Schütz schue...@gmx.net wrote: On Saturday, 1 November 2014 at 21:00:54 UTC, Kagamin wrote: D claims compatibility with system C compiler, which usually have 32-bit int. ... and for C/C++ long which

Recursive data-types

2014-09-27 Thread ponce via Digitalmars-d-learn
I'm dabbling with Scheme interpreter and ultimately I would need to declare the following types. -- struct Function { Environment env; Atom params; Atom body_; } // An atom is either a string, a double, a symbol, a function or a list of atoms alias Atom =

Re: Recursive data-types

2014-09-27 Thread ponce via Digitalmars-d-learn
On Saturday, 27 September 2014 at 11:40:19 UTC, Rikki Cattermole wrote: How to get out of this trap? Do I have to drop Algebraic and go back to manual tagged unions? Converting Function to a class. No where near ideal. But it'll work. It does work! Thanks. Actually it's quite appropriate

Re: Recursive data-types

2014-09-27 Thread ponce via Digitalmars-d-learn
On Saturday, 27 September 2014 at 14:08:18 UTC, H. S. Teoh via Digitalmars- What about using Atom*[] instead of Atom[]? Atom[] seems simpler to me.

Re: Recursive data-types

2014-09-27 Thread ponce via Digitalmars-d-learn
On Saturday, 27 September 2014 at 15:45:20 UTC, Meta wrote: Also, you might want to use This* instead of This[], unless you want an Atom to be able to contain a whole array of other atoms. That's indeed what I want.

Re: Strange segfault (Derelict/OpenGL)

2014-08-29 Thread ponce via Digitalmars-d-learn
On Friday, 29 August 2014 at 11:23:34 UTC, Robin Schroer wrote: I'm not entirely sure where to post, so I will put it here. I'm playing around with D and Derelict 3 to make something with OpenGL (don't really know what yet). I managed to open a window, add an OpenGL context, clear the screen

Cross-module inlining with separate compilation?

2014-08-25 Thread ponce via Digitalmars-d-learn
Is there a way to have cross-module inlining but with separate compilation? Like with link-time generation in C++ compilers.

Re: Programming a Game in D? :D

2014-08-03 Thread ponce via Digitalmars-d-learn
On Saturday, 2 August 2014 at 20:38:59 UTC, David wrote: Hi, not too sure if there's still someone reading this post, but i do have another question. So, I heared so much good stuff about D, it's powerfull, fast the syntax is nice, but well, why is D actually not used for common games yet? (I

Re: Extended math library

2014-07-16 Thread ponce via Digitalmars-d-learn
On Wednesday, 16 July 2014 at 21:12:00 UTC, bachmeier wrote: Have you tried them? Do they work? I couldn't get scid to work last year. I've never heard of dstats before, but it hasn't seen any activity in two years. I'd be surprised if it worked with the latest release of DMD. Can't speak

Re: is there a way to pause a program and resume with just a key press (or enter key)

2014-07-15 Thread ponce via Digitalmars-d-learn
I don't know about Windows, but on Linux, you can just press ctrl-s and ctrl-q to pause/resume the console. (This is a Linux terminal function, not specific to D.) In the Windows shell, the pause key will halt a program and return will resume it.

Re: Extended math library

2014-07-15 Thread ponce via Digitalmars-d-learn
On Tuesday, 15 July 2014 at 20:46:32 UTC, Martijn Pot wrote: To make a long story short: Is there any math library with e.g. mean, std, polynomial fitting, ...? https://github.com/kyllingstad/scid https://github.com/dsimcha/dstats

Undo struct slicing by type-punning

2014-07-14 Thread ponce via Digitalmars-d-learn
Hi, I am porting C++ code that undo Object Slicing by casting const-references: http://en.wikipedia.org/wiki/Object_slicing My translation in D Code struct A { // stuff } struct B { A a; alias a this; // stuff } void myFunction(ref const(A) a) { if (a-is-actually-a-B) {

Re: Undo struct slicing by type-punning

2014-07-14 Thread ponce via Digitalmars-d-learn
Ok, solved it, I just use pointer casts and it seems to work when the struct is sliced. On Monday, 14 July 2014 at 13:23:57 UTC, ponce wrote: Hi, I am porting C++ code that undo Object Slicing by casting const-references: http://en.wikipedia.org/wiki/Object_slicing My translation in D

Re: Undo struct slicing by type-punning

2014-07-14 Thread ponce via Digitalmars-d-learn
On Monday, 14 July 2014 at 18:43:36 UTC, Ali Çehreli wrote: On 07/14/2014 10:35 AM, ponce wrote: Ok, solved it, I just use pointer casts and it seems to work when the struct is sliced. I think there is a terminology issue here. Slicing cannot be undone; once the object is sliced, the non-A

Re: Undo struct slicing by type-punning

2014-07-14 Thread ponce via Digitalmars-d-learn
On Monday, 14 July 2014 at 18:43:36 UTC, Ali Çehreli wrote: It is guaranteed by the language spec that yes, myFunction() takes an A by reference. However, you can't know where that A is coming from; so, the safety of that cast is up to you. Consider: void foo(A a) // -- Already

Re: DUB help plz

2014-07-03 Thread ponce via Digitalmars-d-learn
On Thursday, 3 July 2014 at 04:46:02 UTC, K.K. wrote: Is the only thing I'm missing the .dll's? Thanks! Yes, everything went fine, and you find the missing DLL here: https://www.libsdl.org/download-2.0.php

Re: Source transformation for D

2014-07-03 Thread ponce via Digitalmars-d-learn
On Thursday, 3 July 2014 at 10:17:59 UTC, Kashyap wrote: Hi, Is there a source transformation for D available? Could someone please point me to it? If not, I'd like to work on one - I'd appreciate any pointers on getting started. I am considering writing the whole thing in D and not relying

Re: integer out of range

2014-07-03 Thread ponce via Digitalmars-d-learn
On Thursday, 3 July 2014 at 10:15:25 UTC, pgtkda wrote: why is this possible? int count = 50_000_000; int is always 4 bytes, it can contains from -2_147_483_648 to 2_147_483_647.

Re: What is best way to communicate between computer in local network ?

2014-06-29 Thread ponce via Digitalmars-d-learn
On Friday, 27 June 2014 at 12:51:45 UTC, bioinfornatics wrote: Hi, I have a linux network and i would like to know if they are a D library to communicate between computer efficiently. I do not know if that is better to use websocket and if they exists into dlang: -

Re: Programming a Game in D? :D

2014-05-24 Thread ponce via Digitalmars-d-learn
On Thursday, 22 May 2014 at 15:39:36 UTC, David wrote: Hey, I'm really new to D, and pretty new to programming overall too, But I want to make a 3d Game, (just sth. small). I really like D and want to do it in D, but in the Internet there is no shit about programming a game in D ^^ Is there

Re: Video playback

2014-05-19 Thread ponce via Digitalmars-d-learn
On Sunday, 18 May 2014 at 07:10:29 UTC, Dmitry wrote: Hi everyone! I want to play video in my D-application (maybe WebM or Theora). However didn't find any library for operation with video in D. I am a beginner in D, experience of transfer of libraries with C/C++, certainly isn't present.