Re: enum abuse

2014-02-28 Thread Vladimir Panteleev
On Saturday, 1 March 2014 at 05:39:24 UTC, Meta wrote: Hmm, I didn't know that. Interesting. I think this was a mistake on Andrei's part, though. The concept of enumerations doesn't have anything to do with evaluating an expression at compile time It doesn't. enum x = expression; is the same

Re: How to return range constructs?

2014-02-28 Thread Mike Parker
On Friday, 28 February 2014 at 19:02:24 UTC, Robin wrote: Hiho, ok thanks - I haven't known that interfaces are not a "must extend" like in java to serve as a real interface to something. This is strange to me in first place but has its pros. Actually, when using code that works with interfa

Re: Nobody understands templates?

2014-02-28 Thread Mike Parker
On Friday, 28 February 2014 at 18:42:57 UTC, Steve Teale wrote: All the D aficionados seem to wet their pants over meta-programming, but I struggle to find a place to use it. IIRC, I used it in a couple of places when I was trying to write library stuff for MySQL, but in my current project, I us

Re: Template error on compiling ...

2014-02-28 Thread Meta
EOn Saturday, 1 March 2014 at 00:17:55 UTC, Stanislav Blinov wrote: /// Tests if type M is a Matrix enum bool isSomeMatrix(M) = is(M == Matrix!T, T); Unrelated, but it may be of some interest. This isn't really a good way to define your isSomeMatrix template, i.e., tying it to a specific type.

Re: enum abuse

2014-02-28 Thread Meta
On Friday, 28 February 2014 at 19:09:06 UTC, Steven Schveighoffer wrote: For a *VERY* short time (I think one version perhaps), we had the 'manifest' keyword which was supposed to mean manifest constant. It was removed, Andrei was a very stanch supporter of enum being the manifest constant ke

Re: Nobody understands templates?

2014-02-28 Thread H. S. Teoh
On Sat, Mar 01, 2014 at 01:07:04AM +, Jesse Phillips wrote: > On Friday, 28 February 2014 at 18:42:57 UTC, Steve Teale wrote: > >Is this typical - libraries use templates, applications don't, or > >am I just being unimaginative? > > > >Steve > > I believe it is typical. However it can also be

Re: Nobody understands templates?

2014-02-28 Thread Rikki Cattermole
In my experience in D, it comes down to one thing. Do I need to handle the type of something and act upon it? This is shown heavily in dvorm and Cmsed's router/restful api/javascript generator. In these cases I need to create code and have it string mixed in based upon a type. However I'm no

Re: GC.BlkAttr.FINALIZE

2014-02-28 Thread Steven Schveighoffer
On Fri, 28 Feb 2014 18:45:50 -0500, Namespace wrote: We need a precise GC to get struct dtors to work, the alternative would be extremely hackish. Since I expect/fear that such a implementation is not done in the next 12 months: what would be the alternative? Examine the GC code, and f

Re: Nobody understands templates?

2014-02-28 Thread Jesse Phillips
On Friday, 28 February 2014 at 18:42:57 UTC, Steve Teale wrote: Is this typical - libraries use templates, applications don't, or am I just being unimaginative? Steve I believe it is typical. However it can also be definition, what is a library? What is an application? Certainly your applica

Re: How to return range constructs?

2014-02-28 Thread anonymous
On Friday, 28 February 2014 at 23:53:48 UTC, Robin wrote: I have made matrix a struct for a better performance and since everybody here on the forums was complaining about that it should be a struct type. Making it a class is just a simple way to avoid the (explicit) pointer. Weigh that again

Re: Template error on compiling ...

2014-02-28 Thread Stanislav Blinov
On Friday, 28 February 2014 at 23:16:48 UTC, Robin wrote: Hiho, just for you: the whole code! =) http://dpaste.dzfl.pl/cd1537571a4d The idea is that I have matrix instances and so-called ElementalOperations which are able to operate on matrices to solve certain algorithms object oriented with

Re: How to return range constructs?

2014-02-28 Thread Robin
Hiho, I have made matrix a struct for a better performance and since everybody here on the forums was complaining about that it should be a struct type. When I uncomment the currently commented assertion I get linking errors. (these strange and nearly unreadable error messages.) Here is a

Re: GC.BlkAttr.FINALIZE

