August 17, 2021

On Tuesday, 17 August 2021 at 14:16:52 UTC, 12345swordy wrote:

>

On Tuesday, 17 August 2021 at 13:52:19 UTC, russhy wrote:

>

Is this runtime reflection?

Will this depend on the GC? if so does it add pressure to the GC?

We already have compile time type introspection, i don't think it's wise to move things to runtime, we have a poor GC adding more pressure to it is just bad

Compile time reflection already proved to be superior in heavy workloads

Never been a fan of runtime reflection in java/c#, not good examples to follow

Also if it uses the GC, i'm not sure "core" package is the go, should be put on "std", or as a library imo

The reason that they use runtime reflection in java/c# is because of the basic principles of OOP.

-Alex

As well as other atrocities such as runtime code generation / runtime dependencies

>

It's for introspecting over code at compile time, not at runtime. Stefan and I have been mulling over this for ages and I think we both think it can do more than reflection as currently know it at least. This let's you drink from the firehose, so to speak.

Oh i see, so the goal is not what i was thinking, my bad!

I guess will have to read the DIP to know more about it, that is interesting, i'm curious now

August 17, 2021

On Tuesday, 17 August 2021 at 14:52:22 UTC, russhy wrote:

>

I guess will have to read the DIP to know more about it, that is interesting, i'm curious now

basically it provides the same reflection we have now but as CTFE classes instead of compiler traits and is expression matching.

August 17, 2021

On Tuesday, 17 August 2021 at 14:16:52 UTC, 12345swordy wrote:

>

The reason that they use runtime reflection in java/c# is because of the basic principles of OOP.

-Alex

How does basic principles of oop force java implementations use runtime reflection???

It would mean that D also has to use runtime reflection because it has OOP support.

Regards,
Alexandru.

August 17, 2021

On Tuesday, 17 August 2021 at 14:52:22 UTC, russhy wrote:

>

On Tuesday, 17 August 2021 at 14:16:52 UTC, 12345swordy wrote:

>

On Tuesday, 17 August 2021 at 13:52:19 UTC, russhy wrote:

>

Is this runtime reflection?

Will this depend on the GC? if so does it add pressure to the GC?

We already have compile time type introspection, i don't think it's wise to move things to runtime, we have a poor GC adding more pressure to it is just bad

Compile time reflection already proved to be superior in heavy workloads

Never been a fan of runtime reflection in java/c#, not good examples to follow

Also if it uses the GC, i'm not sure "core" package is the go, should be put on "std", or as a library imo

The reason that they use runtime reflection in java/c# is because of the basic principles of OOP.

-Alex

As well as other atrocities such as runtime code generation / runtime dependencies

Which is not a inherently an evil thing, so there is no need for hyperbolic language such as using the word atrocities. It's all about the trade offs.

  • Alex
August 17, 2021

On Tuesday, 17 August 2021 at 18:10:48 UTC, Alexandru Ermicioi wrote:

>

On Tuesday, 17 August 2021 at 14:16:52 UTC, 12345swordy wrote:

>

The reason that they use runtime reflection in java/c# is because of the basic principles of OOP.

-Alex

How does basic principles of oop force java implementations use runtime reflection???
https://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming)

You cannot obtain information such as "How many child classes does this class currently has", without compiling every code/library that you use, which isn't feasible as not every library share their source code.

  • Alex
August 17, 2021

On Tuesday, 17 August 2021 at 20:23:48 UTC, 12345swordy wrote:

>

On Tuesday, 17 August 2021 at 18:10:48 UTC, Alexandru Ermicioi wrote:

>

On Tuesday, 17 August 2021 at 14:16:52 UTC, 12345swordy wrote:

>

The reason that they use runtime reflection in java/c# is because of the basic principles of OOP.

-Alex

How does basic principles of oop force java implementations use runtime reflection???
https://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming)

You cannot obtain information such as "How many child classes does this class currently has", without compiling every code/library that you use, which isn't feasible as not every library share their source code.

  • Alex

I still fail to see relation between oop and runtime info use. The part about source code sharing is also true for c and d libs, which both could share only header files and have pointer to struct declared without said struct declaration (i.e. Opaque struct type, not sure completely about D though).

The thing is, that runtime reflection in java is more or less usable compared to d (sigh), and can be used to design libs that are using that data to do their job, but this doesn't mean that there aren't any options on using compile time info to generate or alter compiled code. Take for example lombok project, jpa model generator from hibernate, or mapstruct library which is a mapper from one java type to another (kinda close to serializers), all of them are used at compile time to either generate new code, or alter existing one, based on annotation processor plugin feature offered by java compiler, not to mention byte code enhancement capabilities, and libs using them.

I'm pretty sure C# has similar possibilities, for code generation and alteration.

Regards,
Alexandru.

August 18, 2021
On 17/8/21 22:50, Alexandru Ermicioi wrote:
> On Tuesday, 17 August 2021 at 20:23:48 UTC, 12345swordy wrote:
>> On Tuesday, 17 August 2021 at 18:10:48 UTC, Alexandru Ermicioi wrote:
>>> On Tuesday, 17 August 2021 at 14:16:52 UTC, 12345swordy wrote:
>>>> The reason that they use runtime reflection in java/c# is because of the basic principles of OOP.
>>>>
>>>> -Alex
>>>
>>> How does basic principles of oop force java implementations use runtime reflection???
>> https://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming)
>>
>> You cannot obtain information such as "How many child classes does this class currently has", without compiling every code/library that you use, which isn't feasible as not every library share their source code.
>>
>> - Alex
> 
> I still fail to see relation between oop and runtime info use. The part about source code sharing is also true for c and d libs, which both could share only header files and have pointer to struct declared without said struct declaration (i.e. Opaque struct type, not sure completely about D though).
> 
> The thing is, that runtime reflection in java is more or less usable compared to d (sigh), and can be used to design libs that are using that data to do their job, but this doesn't mean that there aren't any options on using compile time info to generate or alter compiled code. Take for example lombok project, jpa model generator from hibernate, or mapstruct library which is a mapper from one java type to another (kinda close to serializers), all of them are used at compile time to either generate new code, or alter existing one, based on annotation processor plugin feature offered by java compiler, not to mention byte code enhancement capabilities, and libs using them.
> 
> I'm pretty sure C# has similar possibilities, for code generation and alteration.
> 
> Regards,
> Alexandru.

There's at least a use case that can only be solved with runtime reflection: dynamically loaded code (so, dlopen or similar) where no source code is available at all, for example if you want to implement a plugin system.

For sure you can have the code "register" itself, and add some kind of "description" or metadata, but if you want for instance to implement a persistence / serialization system in such an environment, you end up all but implementing your own version of runtime reflection.

I don't have that much experience with that, but I think that separate compilation could also have issues, for instance if you want to distribute your program in binary form, and still allow people to compile plugins / extensions for it.

A workaround might be to distribute enough of the source code in the .di files, but I'm not sure how workable this would be.
1 2
Next ›   Last »