Re: mutable keyword

2016-05-22 Thread Marc Schütz via Digitalmars-d-learn
On Sunday, 22 May 2016 at 09:42:54 UTC, Jack Applegame wrote: I agree. But I think we need something that allows *logical* const and immutable. Strict binding constness to physical memory constancy is not always necessary and sometimes even harmful. http://wiki.dlang.org/DIP89

Re: Is there a way to clear an OutBuffer?

2016-05-22 Thread Jon Degenhardt via Digitalmars-d-learn
On Sunday, 22 May 2016 at 23:01:07 UTC, Ali Çehreli wrote: On 05/22/2016 11:59 AM, Jon Degenhardt wrote: Is there a way to clear an OutBuffer, but without freeing the internally managed buffer? Something similar to std.array.appender.clear method. Intent would be to reuse the OutBuffer, but

Re: Is there a way to make a class variable visible but constant to outsiders, but changeable (mutable) to the class itself?

2016-05-22 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 22 May 2016 at 19:29:59 UTC, Meta wrote: Const *is* necessary to prevent _myVar being written to through code like: f.myVar = 4; Of course this isn't necessary for value types, but for reference types. I was referring specifically to marking the function const, not the

Proper way to write benchmark code...

2016-05-22 Thread Era Scarecrow via Digitalmars-d-learn
Is there a good article written for this? Preferably for D specifically... I notice as I'm working a bit with my challenge to make/update the symbol/id compressor that perhaps the GC is getting in the way and skewing the results. Means a number of what I've put up as benchmark values may

Re: Is there a 128-bit integer in D?