2014-02-28 Thread Namespace
We need a precise GC to get struct dtors to work, the alternative would be extremely hackish. Since I expect/fear that such a implementation is not done in the next 12 months: what would be the alternative?

Re: GC.BlkAttr.FINALIZE

2014-02-28 Thread Namespace
On Friday, 28 February 2014 at 23:30:46 UTC, Steven Schveighoffer wrote: On Fri, 28 Feb 2014 18:26:29 -0500, Namespace wrote: Oh man I need sleep. Of course it is 2 at the end of the scope. But what is important: I never see "DTor". So the Data is not finalized. FINALIZE expects the layout

Re: Nobody understands templates?

2014-02-28 Thread Frustrated
On Friday, 28 February 2014 at 18:42:57 UTC, Steve Teale wrote: All the D aficionados seem to wet their pants over meta-programming, but I struggle to find a place to use it. IIRC, I used it in a couple of places when I was trying to write library stuff for MySQL, but in my current project, I us

Re: How to return range constructs?

2014-02-28 Thread anonymous
On Friday, 28 February 2014 at 23:06:24 UTC, Robin wrote: sorry for the double post but I can't find an edit button. Don't worry, there is none. Replying to yourself is proper etiquette around here. I have managed to write a custom ForwardRange based on your code as I wished it to behave. How

Re: GC.BlkAttr.FINALIZE

2014-02-28 Thread Steven Schveighoffer
On Fri, 28 Feb 2014 18:26:29 -0500, Namespace wrote: Oh man I need sleep. Of course it is 2 at the end of the scope. But what is important: I never see "DTor". So the Data is not finalized. FINALIZE expects the layout of the block to be an Object. You aren't implementing the correct inte

Re: GC.BlkAttr.FINALIZE

2014-02-28 Thread Namespace
Oh man I need sleep. Of course it is 2 at the end of the scope. But what is important: I never see "DTor". So the Data is not finalized.

GC.BlkAttr.FINALIZE

2014-02-28 Thread Namespace
Is it my misunderstanding or does FINALIZE not work? import std.stdio; import core.memory : GC; void main() { int id = 2; struct Foo { ~this() { id--; writeln("DTor"); } } Foo* fs = ca

Re: Template error on compiling ...

2014-02-28 Thread Robin
Hiho, just for you: the whole code! =) http://dpaste.dzfl.pl/cd1537571a4d The idea is that I have matrix instances and so-called ElementalOperations which are able to operate on matrices to solve certain algorithms object oriented without nasty loops and so on. This had worked perfectly in

Re: How to return range constructs?

2014-02-28 Thread Robin
Hiho, sorry for the double post but I can't find an edit button. I have managed to write a custom ForwardRange based on your code as I wished it to behave. However, the assertion fails on compilation, now. The only thing I have changed is that I have added a constructor as well as changing th

Re: Write variable from other function

2014-02-28 Thread Ali Çehreli
On 02/28/2014 06:42 AM, Dicebot wrote: > You want static variables, either in form of global variables > (discouraged) or static class fields: Luckily, there is no global namespace in D. So, when it makes sense module-level global variables are fine as well. Ali

Re: How to build DMD on windows ?

2014-02-28 Thread Vladimir Panteleev
On Friday, 28 February 2014 at 20:14:26 UTC, Remo wrote: How to build DMD on windows ? And then run all the test for it? README.md is pretty empty at the moment. Of course it is possible to wait for some Fixes in DMD compiler may be it could be faster just to fix them by my self and then hope

Re: Template error on compiling ...

2014-02-28 Thread Ali Çehreli
On 02/28/2014 02:21 PM, Robin wrote: > I am only working with references to matrix and in my understanding this > shouldn't affect the compilate. As I understand it, Matrix is not a type; rather a type template. Only instances of that template like Matrix!double can be used as types. I was in

Re: Template error on compiling ...

2014-02-28 Thread Robin
Hiho, aww, that's a noob mistake of me. Thanks! Should take a closer look at the error messages next time a should think more about their special meaning ... It works now while it feels strange that I have to template the three classes as I am only working with references to matrix and in

Re: How to build DMD on windows ?

