Re: Tuple and tie?

2014-07-08 Thread Remo via Digitalmars-d-learn
On Tuesday, 8 July 2014 at 18:29:40 UTC, Meta wrote: On Tuesday, 8 July 2014 at 17:42:00 UTC, Remo wrote: How to make something that work like std::tie in D2 ? Tuple!(float, float) sinCos(float n) { return tuple(cast(float)sin(n), cast(float)cos(n)); //please note cast(float)! } int main

Tuple and tie?

2014-07-08 Thread Remo via Digitalmars-d-learn
How to make something that work like std::tie in D2 ? Tuple!(float, float) sinCos(float n) { return tuple(cast(float)sin(n), cast(float)cos(n)); //please note cast(float)! } int main(string[] argv) { float s,c; tie!(s,c) = sinCos(3.0f); }

Re: Read file on compiler time.

2014-05-29 Thread Remo via Digitalmars-d-learn
On Thursday, 29 May 2014 at 20:44:09 UTC, bearophile wrote: Remo: is it also possible to save/write string at compile time? There is pragma(msg, "...") but it's a little crappy. There are plans and a pull request for a good _ctWrite, but it's stalled for reasons

Re: Read file on compiler time.

2014-05-29 Thread Remo via Digitalmars-d-learn
On Thursday, 29 May 2014 at 20:21:32 UTC, Adam D. Ruppe wrote: string a = import("file.txt"); dmd yourprogram.d -Jlocation_of_file so for example dmd yourprogram.d -J. if file.txt is in the same directory as the .d file. Excellent, thank you Adam! Now another question is it also possible

Read file on compiler time.

2014-05-29 Thread Remo via Digitalmars-d-learn
Is there a way to read a text file into a sting at compile time in D2 ? It would be great to read for example some JSON file and then parse it using CTFU and create some D code based on it.

Re: Building 32bit program with MSVC?

2014-05-29 Thread Remo via Digitalmars-d-learn
On Thursday, 29 May 2014 at 18:25:19 UTC, Jeremy DeHaan wrote: I know that we can use MSVC to build a 64 bit program, but is it also possible to use it to build a 32 bit program as well? Yes of course it is possible. It you are talking about Visual-D then it is possible there too.

Re: xvalue and std::move in D

2014-03-06 Thread Remo
On Thursday, 6 March 2014 at 12:01:25 UTC, bearophile wrote: Edwin van Leeuwen: Thank you, can't believe I missed that. How do I specify that the function expects a temporary/xvalue (&&) parameter though? Thankfully D lacks the && operator. Bye, bearophile But is also locks r-value referen

Re: How to build DMD on windows ?

2014-03-03 Thread Remo
On Monday, 3 March 2014 at 19:51:45 UTC, Benjamin Thaut wrote: Am 28.02.2014 21:14, schrieb 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

Re: How to build DMD on windows ?

2014-03-02 Thread Remo
On Friday, 28 February 2014 at 22:27:12 UTC, Vladimir Panteleev wrote: 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

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: @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

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: Replace exception handler?

2014-02-27 Thread Remo
On Thursday, 27 February 2014 at 22:24:23 UTC, Ali Çehreli wrote: On 02/27/2014 05:24 AM, Remo wrote: > Unfortunately I can not find a way to replace exception handler in D2. > Is there a way to do this? I think you mean the unhandled exception handler. Otherwise, try+catch is the

Re: GC for noobs

2014-02-27 Thread Remo
On Thursday, 27 February 2014 at 15:39:48 UTC, Szymon Gatner wrote: On Thursday, 27 February 2014 at 15:36:02 UTC, Remo wrote: What do you mean by Microsoft's dialect? I mean half-implemented buggy version of C++11 in VC2012 ;) Or in VC2013, but if you can use Intel compiler then

Re: GC for noobs

2014-02-27 Thread Remo
On Thursday, 27 February 2014 at 15:15:06 UTC, Szymon Gatner wrote: On Thursday, 27 February 2014 at 14:58:50 UTC, bearophile wrote: Szymon Gatner: Tbh it only looks worse and worse to me :( Perhaps for your use case it's better for you to stick with C++11? While I have written a good amoun

Re: GC for noobs

2014-02-27 Thread Remo
On Thursday, 27 February 2014 at 15:09:39 UTC, Szymon Gatner wrote: On Thursday, 27 February 2014 at 14:56:22 UTC, Namespace wrote: On Thursday, 27 February 2014 at 14:52:00 UTC, Szymon Gatner wrote: On Thursday, 27 February 2014 at 14:42:43 UTC, Dicebot wrote: There is also one complex and fea

Replace exception handler?

2014-02-27 Thread Remo
There is a way to replace assertHandler and it helped me to resolve a couple of problem. Unfortunately I can not find a way to replace exception handler in D2. Is there a way to do this? The problem is that I load a Dll coded in D from Application coded in C++. If this Dll throw and exceptio

Re: GC for noobs

2014-02-27 Thread Remo
On Thursday, 27 February 2014 at 13:07:37 UTC, Mike Parker wrote: On 2/27/2014 9:25 PM, Szymon Gatner wrote: This is just an example but I would think that it is something rather important to have... What about child objects un-registering themselves in d-tors from a list that parent object

Re: Struct constructor, opCall mess.

2014-02-25 Thread Remo
On Tuesday, 25 February 2014 at 07:59:33 UTC, Maxim Fomin wrote: On Monday, 24 February 2014 at 14:14:43 UTC, Tobias Pankrath wrote: On Monday, 24 February 2014 at 13:56:01 UTC, Remo wrote: Hi, right now I am truing to figure out how the constructors behave in D2. Question 1: why it is not

Re: Struct constructor, opCall mess.

2014-02-24 Thread Remo
On Monday, 24 February 2014 at 21:06:03 UTC, monarch_dodra wrote: On Monday, 24 February 2014 at 17:15:10 UTC, Remo wrote: So what is proper/best way to mimic default constructor for struct ? Honestly, you can't, and you shouldn't try either. There "used" to be the static

Re: Struct constructor, opCall mess.

2014-02-24 Thread Remo
Also please take a look at those: https://d.puremagic.com/issues/show_bug.cgi?id=7066 There may be some others I've missed; the sheer amount and unresolved state is terrifying. IMHO Issue 7066 is not a bug but a feature. Of course it could be handled i a bit more safe way. This looks like

Re: Struct constructor, opCall mess.

2014-02-24 Thread Remo
slav Blinov wrote: On Monday, 24 February 2014 at 17:15:10 UTC, Remo wrote: Well fortunately it seems to be possible to override init property. Fortunately? I think not. It's an abomination that, IMO, has to be annihilated. Recently Andrei suggested adding more explicit semantics to .

Re: Struct constructor, opCall mess.

2014-02-24 Thread Remo
On Monday, 24 February 2014 at 14:14:43 UTC, Tobias Pankrath wrote: On Monday, 24 February 2014 at 13:56:01 UTC, Remo wrote: Hi, right now I am truing to figure out how the constructors behave in D2. Question 1: why it is not possible to create custom ctor for struct? The design of D

Struct constructor, opCall mess.

2014-02-24 Thread Remo
Hi, right now I am truing to figure out how the constructors behave in D2. Question 1: why it is not possible to create custom ctor for struct? I know this is not really necessary because you can initialize fields like this. struct S{ int i = 1; } But this is a big problem if one tries to