2016-05-22 Thread Era Scarecrow via Digitalmars-d-learn
On Sunday, 22 May 2016 at 12:03:16 UTC, Guillaume Piolat wrote: I don't know how this works, someone has to propose it, clean it up and respond to feedback I guess. Glancing briefly at the source, it appears (from what I saw) it's heavily based on doubling the size of a lower type (2 64's

Re: Is there a way to clear an OutBuffer?

2016-05-22 Thread Ali Çehreli via Digitalmars-d-learn
On 05/22/2016 11:59 AM, Jon Degenhardt wrote: Is there a way to clear an OutBuffer, but without freeing the internally managed buffer? Something similar to std.array.appender.clear method. Intent would be to reuse the OutBuffer, but without reallocating memory for the buffer. --Jon Currently

Re: OpenGL with D tutorials

2016-05-22 Thread Rishub Nagpal via Digitalmars-d-learn
On Sunday, 22 May 2016 at 12:13:07 UTC, ixid wrote: What is the best OpenGL tutorial with D to use? I've tried to use d-gamedev-intro and opengl-tutorials and seem to get errors, files that are no longer included are needed (dgl)? and deprecation messages. Perhaps use a C++ tutorial :

Re: Is there a way to make a class variable visible but constant to outsiders, but changeable (mutable) to the class itself?

2016-05-22 Thread Daniel N via Digitalmars-d-learn
On Saturday, 21 May 2016 at 17:32:47 UTC, dan wrote: Is it possible to have a class which has a variable which can be seen from the outside, but which can only be modified from the inside? Something like: class C { int my_var = 3; // semi_const?? void do_something() { my_var = 4; } }

Re: Game Development Using D

2016-05-22 Thread Karabuta via Digitalmars-d-learn
On Saturday, 21 May 2016 at 15:53:18 UTC, David wrote: Hi, I want to try to create a game using D. I'm a complete newbie though (other than having C/C++ experience). Where would I start? Does D have an openGL binding? I am assuming I'll need to leverage a good amount C APIs? Any list of

Is there a way to clear an OutBuffer?

2016-05-22 Thread Jon Degenhardt via Digitalmars-d-learn
Is there a way to clear an OutBuffer, but without freeing the internally managed buffer? Something similar to std.array.appender.clear method. Intent would be to reuse the OutBuffer, but without reallocating memory for the buffer. --Jon

Re: Is there a way to make a class variable visible but constant to outsiders, but changeable (mutable) to the class itself?

2016-05-22 Thread Meta via Digitalmars-d-learn
On Sunday, 22 May 2016 at 03:06:44 UTC, Mike Parker wrote: On Saturday, 21 May 2016 at 19:17:00 UTC, dan wrote: Thanks Vit, Meta, and Yuxuan for your speedy help! So 3 pieces to put together, function, const, and @property (and i guess final for protection against subclasses). Minimally,

Re: Game Development Using D

2016-05-22 Thread Vadim Lopatin via Digitalmars-d-learn
On Saturday, 21 May 2016 at 15:53:18 UTC, David wrote: Hi, I want to try to create a game using D. I'm a complete newbie though (other than having C/C++ experience). Where would I start? Does D have an openGL binding? I am assuming I'll need to leverage a good amount C APIs? Any list of

Re: mutable keyword

2016-05-22 Thread chmike via Digitalmars-d-learn
There is a benefit in not allowing to get pointers to class members. It allows to have movable object instances and this give access to some faster GC algorithms like generational garbage collection which is in use in Java. As an old C++ programmer and newbee in D programming, the D

Re: Use Requests to send data to webpage - how?

2016-05-22 Thread TheDGuy via Digitalmars-d-learn
On Friday, 20 May 2016 at 14:42:19 UTC, TheDGuy wrote: On Friday, 20 May 2016 at 09:21:33 UTC, Kagamin wrote: Does this work? Request rq = Request(); Response rs = rq.exec!"GET"("http://somewebpage.org/;, [parameter:data]); No :( If i call my SQL.php function directly with: Response rs =

OpenGL with D tutorials

2016-05-22 Thread ixid via Digitalmars-d-learn
What is the best OpenGL tutorial with D to use? I've tried to use d-gamedev-intro and opengl-tutorials and seem to get errors, files that are no longer included are needed (dgl)? and deprecation messages.

Re: mutable keyword

2016-05-22 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, May 22, 2016 09:42:54 Jack Applegame via Digitalmars-d-learn wrote: > On Saturday, 21 May 2016 at 21:49:23 UTC, Jonathan M Davis wrote: > > Rebindable is in kind of a weird grey area. It involves a > > union, not casting, and it's only ever mutating the class > > reference, not the

Re: OpenGL with D tutorials

2016-05-22 Thread Guillaume Piolat via Digitalmars-d-learn
On Sunday, 22 May 2016 at 14:04:48 UTC, ixid wrote: On Sunday, 22 May 2016 at 12:55:47 UTC, Guillaume Piolat wrote: On Sunday, 22 May 2016 at 12:13:07 UTC, ixid wrote: What is the best OpenGL tutorial with D to use? I've tried to use d-gamedev-intro and opengl-tutorials and seem to get

Re: Is there a 128-bit integer in D?

2016-05-22 Thread Guillaume Piolat via Digitalmars-d-learn
On Sunday, 22 May 2016 at 09:47:54 UTC, Era Scarecrow wrote: On Sunday, 22 May 2016 at 09:39:45 UTC, Saurabh Das wrote: On Sunday, 22 May 2016 at 09:07:32 UTC, Guillaume Piolat wrote: https://github.com/d-gamedev-team/gfm/blob/master/integers/gfm/integers/wideint.d wideint was exactly what I

Re: OpenGL with D tutorials

2016-05-22 Thread Guillaume Piolat via Digitalmars-d-learn
On Sunday, 22 May 2016 at 12:13:07 UTC, ixid wrote: What is the best OpenGL tutorial with D to use? I've tried to use d-gamedev-intro and opengl-tutorials and seem to get errors, files that are no longer included are needed (dgl)? and deprecation messages. Not a tutorial by any means but

Re: OpenGL with D tutorials

2016-05-22 Thread ixid via Digitalmars-d-learn
On Sunday, 22 May 2016 at 12:55:47 UTC, Guillaume Piolat wrote: On Sunday, 22 May 2016 at 12:13:07 UTC, ixid wrote: What is the best OpenGL tutorial with D to use? I've tried to use d-gamedev-intro and opengl-tutorials and seem to get errors, files that are no longer included are needed (dgl)?

Linking C code with D...

2016-05-22 Thread Era Scarecrow via Digitalmars-d-learn
While trying to make a benchmark for comparing results of my possible compression replacement, I'm finding it quite difficult to link the c code with the d code. So I've managed to compile the compress.c file using dmc, but when I link the obj file to reference it I don't seem to see it...

Re: Linking C code with D...

2016-05-22 Thread rikki cattermole via Digitalmars-d-learn
On 22/05/2016 6:08 PM, Era Scarecrow wrote: While trying to make a benchmark for comparing results of my possible compression replacement, I'm finding it quite difficult to link the c code with the d code. So I've managed to compile the compress.c file using dmc, but when I link the obj file

Re: Linking C code with D...

2016-05-22 Thread Era Scarecrow via Digitalmars-d-learn
On Sunday, 22 May 2016 at 06:10:07 UTC, rikki cattermole wrote: Move id_compress out of the unittest block. Well that certainly did it...

Re: Is there a 128-bit integer in D?

2016-05-22 Thread tcak via Digitalmars-d-learn
On Saturday, 21 May 2016 at 09:56:51 UTC, Stefan Koch wrote: On Saturday, 21 May 2016 at 09:43:38 UTC, Saurabh Das wrote: I see that 'cent' and 'ucent' are reserved for future use but not yet implemented. Does anyone have a working implementation of these types? Alternatively, is there an

Re: Overload new and delete to not use GC?

2016-05-22 Thread Guillaume Piolat 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

Re: mutable keyword

2016-05-22 Thread Jack Applegame via Digitalmars-d-learn
On Saturday, 21 May 2016 at 21:49:23 UTC, Jonathan M Davis wrote: Rebindable is in kind of a weird grey area. It involves a union, not casting, and it's only ever mutating the class reference, not the object itself. Certainly, if it mutated the object, it would be undefined behavior, but it's

Re: Is there a 128-bit integer in D?

2016-05-22 Thread Era Scarecrow via Digitalmars-d-learn
On Sunday, 22 May 2016 at 09:39:45 UTC, Saurabh Das wrote: On Sunday, 22 May 2016 at 09:07:32 UTC, Guillaume Piolat wrote: https://github.com/d-gamedev-team/gfm/blob/master/integers/gfm/integers/wideint.d wideint was exactly what I was looking for! Thank you so much :) I WANT! If this does

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

Overload new and delete to not use GC?

2016-05-22 Thread Rusty via Digitalmars-d-learn
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 GC? Also, it seems many features of the language rely

Re: Is there a 128-bit integer in D?

2016-05-22 Thread Nicholas Wilson via Digitalmars-d-learn
On Saturday, 21 May 2016 at 09:43:38 UTC, Saurabh Das wrote: I see that 'cent' and 'ucent' are reserved for future use but not yet implemented. Does anyone have a working implementation of these types? Alternatively, is there an any effort towards implementation of arbitrary-sized integers

Re: Is there a 128-bit integer in D?

2016-05-22 Thread Guillaume Piolat via Digitalmars-d-learn
On Sunday, 22 May 2016 at 07:40:08 UTC, Nicholas Wilson wrote: On Saturday, 21 May 2016 at 09:43:38 UTC, Saurabh Das wrote: I see that 'cent' and 'ucent' are reserved for future use but not yet implemented. Does anyone have a working implementation of these types? Alternatively, is there an

Re: Is there a 128-bit integer in D?

2016-05-22 Thread Saurabh Das via Digitalmars-d-learn
On Sunday, 22 May 2016 at 09:07:32 UTC, Guillaume Piolat wrote: On Sunday, 22 May 2016 at 07:40:08 UTC, Nicholas Wilson wrote: On Saturday, 21 May 2016 at 09:43:38 UTC, Saurabh Das wrote: I see that 'cent' and 'ucent' are reserved for future use but not yet implemented. Does anyone have a