Get name of current function

2017-04-23 Thread Mike B Johnson via Digitalmars-d-learn
I'd like to get the symbolic name of the current function I'm in void foo() { writeln(thisFunc.stringof()); // prints foo } I need something short, elegant and doesn't require modifying preexisting code... I'm sure D has something along those lines?

Out of data wiki

2017-04-18 Thread Mike B Johnson via Digitalmars-d-learn
can this be updated to work? https://wiki.dlang.org/Timing_Code

Re: How to get return type of current method?

2017-04-18 Thread Mike B Johnson via Digitalmars-d-learn
On Tuesday, 18 April 2017 at 23:49:35 UTC, ketmar wrote: Mike B Johnson wrote: How can I get the return type of the current method without specifying the name or any complexity? Similar to typeof(this). typeof(return) Thanks, sweet and simple!

How to get return type of current method?

2017-04-18 Thread Mike B Johnson via Digitalmars-d-learn
How can I get the return type of the current method without specifying the name or any complexity? Similar to typeof(this).

Re: COM Expertise needed: COM Callbacks

2017-05-03 Thread Mike B Johnson via Digitalmars-d-learn
On Friday, 28 April 2017 at 09:25:31 UTC, John Chapman wrote: On Thursday, 27 April 2017 at 20:20:23 UTC, Nierjerson wrote: I think the main issue though, is that I really don't know what is going on when I invoke the PS function. It seems to call the server method that takes the interface

Re: avoid extra variable during void pointer cast

2017-05-14 Thread Mike B Johnson via Digitalmars-d-learn
On Sunday, 14 May 2017 at 20:18:24 UTC, Kevin Brogan wrote: I have a piece of code that takes a callback function. The callback has the signature void callback(void* state, void* data) There are several of these functions. All of them use state and data as differing types. As an example,

Re: How to avoid throwing an exceptions for a built-in function?

2017-05-12 Thread Mike B Johnson via Digitalmars-d-learn
On Thursday, 11 May 2017 at 16:07:22 UTC, k-five wrote: On Wednesday, 10 May 2017 at 21:19:21 UTC, Stanislav Blinov wrote: On Wednesday, 10 May 2017 at 15:35:24 UTC, k-five wrote: On Wednesday, 10 May 2017 at 14:27:46 UTC, Stanislav Blinov

Current LDC Android status

2017-05-15 Thread Mike B Johnson via Digitalmars-d-learn
So what is currently the state of affairs with LDC and android? Last time I remember, it *could* compile to android but barely.

Re: Out of memory error (even when using destroy())

2017-05-26 Thread Mike B Johnson via Digitalmars-d-learn
On Friday, 26 May 2017 at 14:05:34 UTC, ag0aep6g wrote: On 05/26/2017 10:15 AM, realhet wrote: But hey, the GC knows that is should not search for any pointers in those large blocks. And the buffer is full of 0-s at the start, so there can't be any 'false pointers' in it. And I think the GC

Re: binding to C++

2017-05-26 Thread Mike B Johnson via Digitalmars-d-learn
On Friday, 26 May 2017 at 15:17:08 UTC, drug wrote: Trying to bind to cpp code I stop at some moment having undefined reference to some cpp function. But objdump -Ct cpplibrary.so shows me that this cpp function exists in the library. linker message about cpp function is _identical_ to

Re: Out of memory error (even when using destroy())

2017-05-27 Thread Mike B Johnson via Digitalmars-d-learn
On Friday, 26 May 2017 at 18:19:48 UTC, H. S. Teoh wrote: On Fri, May 26, 2017 at 06:06:42PM +, Mike B Johnson via Digitalmars-d-learn wrote: On Friday, 26 May 2017 at 14:05:34 UTC, ag0aep6g wrote: > On 05/26/2017 10:15 AM, realhet wrote: > > But hey, the GC knows that is should n

Re: D scripting in D

2017-06-01 Thread Mike B Johnson via Digitalmars-d-learn
On Friday, 2 June 2017 at 03:33:37 UTC, Adam D. Ruppe wrote: On Friday, 2 June 2017 at 02:32:43 UTC, Mike B Johnson wrote: But it would be nice if a D had a scripting language that used the same D syntax as this would make porting a piece of cake. So my script.d has kinda similar syntax, but

Re: D scripting in D

2017-06-01 Thread Mike B Johnson via Digitalmars-d-learn
On Friday, 2 June 2017 at 02:39:47 UTC, Stefan Koch wrote: On Friday, 2 June 2017 at 02:32:43 UTC, Mike B Johnson wrote: 1. change test12.wav to test123.wav 2. save file 3. recompile. 4. run 5. Get back to same test point(could be a lot or a little amount of work). If that is all you want;

D scripting in D

2017-06-01 Thread Mike B Johnson via Digitalmars-d-learn
I wonder if it is possible to somehow turn D in to a scripting language that can be run inside D? The point? To have the same uniform syntax for quickly developing scripts that can then be easily transferred, if desired, in to a complete binary. e.g., suppose I am working in some type of

Re: D scripting in D

2017-06-01 Thread Mike B Johnson via Digitalmars-d-learn
On Friday, 2 June 2017 at 02:15:27 UTC, Adam D. Ruppe wrote: On Friday, 2 June 2017 at 02:06:27 UTC, Mike B Johnson wrote: I wonder if it is possible to somehow turn D in to a scripting language that can be run inside D? Why not just use regular compiled D? Because it requires one to

Re: Rosetta Commatizing numbers

2017-05-31 Thread Mike B Johnson via Digitalmars-d-learn
If you still insist you are doing the right thing and all others are wrong, let's agree to disagree on that, and please just leave the original solution there by introducing two versions. Or we could just agree that the original was wrong and needs fixing? That is obviously the right thing

Re: D scripting in D

2017-06-02 Thread Mike B Johnson via Digitalmars-d-learn
On Friday, 2 June 2017 at 15:55:53 UTC, Lewis wrote: On Friday, 2 June 2017 at 02:06:27 UTC, Mike B Johnson wrote: I wonder if it is possible to somehow turn D in to a scripting language that can be run inside D? On a game project I'm working on at home, I've done: - Hot reloading via a DLL

Re: Creating and loading D plugins in D app

2017-06-02 Thread Mike B Johnson via Digitalmars-d-learn
On Friday, 2 June 2017 at 12:19:48 UTC, Adam D. Ruppe wrote: On Friday, 2 June 2017 at 11:09:05 UTC, aberba wrote: 1. Get shared libs to work in D (the best approach for all D code) I have done very little with this myself but other people have so it is doable. 1. some kind of embeddable

Re: Make enum auto castable

2017-06-04 Thread Mike B Johnson via Digitalmars-d-learn
On Sunday, 4 June 2017 at 23:39:11 UTC, Jonathan M Davis wrote: On Sunday, June 04, 2017 22:52:55 Mike B Johnson via Digitalmars-d-learn wrote: [...] Aside from whatever implicit conversions are built into the language, the only way to define an implicit conversion in D is via alias

dmd casts but ldc doesn't, and doesn't work in template in dmdm

2017-06-04 Thread Mike B Johnson via Digitalmars-d-learn
The following line is causing some problems. auto bytes = cast(byte[16])guid; compiles fine in dmd but ldc says it can't convert... also, it doens't work in ctfe/template either. (I'm not sure if ctfe is kicking in or not though, but definitely doesn't work in a template)

Re: Make enum auto castable

2017-06-04 Thread Mike B Johnson via Digitalmars-d-learn
On Monday, 5 June 2017 at 00:51:15 UTC, Jonathan M Davis wrote: On Monday, June 05, 2017 00:16:15 Mike B Johnson via Digitalmars-d-learn wrote: On Sunday, 4 June 2017 at 23:39:11 UTC, Jonathan M Davis wrote: > On Sunday, June 04, 2017 22:52:55 Mike B Johnson via > > Digitalmars-d-le

Re: dmd casts but ldc doesn't, and doesn't work in template in dmdm

2017-06-04 Thread Mike B Johnson via Digitalmars-d-learn
On Monday, 5 June 2017 at 00:56:52 UTC, Jonathan M Davis wrote: On Monday, June 05, 2017 00:18:04 Mike B Johnson via Digitalmars-d-learn wrote: [...] I assume that guid is a string or array of byte or somesuch? If it's an array of byte or char, then you can probably do auto bytes = cast

Re: Implicit casting of int enum members to int

2017-06-04 Thread Mike B Johnson via Digitalmars-d-learn
On Monday, 3 October 2016 at 09:21:37 UTC, Jonathan M Davis wrote: [...] Is this bug ever going to be fixed? I can't do enum X : Y { a = 1 } because 1 is not implicitly convertible to Y, even though Y is aliased to an int so it should be.

Re: Make enum auto castable

2017-06-04 Thread Mike B Johnson via Digitalmars-d-learn
On Monday, 5 June 2017 at 00:51:15 UTC, Jonathan M Davis wrote: On Monday, June 05, 2017 00:16:15 Mike B Johnson via Digitalmars-d-learn wrote: On Sunday, 4 June 2017 at 23:39:11 UTC, Jonathan M Davis wrote: > [...] I might be able to change the enum, I assume you mean something like e

Re: D scripting in D

2017-06-03 Thread Mike B Johnson via Digitalmars-d-learn
On Saturday, 3 June 2017 at 00:02:54 UTC, Lewis wrote: On Friday, 2 June 2017 at 20:47:31 UTC, Mike B Johnson wrote: [...] For sure. I actually want to post the source code at some point, but the changes I made are very much set up specifically for this project. I'll sift through at some

string to wchar*?

2017-06-03 Thread Mike B Johnson via Digitalmars-d-learn
How to convert a string to wchar*? string s; to!(wchar*)(s) gives phobo's deduction problems. \dmd2\windows\bin\..\..\src\phobos\std\conv.d(194): Error: template std.conv.toImpl cannot deduce function from argument types !(wchar*)(string), candidates are:

Re: string to wchar*?

2017-06-03 Thread Mike B Johnson via Digitalmars-d-learn
On Saturday, 3 June 2017 at 23:09:56 UTC, Stanislav Blinov wrote: On Saturday, 3 June 2017 at 22:54:22 UTC, Mike B Johnson wrote: How to convert a string to wchar*? C-style null-terminated wchar*? https://dlang.org/phobos/std_utf.html#toUTF16z This didn't work. More errors than the first.

Re: .sort vs sort(): std.algorithm not up to the task?

2017-06-07 Thread Mike B Johnson via Digitalmars-d-learn
On Thursday, 8 June 2017 at 01:57:47 UTC, Andrew Edwards wrote: If I hand you a chihuahua for grooming, why am I getting back a pit bull? I simply want a groomed chihuahua. Why do I need to consult a wizard to get back a groomed chihuahua? Because is like a poodle and unless you get your hair

Make enum auto castable

2017-06-04 Thread Mike B Johnson via Digitalmars-d-learn
I am dealing with some COM stuff and some functions use VARIANT, which can hold an enum. Instead of having to manually convert the enum(and for that matter, other things) to VARIANT, is it possible to have them automatically converted? This is because an enum is always convertible to a

Re: Make enum auto castable

2017-06-04 Thread Mike B Johnson via Digitalmars-d-learn
On Monday, 5 June 2017 at 01:42:55 UTC, Jonathan M Davis wrote: On Monday, June 05, 2017 01:30:47 Mike B Johnson via Digitalmars-d-learn wrote: [...] It's not a bug. The alias this conversion only goes one way. It provides a way to convert _from_ the type that it's declared on to another

Re: Make enum auto castable

2017-06-04 Thread Mike B Johnson via Digitalmars-d-learn
On Monday, 5 June 2017 at 03:15:46 UTC, Jonathan M Davis wrote: On Monday, June 05, 2017 02:14:14 Mike B Johnson via Digitalmars-d-learn wrote: On Monday, 5 June 2017 at 01:42:55 UTC, Jonathan M Davis wrote: > On Monday, June 05, 2017 01:30:47 Mike B Johnson via > > Digitalmars-d-le

Re: repl like interface with D app

2017-06-16 Thread Mike B Johnson via Digitalmars-d-learn
On Friday, 16 June 2017 at 18:13:33 UTC, Seb wrote: On Friday, 16 June 2017 at 07:57:46 UTC, Mike B Johnson wrote: I am developing a D app and I have a need to test things out. I do not want to have to recompile the app every time I want to test some functionality out. [...] There is

Re: repl like interface with D app

2017-06-16 Thread Mike B Johnson via Digitalmars-d-learn
On Friday, 16 June 2017 at 18:43:24 UTC, Sameer Pradhan wrote: On Friday, 16 June 2017 at 07:57:46 UTC, Mike B Johnson wrote: [...] Please check out: https://github.com/DlangScience/PydMagic/blob/master/README.md I haven't used it myself, but fits right in the Jupyter/IPython ecosystem.

Re: Implementing interfaces using alias this

2017-06-14 Thread Mike B Johnson via Digitalmars-d-learn
On Wednesday, 14 June 2017 at 09:41:49 UTC, ketmar wrote: Balagopal Komarath wrote: Why doesn't this work? The Test!Duck type has a void quack() method but the compiler says it is not implemented. 'cause `alias this` is *not* a tool that can be used to emulate inheritance. no, `quack` is

repl like interface with D app

2017-06-16 Thread Mike B Johnson via Digitalmars-d-learn
I am developing a D app and I have a need to test things out. I do not want to have to recompile the app every time I want to test some functionality out. Suppose I have an app with some functions like foo, bar, etc... in some module m. I would like to be able to do basic stuff like

MAKELCID C++ translation

2017-05-05 Thread Mike B Johnson via Digitalmars-d-learn
How to translate something like? #define LCID_ENGLISH MAKELCID(MAKELANGID(0x09, 0x01), SORT_DEFAULT) #define LCID_GERMAN MAKELCID(MAKELANGID(0x07, 0x01), SORT_DEFAULT) D seems to be missing these macros and definitions

Re: COM Expertise needed: COM Callbacks

2017-05-05 Thread Mike B Johnson via Digitalmars-d-learn
I've modified the code and it seems to call GetTypeInfo but the values passed seem frivolous. The modified code I'm using is below. Maybe we can get this to work? I'm interested in a photoshop interop too. Seems like it should be rather trivial to get to work but things don't add up ;/

Re: MAKELCID C++ translation

2017-05-05 Thread Mike B Johnson via Digitalmars-d-learn
On Friday, 5 May 2017 at 23:02:53 UTC, Adam D. Ruppe wrote: On Friday, 5 May 2017 at 22:57:50 UTC, Mike B Johnson wrote: D seems to be missing these macros and definitions import core.sys.windows.winnt; then they should work thanks.

How to get field default value at CT

2017-05-06 Thread Mike B Johnson via Digitalmars-d-learn
I'd like to get the value assign to a field at CT. struct { int x = 3434; } I'd like to get the assigned "value" 3434 for x at CT.

get vtable size

2017-05-06 Thread Mike B Johnson via Digitalmars-d-learn
how many elements(virtual functions) are in the __vptr?