www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - [core.reflect] preview release

reply Stefan Koch <uplink.coder googlemail.com> writes:
Good day to you.

I have decided to release a preview binary for core.reflect.
And I am including the low-level-runtime.

While this increases the risk of having my work "re-appropriated" 
it would be pointless not to show the underlying data-structures 
core.reflect works with.

So here it is: [https://corereflect.org/preview.tar.bz2]
The compiler binary was compiled under a stock ubuntu 16.04, so I 
would hope that it should run on most recent Debian based distros 
out there.

Note that this binary does not include the codegenerator, as it 
is not needed in order to show off the reflection.

Cheers,

And let me know how you like it.
Oct 11 2021
next sibling parent reply Stefan Koch <uplink.coder googlemail.com> writes:
On Monday, 11 October 2021 at 11:43:14 UTC, Stefan Koch wrote:
 So here it is: [https://corereflect.org/preview.tar.bz2]
EDIT http://corereflect.org/preview.tar.bz2 I don't have https on there yet ;)
Oct 11 2021
next sibling parent russhy <russhy gmail.com> writes:
On Monday, 11 October 2021 at 11:44:19 UTC, Stefan Koch wrote:
 On Monday, 11 October 2021 at 11:43:14 UTC, Stefan Koch wrote:
 So here it is: [https://corereflect.org/preview.tar.bz2]
EDIT http://corereflect.org/preview.tar.bz2 I don't have https on there yet ;)
The download doesn't work when i click on the link, i have to copy / paste directly in the address bar for it to work (Chrome 94) Thanks for sharing it! i'll give it a try in my current project
Oct 12 2021
prev sibling parent Stefan Koch <uplink.coder googlemail.com> writes:
On Monday, 11 October 2021 at 11:44:19 UTC, Stefan Koch wrote:
 On Monday, 11 October 2021 at 11:43:14 UTC, Stefan Koch wrote:
 So here it is: [https://corereflect.org/preview.tar.bz2]
EDIT http://corereflect.org/preview.tar.bz2 I don't have https on there yet ;)
Now the https link should work with one click. Thanks letsencrypt ;)
Oct 13 2021
prev sibling next sibling parent reply Imperatorn <johan_forsberg_86 hotmail.com> writes:
On Monday, 11 October 2021 at 11:43:14 UTC, Stefan Koch wrote:
 Good day to you.

 I have decided to release a preview binary for core.reflect.
 And I am including the low-level-runtime.

 While this increases the risk of having my work 
 "re-appropriated" it would be pointless not to show the 
 underlying data-structures core.reflect works with.

 So here it is: [https://corereflect.org/preview.tar.bz2]
 The compiler binary was compiled under a stock ubuntu 16.04, so 
 I would hope that it should run on most recent Debian based 
 distros out there.

 Note that this binary does not include the codegenerator, as it 
 is not needed in order to show off the reflection.

 Cheers,

 And let me know how you like it.
Cool! Do you have any Windows build available? Thanks 😎
Oct 12 2021
parent reply Stefan Koch <uplink.coder googlemail.com> writes:
On Tuesday, 12 October 2021 at 18:57:53 UTC, Imperatorn wrote:
 On Monday, 11 October 2021 at 11:43:14 UTC, Stefan Koch wrote:
 [...]
Cool! Do you have any Windows build available? Thanks 😎
Thanks for asking I will provide a windows build shortly. In the meantime it _should_ run on WSL?
Oct 12 2021
next sibling parent Imperatorn <johan_forsberg_86 hotmail.com> writes:
On Tuesday, 12 October 2021 at 21:19:05 UTC, Stefan Koch wrote:
 On Tuesday, 12 October 2021 at 18:57:53 UTC, Imperatorn wrote:
 On Monday, 11 October 2021 at 11:43:14 UTC, Stefan Koch wrote:
 [...]
Cool! Do you have any Windows build available? Thanks 😎
Thanks for asking I will provide a windows build shortly. In the meantime it _should_ run on WSL?
Yeah it would probably run on WSL without problems. Just asking anyway 😊
Oct 12 2021
prev sibling parent reply bauss <jj_1337 live.dk> writes:
On Tuesday, 12 October 2021 at 21:19:05 UTC, Stefan Koch wrote:
 On Tuesday, 12 October 2021 at 18:57:53 UTC, Imperatorn wrote:
 On Monday, 11 October 2021 at 11:43:14 UTC, Stefan Koch wrote:
 [...]
Cool! Do you have any Windows build available? Thanks 😎
Thanks for asking I will provide a windows build shortly. In the meantime it _should_ run on WSL?
WSL can be disabled and might be within certain systems. Of course this project isn't meant for anything production, which is usually where such restrictions exist.
Oct 13 2021
parent Imperatorn <johan_forsberg_86 hotmail.com> writes:
On Wednesday, 13 October 2021 at 09:25:29 UTC, bauss wrote:
 On Tuesday, 12 October 2021 at 21:19:05 UTC, Stefan Koch wrote:
 On Tuesday, 12 October 2021 at 18:57:53 UTC, Imperatorn wrote:
 On Monday, 11 October 2021 at 11:43:14 UTC, Stefan Koch wrote:
 [...]
Cool! Do you have any Windows build available? Thanks 😎
Thanks for asking I will provide a windows build shortly. In the meantime it _should_ run on WSL?
WSL can be disabled and might be within certain systems. Of course this project isn't meant for anything production, which is usually where such restrictions exist.
WSL2 should be 100% compatible though
Oct 13 2021
prev sibling next sibling parent reply Timon Gehr <timon.gehr gmx.ch> writes:
On 10/11/21 1:43 PM, Stefan Koch wrote:
 risk of having my work "re-appropriated"
Why do you think there is such a risk?
Oct 13 2021
parent reply Stefan Koch <uplink.coder googlemail.com> writes:
On Wednesday, 13 October 2021 at 10:55:59 UTC, Timon Gehr wrote:
 On 10/11/21 1:43 PM, Stefan Koch wrote:
 risk of having my work "re-appropriated"
Why do you think there is such a risk?
I have had experience which indicates there is. I want to avoid a cargo-cult version of core.reflect. Not just because it took me months of research but also because I am not done yet. My vision for this is to enable new styles of meta-programming. And for that to happen, there mustn't be a watered down version in the language.
Oct 13 2021
parent Basile B. <b2.temp gmx.com> writes:
On Wednesday, 13 October 2021 at 19:16:48 UTC, Stefan Koch wrote:
 On Wednesday, 13 October 2021 at 10:55:59 UTC, Timon Gehr wrote:
 On 10/11/21 1:43 PM, Stefan Koch wrote:
 risk of having my work "re-appropriated"
Why do you think there is such a risk?
I have had experience which indicates there is. I want to avoid a cargo-cult version of core.reflect. Not just because it took me months of research but also because I am not done yet. My vision for this is to enable new styles of meta-programming. And for that to happen, there mustn't be a watered down version in the language.
👍
Oct 13 2021
prev sibling parent reply Gavin Ray <user example.com> writes:
On Monday, 11 October 2021 at 11:43:14 UTC, Stefan Koch wrote:
 Good day to you.

 I have decided to release a preview binary for core.reflect.
 And I am including the low-level-runtime.

 Cheers,

 And let me know how you like it.
Wow, this is great! Just ran the demo on WSL2. There are many uses for it. Off the top of my head, recently Rikki wrote for me a mixin which generated a C ABI for any D class. This could be used in a similar way to generate wrappers very easily I imagine. It could probably be useful for IDE tooling as well. ```d mixin template CWrapper(Type) { import std.traits; export extern(C): pragma(mangle, "create_" ~ __traits(identifier, Type)) void* creator(Parameters!(Type.__ctor) args) { return cast(void*)new Type(args); } mixin(() { string ret; foreach(m; __traits(allMembers, Type)) { static if (m != "__ctor" && m != "__dtor" && isFunction!(__traits(getMember, Type, m))) { ret ~= `ReturnType!(__traits(getMember, Type, "` ~ m ~ `")) ` ~ __traits(identifier, Type) ~ `_` ~ m ~ `(void* obj, Parameters!(__traits(getMember, Type, "` ~ m ~ `")) args) { return (cast(Type)obj).` ~ m ~ `(args); }`; } } return ret; }()); } class Foo { int x; this(int x) { this.x = x; } int getX() { return x; } } mixin CWrapper!(Foo); // GENERATED CODE: extern(C) { void* create_Foo(int); // returns void* to Foo instance int Foo_getX(void*); // takes void* to Foo instance } ```
Oct 14 2021
parent Stefan Koch <uplink.coder googlemail.com> writes:
On Thursday, 14 October 2021 at 19:10:24 UTC, Gavin Ray wrote:
 On Monday, 11 October 2021 at 11:43:14 UTC, Stefan Koch wrote:
 Good day to you.

 I have decided to release a preview binary for core.reflect.
 And I am including the low-level-runtime.

 Cheers,

 And let me know how you like it.
Wow, this is great! Just ran the demo on WSL2. There are many uses for it. Off the top of my head, recently Rikki wrote for me a mixin which generated a C ABI for any D class. This could be used in a similar way to generate wrappers very easily I imagine. It could probably be useful for IDE tooling as well.
I am happy you tried it. And yes use-cases like the one you describe are _exactly_ what core.reflect is meant to help with. I am aiming for it to be intuitive enough that I won't have to write lots of documentation.
Oct 14 2021