2014-02-28 Thread Namespace
On Friday, 28 February 2014 at 20:14:26 UTC, Remo wrote: How to build DMD on windows ? And then run all the test for it? README.md is pretty empty at the moment. Of course it is possible to wait for some Fixes in DMD compiler may be it could be faster just to fix them by my self and then hope

Re: Template error on compiling ...

2014-02-28 Thread anonymous
On Friday, 28 February 2014 at 20:54:42 UTC, Robin wrote: Hiho, with import neoLab.core.Matrix; abstract class ElementalOperation(T = double) { abstract void opCall(ref Matrix!T m); abstract override string toString(); } where I have made the abstract class templated "(T = double)" a

Re: Template error on compiling ...

2014-02-28 Thread Robin
Hiho, with import neoLab.core.Matrix; abstract class ElementalOperation(T = double) { abstract void opCall(ref Matrix!T m); abstract override string toString(); } where I have made the abstract class templated "(T = double)" and where I have added a "!T" after "Matrix" in the opCall p

Re: Nobody understands templates?

2014-02-28 Thread H. S. Teoh
On Fri, Feb 28, 2014 at 06:42:57PM +, Steve Teale wrote: > All the D aficionados seem to wet their pants over > meta-programming, but I struggle to find a place to use it. > > IIRC, I used it in a couple of places when I was trying to write > library stuff for MySQL, but in my current project,

How to build DMD on windows ?

2014-02-28 Thread Remo
How to build DMD on windows ? And then run all the test for it? README.md is pretty empty at the moment. Of course it is possible to wait for some Fixes in DMD compiler may be it could be faster just to fix them by my self and then hope that the fix will be accepted...

Re: GC for noobs

2014-02-28 Thread Xavier Bigand
Le 28/02/2014 13:22, Szymon Gatner a écrit : On Friday, 28 February 2014 at 11:43:58 UTC, Dicebot wrote: On Friday, 28 February 2014 at 11:28:01 UTC, Szymon Gatner wrote: I didn't mean "basic" in the sense of "easy" but in the sense of something that has to dealt with all the time / is common r

Re: Nobody understands templates?

2014-02-28 Thread Meta
On Friday, 28 February 2014 at 18:42:57 UTC, Steve Teale wrote: All the D aficionados seem to wet their pants over meta-programming, but I struggle to find a place to use it. IIRC, I used it in a couple of places when I was trying to write library stuff for MySQL, but in my current project, I us

Re: Template error on compiling ...

2014-02-28 Thread anonymous
On Friday, 28 February 2014 at 19:33:17 UTC, Robin wrote: opCall(ref Matrix!() m) opCall(ref Matrix!T m) aswell as opCall(ref Matrix!(m)) This one's just nonsense. or just opCall(ref Matrix m) This one gives you the "used as a type" kind of error message. give me all the same error as

Re: Template error on compiling ...

2014-02-28 Thread Robin
Hiho, both opCall(ref Matrix!() m) opCall(ref Matrix!T m) aswell as opCall(ref Matrix!(m)) or just opCall(ref Matrix m) give me all the same error as the one stated in the first post ... :/ Nothing really seems to work here. Robin

Re: Nobody understands templates?

2014-02-28 Thread FreeSlave
Well, when you're starting to use many templates you may end up with separate library. Templates provide compile-time correctness, concepts (in Boost sense), policy-base design (see "Modern C++ Design: Generic Programming and Design Patterns Applied" by Andrei Alexandrescu) and compile-time c

Re: Dynamically calling external libraries.

2014-02-28 Thread Setra
Thanks! That was perfect!

Re: Template error on compiling ...

