Re: Bug in Rdmd?

2016-06-13 Thread Jonathan Marler via Digitalmars-d-learn
On Tuesday, 14 June 2016 at 03:40:01 UTC, Adam D. Ruppe wrote: On Tuesday, 14 June 2016 at 03:15:04 UTC, Jonathan Marler wrote: It actually is a free function no, it isn't, it is on File. Your code doesn't compile on my dmd (and indeed it shouldn't on yours either unless you have a version

Re: Bug in Rdmd?

2016-06-13 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 14 June 2016 at 03:15:04 UTC, Jonathan Marler wrote: It actually is a free function no, it isn't, it is on File. Your code doesn't compile on my dmd (and indeed it shouldn't on yours either unless you have a version mismatch. rdmd just calls dmd, it doesn't produce its own

Re: Bug in Rdmd?

2016-06-13 Thread Jonathan Marler via Digitalmars-d-learn
On Tuesday, 14 June 2016 at 01:35:32 UTC, Jeremy DeHaan wrote: On Tuesday, 14 June 2016 at 01:05:46 UTC, Jonathan Marler wrote: This code doesn't seem to work with rdmd. Is this a bug? import std.stdio : byLine; int main(string[] args) { foreach(line; stdin.byLine) { }

Bug in Rdmd?

2016-06-13 Thread Jonathan Marler via Digitalmars-d-learn
This code doesn't seem to work with rdmd. Is this a bug? import std.stdio : byLine; int main(string[] args) { foreach(line; stdin.byLine) { } return 0; } Compiler Output: Error: module std.stdio import 'byLine' not found

nested inout return type

2016-06-13 Thread Simon Bürger via Digitalmars-d-learn
I'm writing a custom (originally multi-dimensional) Slice-type, analogous to the builtin T[], and stumbled upon the problem that the following code won't compile. The workaround is simple: just write the function three times for mutable/const/immutable. But as "inout" was invented to make that

how to get rid of "cannot deduce function from argument types" elegantly

2016-06-13 Thread Christian Köstlin via Digitalmars-d-learn
I made a small (could be reduced further) example that creates and walks a templated binary tree. The tree also gets a factory function to use type deduction to conveniently construct a tree. Unfortunately this does not compile, if I remove the three ugly methods between /* these should go */

Re: Gotchas for returning values from blocks

2016-06-13 Thread Era Scarecrow via Digitalmars-d-learn
On Monday, 13 June 2016 at 14:16:58 UTC, jmh530 wrote: So returning a reference to something on the stack is a bad idea, but copying the value would be fine. This is easy enough to get wrong elsewhere too. I recall having an issue with a foreach, until I added a 'ref' to it. Looking at the

Re: Parse File at compile time, but not embedded

2016-06-13 Thread ketmar via Digitalmars-d-learn
On Sunday, 12 June 2016 at 01:39:11 UTC, Joerg Joergonson wrote: This doesn't seem to be the case though in more complex examples ;/ it is. My code is almost identical do what you have written your code is *completely* different. that's why there are no traces of CTFE values in my sample.

Re: What's up with GDC?

2016-06-13 Thread Joerg Joergonson via Digitalmars-d-learn
On Monday, 13 June 2016 at 16:46:38 UTC, Adam D. Ruppe wrote: On Sunday, 12 June 2016 at 14:22:54 UTC, Joerg Joergonson wrote: Error: undefined identifier 'Sleep' in module 'core.thread', did you mean function 'Sleep'? It is supposed to be `Thread.sleep(1.seconds);` I'm pretty sure the

Re: Access private member

2016-06-13 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-06-13 17:00, Basile B. wrote: Unless It's you Jacob who have proposed Orange to phobos in 2012. And then since refused it's not developed at all. IIRC it's even not possible to compile it with DUB. Yes, I've written Orange and proposed it to Phobos. Not sure what you mean with

Re: Accessing COM Objects

2016-06-13 Thread Incognito via Digitalmars-d-learn
On Monday, 13 June 2016 at 19:11:59 UTC, John wrote: On Monday, 13 June 2016 at 17:38:41 UTC, Incognito wrote: Cool. Oleview gives me the idl files. How to convert the idl files to d or possibly c? Would I just use them in place of IUnknown once I have the interface? In OleView you can

Re: Accessing COM Objects

2016-06-13 Thread John via Digitalmars-d-learn
On Monday, 13 June 2016 at 17:38:41 UTC, Incognito wrote: Cool. Oleview gives me the idl files. How to convert the idl files to d or possibly c? Would I just use them in place of IUnknown once I have the interface? In OleView you can save the IDL file, then run another tool, midl.exe, on

Re: What's up with GDC?

2016-06-13 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 11 June 2016 at 04:20:38 UTC, Joerg Joergonson wrote: BTW I make your code a bit better with resizing case WM_SIZING: goto size_changed; break; I left that out intentionally because it lagged on my computer... so I wanted it to stay blank. Maybe it can be made more

Re: Accessing COM Objects

2016-06-13 Thread Incognito via Digitalmars-d-learn
On Monday, 13 June 2016 at 07:40:09 UTC, John wrote: On Monday, 13 June 2016 at 01:22:33 UTC, Incognito wrote: I've been reading over D's com and can't find anything useful. It seems there are different ways: http://www.lunesu.com/uploads/ModernCOMProgramminginD.pdf which is of no help and

Re: Access private member

2016-06-13 Thread Basile B. via Digitalmars-d-learn
On Monday, 13 June 2016 at 15:00:06 UTC, Basile B. wrote: On Monday, 13 June 2016 at 14:30:13 UTC, Basile B. wrote: On Monday, 13 June 2016 at 11:27:31 UTC, Jacob Carlborg wrote: On 2016-06-13 09:54, Pierre wrote: Thank you i will try it. You don't need to involve the constructor. You can

Re: What's up with GDC?

2016-06-13 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 12 June 2016 at 14:22:54 UTC, Joerg Joergonson wrote: Error: undefined identifier 'Sleep' in module 'core.thread', did you mean function 'Sleep'? It is supposed to be `Thread.sleep(1.seconds);` I'm pretty sure the capital Sleep() is supposed to be private (that is the

Re: Access private member

2016-06-13 Thread Basile B. via Digitalmars-d-learn
On Monday, 13 June 2016 at 14:30:13 UTC, Basile B. wrote: On Monday, 13 June 2016 at 11:27:31 UTC, Jacob Carlborg wrote: On 2016-06-13 09:54, Pierre wrote: Thank you i will try it. You don't need to involve the constructor. You can use .tupleof, as I mentioned [1] [2]. [1]

Re: Access private member

2016-06-13 Thread Basile B. via Digitalmars-d-learn
On Monday, 13 June 2016 at 11:27:31 UTC, Jacob Carlborg wrote: On 2016-06-13 09:54, Pierre wrote: Thank you i will try it. You don't need to involve the constructor. You can use .tupleof, as I mentioned [1] [2]. [1] http://forum.dlang.org/post/njlohq$1n99$1...@digitalmars.com [2]

Re: Gotchas for returning values from blocks

2016-06-13 Thread jmh530 via Digitalmars-d-learn
On Monday, 13 June 2016 at 01:41:07 UTC, Mike Parker wrote: Everything works fine in your example because 'new' always allocates on the heap. Anything allocated on the stack is not guaranteed to be valid after the scope exits: struct Foo { int baz; ~this() { baz = 1; } } void

Re: Access private member

2016-06-13 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-06-13 09:54, Pierre wrote: Thank you i will try it. You don't need to involve the constructor. You can use .tupleof, as I mentioned [1] [2]. [1] http://forum.dlang.org/post/njlohq$1n99$1...@digitalmars.com [2] http://forum.dlang.org/post/njlop0$1ngk$1...@digitalmars.com -- /Jacob

Re: Access private member

2016-06-13 Thread Basile B. via Digitalmars-d-learn
On Monday, 13 June 2016 at 07:53:08 UTC, Jacob Carlborg wrote: On 2016-06-13 09:49, Jacob Carlborg wrote: For fields, used .tupleof, for other symbols, use a pointer. Here's an example [1] of accessing a field using the name of the field as a string. It will bypass private. That module

Re: Access private member

2016-06-13 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-06-13 09:49, Jacob Carlborg wrote: For fields, used .tupleof, for other symbols, use a pointer. Here's an example [1] of accessing a field using the name of the field as a string. It will bypass private. That module [1] contains some generic functionality for working with fields

Re: Access private member

2016-06-13 Thread Pierre via Digitalmars-d-learn
Thank you i will try it.

Re: Access private member

2016-06-13 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-06-13 09:43, Pierre wrote: Hi, I would like to know how can i access private member of class from outside ? I think about serialization for instance, serializer must have access to protected attributes. How this is done ? Thank you. For fields, used .tupleof, for other symbols, use a

Re: Access private member

2016-06-13 Thread Basile B. via Digitalmars-d-learn
On Monday, 13 June 2016 at 07:43:09 UTC, Pierre wrote: Hi, I would like to know how can i access private member of class from outside ? I think about serialization for instance, serializer must have access to protected attributes. How this is done ? Thank you. You can perform the

Access private member

2016-06-13 Thread Pierre via Digitalmars-d-learn
Hi, I would like to know how can i access private member of class from outside ? I think about serialization for instance, serializer must have access to protected attributes. How this is done ? Thank you.

Re: Accessing COM Objects

2016-06-13 Thread John via Digitalmars-d-learn
On Monday, 13 June 2016 at 01:22:33 UTC, Incognito wrote: I've been reading over D's com and can't find anything useful. It seems there are different ways: http://www.lunesu.com/uploads/ModernCOMProgramminginD.pdf which is of no help and requires an idl file, which I don't have. Then

Re: Fibers, what for?

2016-06-13 Thread chmike via Digitalmars-d-learn
On Monday, 13 June 2016 at 00:57:11 UTC, Alex Parrill wrote: This is misleading. Any sort of cooperative system needs synchronization when two or more tasks try to access the same data, whether those "tasks" are OS threads, fibers, different machines on a network, etc. That is true. Sorry.