2014-02-28 Thread anonymous
On Friday, 28 February 2014 at 19:16:11 UTC, Tobias Pankrath wrote: On Friday, 28 February 2014 at 19:09:11 UTC, Robin wrote: override void opCall(ref Matrix m) pure nothrow { foreach (immutable col; 0 .. m.getDimension().cols) { m[this.row, col]

Re: Template error on compiling ...

2014-02-28 Thread Tobias Pankrath
On Friday, 28 February 2014 at 19:09:11 UTC, Robin wrote: override void opCall(ref Matrix m) pure nothrow { foreach (immutable col; 0 .. m.getDimension().cols) { m[this.row, col] *= this.factor; } I guess this is the culprit. You

Re: enum abuse

2014-02-28 Thread Namespace
On Friday, 28 February 2014 at 18:21:39 UTC, Steve Teale wrote: On Friday, 28 February 2014 at 11:47:45 UTC, Vladimir Panteleev wrote: A "const" or "immutable" declaration would declare a constant variable - meaning, unless it is optimized out at a later point, it will end up in the data segm

Re: Nobody understands templates?

2014-02-28 Thread Dicebot
On Friday, 28 February 2014 at 18:42:57 UTC, Steve Teale wrote: Is this typical - libraries use templates, applications don't, or am I just being unimaginative? Steve It is quite true as a generalization but in practice border line between application and a library is not that clear. You oft

Re: enum abuse

2014-02-28 Thread Steven Schveighoffer
On Fri, 28 Feb 2014 13:21:39 -0500, Steve Teale wrote: I just wonder slightly why a language that prides itself so on its metaprogramming capabilities does not have a keyword that makes it obvious For a *VERY* short time (I think one version perhaps), we had the 'manifest' keyword whic

Template error on compiling ...

2014-02-28 Thread Robin
Hiho, I am currently working on a matrix library (matrices are templated structs) and have just implemented so-called "ElementalOperations" which perform certain tasks on mutable matrices. There is an abstract ElementalOperation where three different ElementalOperation types inherit from. T

Re: How to return range constructs?

2014-02-28 Thread Robin
Hiho, ok thanks - I haven't known that interfaces are not a "must extend" like in java to serve as a real interface to something. This is strange to me in first place but has its pros. And when I want to build up a RandomAccessFinite I just have to implement the other methods as well, okay.

Re: Write variable from other function

2014-02-28 Thread Dicebot
On Friday, 28 February 2014 at 18:18:15 UTC, Suliman wrote: Probably not very good idea from me, I understand that I was wrong thinking! In case you really-really-really want it, such behavior can be achieved via std.typecons.Tuple : import std.typecons; auto foo() { return tuple(true,

Re: enum abuse

2014-02-28 Thread Dicebot
On Friday, 28 February 2014 at 18:21:39 UTC, Steve Teale wrote: BTW, why does an immutable integer type need to have an address? Steve So that you can pass it to function `void foo(immutable(int)* arg)`. It is just a normal variable after all, only immutable.

Re: Nobody understands templates?

2014-02-28 Thread Adam D. Ruppe
A lot of my code doesn't use very many new templates either... my web code does use a few magic templates which fills in a lot of boilerplate, but the app code - the business logic - uses almost no templates at all. My xml/html dom.d library also uses very few templates, it just doesn't fit as

Nobody understands templates?

2014-02-28 Thread Steve Teale
All the D aficionados seem to wet their pants over meta-programming, but I struggle to find a place to use it. IIRC, I used it in a couple of places when I was trying to write library stuff for MySQL, but in my current project, I use it only once. That's when I want to stuff something onto my und

Re: runtime loading D shared library as a standalone (with it's own GC etc)

2014-02-28 Thread Martin Nowak
On 02/26/2014 10:16 PM, Timothee Cour wrote: Currently (on OSX) I can runtime load a D dll from a C program, but not from a D program, which seems silly. Is it possible to runtime load a D shared library as a standalone (ie without sharing GC, runtime or any other data), treating it as if we wer

Re: @disable this for structs

2014-02-28 Thread Steve Teale
On Friday, 28 February 2014 at 16:02:26 UTC, Dicebot wrote: ... Mmm, simple question, complicated answer. But the first one was enough for me at this point.

Re: enum abuse

2014-02-28 Thread Steve Teale
On Friday, 28 February 2014 at 11:47:45 UTC, Vladimir Panteleev wrote: A "const" or "immutable" declaration would declare a constant variable - meaning, unless it is optimized out at a later point, it will end up in the data segment and have its own address. An enum declares a manifest consta

Re: Write variable from other function

2014-02-28 Thread Suliman
bool isConfigExist() { configpath = exePath() ~ "config.txt"; if (exists(configpath)) { return true; }

Re: Write variable from other function

2014-02-28 Thread Suliman
On Friday, 28 February 2014 at 16:26:17 UTC, Dicebot wrote: On Friday, 28 February 2014 at 16:16:36 UTC, Suliman wrote: Thanks! I know about static, but now I need experience to work with class constructor. So now I can't understand what I can do with error: "Error: need 'this' for 'isConfigExi

Re: Dynamically calling external libraries.

2014-02-28 Thread Marc Schütz
On Friday, 28 February 2014 at 18:05:13 UTC, Marc Schütz wrote: On Friday, 28 February 2014 at 17:29:09 UTC, Setra wrote: I am using dmd_2.065.0-0_i386.deb on a 32 bit machine. Ah, I can reproduce it with 32bit executables: # dmd -m32 main1.d -L-ldl # dmd -m32 -c dll.d -fPIC # dmd -m32 -ofli

Re: Dynamically calling external libraries.

2014-02-28 Thread Marc Schütz
On Friday, 28 February 2014 at 17:29:09 UTC, Setra wrote: I am using dmd_2.065.0-0_i386.deb on a 32 bit machine. Ah, I can reproduce it with 32bit executables: # dmd -m32 main1.d -L-ldl # dmd -m32 -c dll.d -fPIC # dmd -m32 -oflibdll.so dll.o -shared -defaultlib= # LD_LIBRARY_PATH=. ./main1 +m

Re: Dynamically calling external libraries.

2014-02-28 Thread Tolga Cakiroglu
On Friday, 28 February 2014 at 17:29:09 UTC, Setra wrote: I am using dmd_2.065.0-0_i386.deb on a 32 bit machine. Hi Setra, I am trying to make external libraries work as well, but having problems continuously. Could you test that following function in your library and call it from main prog

Re: Dynamically calling external libraries.

2014-02-28 Thread Setra
I am using dmd_2.065.0-0_i386.deb on a 32 bit machine.

Re: enum abuse

2014-02-28 Thread Mike
On Friday, 28 February 2014 at 16:32:32 UTC, Gary Willoughby wrote: On Friday, 28 February 2014 at 12:12:34 UTC, Mike wrote: Damn good explanation. I think I'll do a pull for this in the docs. Thank you! It's mentioned here right at the bottom http://dlang.org/enum.html which could do with

Re: How to return range constructs?

2014-02-28 Thread Dicebot
Looks like you are over-complicating things: http://dpaste.dzfl.pl/eaca1408dc88 import std.range; struct ColumnVectorForwardRange(T) { private { T[] data; size_t cur = 0; size_t length = 0; } ColumnVectorForwardRan

Re: Dynamically calling external libraries.

2014-02-28 Thread Marc Schütz
On Friday, 28 February 2014 at 16:44:02 UTC, Setra wrote: Marc would you be willing to post your compile script? Or did you just use what the wiki said to? I used exactly what I quoted in my post: dmd main1.d -L-ldl dmd -c dll.d -fPIC dmd -oflibdll.so dll.o -shared -defaultlib= LD_LIBRARY_PATH

How to return range constructs?

2014-02-28 Thread Robin
Hiho, for experimental and learning reasons I am working on a simple matrix library for D. And since ranges seem to be a cool feature of the D language I am currently trying to understand them and use them more in my codes. So I thought that it would be a nice feature if I could create meth

Re: Dynamically calling external libraries.

2014-02-28 Thread Setra
Marc would you be willing to post your compile script? Or did you just use what the wiki said to?

Re: enum abuse

2014-02-28 Thread Gary Willoughby
On Friday, 28 February 2014 at 12:12:34 UTC, Mike wrote: Damn good explanation. I think I'll do a pull for this in the docs. Thank you! It's mentioned here right at the bottom http://dlang.org/enum.html which could do with fleshing out a bit.

Re: Switching from Java to D: Beginner questions, multiplatform issues, etc.

2014-02-28 Thread Jesse Phillips
On Friday, 28 February 2014 at 12:10:17 UTC, Bienlein wrote: This topic mentions IMHO an important point: D is not only interesting for C++ people, but also for Java developers. Companies that are happy with Java may have little incentive to change to D or maybe Go. But when starting something

Re: Write variable from other function

2014-02-28 Thread Mike Parker
On 3/1/2014 1:16 AM, Suliman wrote: When you declare variable static it makes it shared between all instances of that class, allowing to use it without any specific instance. When you declare method as static you say to compiler that it is not going to use any non-static fields of the class (norm

Re: Write variable from other function

2014-02-28 Thread Dicebot
On Friday, 28 February 2014 at 16:16:36 UTC, Suliman wrote: Thanks! I know about static, but now I need experience to work with class constructor. So now I can't understand what I can do with error: "Error: need 'this' for 'isConfigExist' of type 'bool()'" Most likely you don't create an inst

Re: Write variable from other function

2014-02-28 Thread Suliman
When you declare variable static it makes it shared between all instances of that class, allowing to use it without any specific instance. When you declare method as static you say to compiler that it is not going to use any non-static fields of the class (normally available via "this" pointer)

Re: Write variable from other function

2014-02-28 Thread Dicebot
On Friday, 28 February 2014 at 15:59:41 UTC, Suliman wrote: Oh thanks! I had forgot that I should declarate it's in class. But what about return type? Look like that DMD want that I declarate some bool value in constructor. It's get me next error: "Error: need 'this' for 'isConfigExist' of type

Re: @disable this for structs

2014-02-28 Thread Dicebot
One feature I miss is "partial static import" - one that essentially automates `import modname = packname.modname`, allowing to qualify by module name only. That could have removed some repeating boilerplate from my code.

Re: Write variable from other function

2014-02-28 Thread Suliman
Oh thanks! I had forgot that I should declarate it's in class. But what about return type? Look like that DMD want that I declarate some bool value in constructor. It's get me next error: "Error: need 'this' for 'isConfigExist' of type 'bool()'" http://www.everfall.com/paste/id.php?qs2lsozrd3k

Re: @disable this for structs

2014-02-28 Thread Mike Parker
On 2/28/2014 11:37 PM, Dicebot wrote: I'd write it this way: === something/bar.d === interface Bar {} === something/barmanager.d === import something.bar; // possibly public import void initialize(); void terminate(); === app.d === import something.bar; import barmanager = something.barm

Re: Write variable from other function

2014-02-28 Thread Jesse Phillips
On Friday, 28 February 2014 at 14:15:17 UTC, Suliman wrote: I continue attempted to become a programmer, but I have small problem. I can't understand how to write/change variable from one function by code in another. http://www.everfall.com/paste/id.php?nqq61th5loq3 writeln(configpath); // I

Re: custom memory management

2014-02-28 Thread Namespace
On Friday, 28 February 2014 at 14:47:31 UTC, Dicebot wrote: On Friday, 28 February 2014 at 14:08:11 UTC, Namespace wrote: No, currently it is not deprecated. It is suggested to be deprecated. :P And destroy doesn't finalize the data. :/ See: http://forum.dlang.org/thread/bug-1225...@https.d.pur

Re: custom memory management

2014-02-28 Thread Dicebot
On Friday, 28 February 2014 at 14:08:11 UTC, Namespace wrote: No, currently it is not deprecated. It is suggested to be deprecated. :P And destroy doesn't finalize the data. :/ See: http://forum.dlang.org/thread/bug-1225...@https.d.puremagic.com%2Fissues%2F and http://forum.dlang.org/thread/bu

Re: Write variable from other function

2014-02-28 Thread Dicebot
On Friday, 28 February 2014 at 14:15:17 UTC, Suliman wrote: I remember (if I now mistake) that there is way to get access to vars from other class in way like MyClass2.var = 2 but probably I am wrong You want static variables, either in form of global variables (discouraged) or static class f

Re: @disable this for structs

2014-02-28 Thread Dicebot
On Friday, 28 February 2014 at 13:42:21 UTC, Mike Parker wrote: Consider this. enum Foo {...} interface Bar {} struct BarManager { public static { void initialize(); void terminate(); ... more stuff } } This is my use-case. I don't want my users to have to refer to Fo

Re: Write variable from other function

2014-02-28 Thread bearophile
Suliman: I continue attempted to become a programmer, While D is good enough language, but D is large, so I think it's not the best as first language :-) I can't understand how to write/change variable from one function by code in another. In general you can't, and even if you find ways

Re: Colons and brackets

2014-02-28 Thread anonymous
On Friday, 28 February 2014 at 04:31:03 UTC, evilrat wrote: On Friday, 28 February 2014 at 04:19:47 UTC, Etienne Cimon wrote: Hi all, I'm a little perplexed b/c I can't seem to find anything that could tell me where this ends: version(something): code code code \eof How do you stop statemen

Write variable from other function

2014-02-28 Thread Suliman
I continue attempted to become a programmer, but I have small problem. I can't understand how to write/change variable from one function by code in another. http://www.everfall.com/paste/id.php?nqq61th5loq3 writeln(configpath); // I need write this one! <-- this string I remember (if I now mi

Re: custom memory management

2014-02-28 Thread Namespace
On Friday, 28 February 2014 at 13:38:59 UTC, Dicebot wrote: On Friday, 28 February 2014 at 13:32:33 UTC, Namespace wrote: I will vote, too. It's somewhat strange: Since it works with delete it should also work with the current GC, or? Someone should figure out why and how delete works this way.

Re: @disable this for structs

2014-02-28 Thread Mike Parker
On 2/28/2014 8:59 PM, Dicebot wrote: On Friday, 28 February 2014 at 01:16:41 UTC, Mike Parker wrote: Ideally, I'd love for the compiler to pick up on this idiom and not generate any typeinfo in this situation. Ideally one should use modules as namespaces :P I don't buy that. That works fine

Re: custom memory management

2014-02-28 Thread Namespace
On Friday, 28 February 2014 at 13:16:40 UTC, Dicebot wrote: On Friday, 28 February 2014 at 13:06:05 UTC, Namespace wrote: What can still take a long time. It annoys me very much that with arrays I can not rely on that the struct DTors are called. Yep, this bug has immediately got my vote :) It

Re: @disable this for structs

2014-02-28 Thread Dicebot
On Friday, 28 February 2014 at 12:59:32 UTC, Mike Parker wrote: Ideally one should use modules as namespaces :P I don't buy that. That works fine to resolve conflicts, but it doesn't work for fine-grained namespace management. And when using named imports, that means everything in the module

Re: @disable this for structs

2014-02-28 Thread Dicebot
On Friday, 28 February 2014 at 12:52:38 UTC, Remo wrote: On Friday, 28 February 2014 at 11:59:40 UTC, Dicebot wrote: On Friday, 28 February 2014 at 01:16:41 UTC, Mike Parker wrote: Ideally, I'd love for the compiler to pick up on this idiom and not generate any typeinfo in this situation. Ide

Re: @disable this for structs

2014-02-28 Thread Mike Parker
On 2/28/2014 10:21 PM, Dicebot wrote: D design is based on module as smallest composition unit. If you find yourself in situation where you want to have two namespaces in a single module, you should split it into two modules. Consider this. enum Foo {...} interface Bar {} struct BarManager

Re: @disable this for structs

2014-02-28 Thread Dicebot
On Friday, 28 February 2014 at 13:32:13 UTC, Remo wrote: What I hate already are problems with structs and ctors. Most time while porting C++ code to D I spend a lot of time to resolve all the problems that happens because of struct ctors. If I forget to do this then it still compiles but does n

Re: @disable this for structs

2014-02-28 Thread Remo
On Friday, 28 February 2014 at 13:23:51 UTC, Dicebot wrote: On Friday, 28 February 2014 at 12:52:38 UTC, Remo wrote: On Friday, 28 February 2014 at 11:59:40 UTC, Dicebot wrote: On Friday, 28 February 2014 at 01:16:41 UTC, Mike Parker wrote: Ideally, I'd love for the compiler to pick up on this

Re: custom memory management

2014-02-28 Thread Dicebot
On Friday, 28 February 2014 at 13:32:33 UTC, Namespace wrote: I will vote, too. It's somewhat strange: Since it works with delete it should also work with the current GC, or? Someone should figure out why and how delete works this way. :) Well, delete is deprecated so it can do any kind of arc

Re: GC for noobs

2014-02-28 Thread Dicebot
On Friday, 28 February 2014 at 12:52:28 UTC, Szymon Gatner wrote: I'm a C folk and I'm really happy :) +1 C'mon, GC has to be an itch for you mallocers :) Come to the dark side... It sometimes is. In that case we don't use GC. Don't get me wrong - there are issues with current GC enforcem

Re: custom memory management

2014-02-28 Thread Namespace
On Friday, 28 February 2014 at 12:54:32 UTC, Dicebot wrote: On Friday, 28 February 2014 at 12:36:48 UTC, Simon Bürger wrote: If you are right that would mean that the current dmd/runtime does not follow the spec. Curious. The current implementation is not aware of strcut-destructors on the heap

Re: custom memory management

2014-02-28 Thread Dicebot
On Friday, 28 February 2014 at 13:06:05 UTC, Namespace wrote: What can still take a long time. It annoys me very much that with arrays I can not rely on that the struct DTors are called. Yep, this bug has immediately got my vote :) It does require someone knowledgable of GC to fix in forseeabl

Re: GC for noobs

2014-02-28 Thread Mike Parker
On 2/28/2014 9:15 PM, Szymon Gatner wrote: So to sum up: C folks are not really happy, C++ folks are not really happy and C# folks are not really happy :P I'm a C folk and I'm really happy :)

Re: @disable this for structs

2014-02-28 Thread Tobias Pankrath
On Friday, 28 February 2014 at 12:52:38 UTC, Remo wrote: On Friday, 28 February 2014 at 11:59:40 UTC, Dicebot wrote: On Friday, 28 February 2014 at 01:16:41 UTC, Mike Parker wrote: Ideally, I'd love for the compiler to pick up on this idiom and not generate any typeinfo in this situation. Ide

Re: custom memory management

2014-02-28 Thread Dicebot
On Friday, 28 February 2014 at 12:36:48 UTC, Simon Bürger wrote: If you are right that would mean that the current dmd/runtime does not follow the spec. Curious. The current implementation is not aware of strcut-destructors on the heap, i.e. the GC.BlkAttr.FINALIZE flag is not set for structs (

Re: @disable this for structs

2014-02-28 Thread Remo
On Friday, 28 February 2014 at 11:59:40 UTC, Dicebot wrote: On Friday, 28 February 2014 at 01:16:41 UTC, Mike Parker wrote: Ideally, I'd love for the compiler to pick up on this idiom and not generate any typeinfo in this situation. Ideally one should use modules as namespaces :P Ideally D s

Re: GC for noobs

2014-02-28 Thread Szymon Gatner
On Friday, 28 February 2014 at 12:48:47 UTC, Mike Parker wrote: On 2/28/2014 9:15 PM, Szymon Gatner wrote: So to sum up: C folks are not really happy, C++ folks are not really happy and C# folks are not really happy :P I'm a C folk and I'm really happy :) C'mon, GC has to be an itch for

Re: custom memory management

2014-02-28 Thread Simon Bürger
On Friday, 28 February 2014 at 10:40:17 UTC, Dicebot wrote: On Thursday, 27 February 2014 at 21:46:17 UTC, Simon Bürger wrote: Sadly, this is incorrect as well. Because if such an object is collected by the gc, but the gc decides not to run the destructor, the buffer will never be free'd. I t

Re: GC for noobs

2014-02-28 Thread Dicebot
On Friday, 28 February 2014 at 12:15:21 UTC, Szymon Gatner wrote: It really is, RAII is the most important idiom in C++, in short no RAII == buggy code. I mean proper C++ not C-with-classes-no-templates-no-exceptions bs. So to sum up: C folks are not really happy, C++ folks are not really hap

Re: GC for noobs

2014-02-28 Thread Szymon Gatner
On Friday, 28 February 2014 at 12:17:22 UTC, Dicebot wrote: On Friday, 28 February 2014 at 12:15:21 UTC, Szymon Gatner wrote: It really is, RAII is the most important idiom in C++, in short no RAII == buggy code. I mean proper C++ not C-with-classes-no-templates-no-exceptions bs. So to sum up

Re: GC for noobs

2014-02-28 Thread Szymon Gatner
On Friday, 28 February 2014 at 11:43:58 UTC, Dicebot wrote: On Friday, 28 February 2014 at 11:28:01 UTC, Szymon Gatner wrote: I didn't mean "basic" in the sense of "easy" but in the sense of something that has to dealt with all the time / is common requirement. Yes, it needs to be dealt with

Re: GC for noobs

2014-02-28 Thread Szymon Gatner
On Friday, 28 February 2014 at 11:54:52 UTC, Mike Parker wrote: On 2/28/2014 8:43 PM, Dicebot wrote: Most problems I have with D data structures come from qualifiers, not from resource management. I really don't understand why this looks that much of a problem. That said, my background very

  1   2   >