Support for reflection (self modification)

136 views
Skip to first unread message

Jirka Daněk

unread,
Jan 28, 2016, 4:26:47 PM1/28/16
to Dartino Discuss
I vaguely remember reading somewhere that Fletch (Dartino) has extended reflection support over the Dart VM and it can do intercession (program self modification) as well as introspection. I cannot find anything about it now, though. Is it true and if yes, could you give me some pointers to documentation, how do I use the feature?

Mads Ager

unread,
Jan 29, 2016, 3:59:17 AM1/29/16
to Jirka Daněk, Dartino Discuss
Hi Jirka,

Dartino actually has reduced reflection support compared to the Dart VM. Dartino does not support dart:mirrors and .runtimeType to keep the runtime small for embedded devices. Therefore, there is no way to do program self modification.

I think what you are referring to is the experiments we are performing with 'live programming'. The idea is that you can inspect your system state in the debugger. Based on what you find you can change your source files. We will then incrementally compile the source files and compute a program change that can be applied on the VM. Then you can continue running the modified program. All of these changes happen from the side and not from the program itself.

We still have limited support for 'live programming' so it will be a little while before this is actually ready for use.

Cheers,
Mads

On Thu, Jan 28, 2016 at 10:26 PM Jirka Daněk <jirka...@gmail.com> wrote:
I vaguely remember reading somewhere that Fletch (Dartino) has extended reflection support over the Dart VM and it can do intercession (program self modification) as well as introspection. I cannot find anything about it now, though. Is it true and if yes, could you give me some pointers to documentation, how do I use the feature?

--
You received this message because you are subscribed to the Google Groups "Dartino Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dartino-discu...@googlegroups.com.
To post to this group, send email to dartino...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dartino-discuss/58783a94-e8dd-4ffc-81e9-c5146c236876%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jirka Daněk

unread,
Jan 29, 2016, 5:43:09 AM1/29/16
to Dartino Discuss
On Friday, January 29, 2016 at 9:59:17 AM UTC+1, Mads Ager wrote:
Hi Jirka,

Dartino actually has reduced reflection support compared to the Dart VM. Dartino does not support dart:mirrors and .runtimeType to keep the runtime small for embedded devices. Therefore, there is no way to do program self modification.

I think what you are referring to is the experiments we are performing with 'live programming'. The idea is that you can inspect your system state in the debugger. Based on what you find you can change your source files. We will then incrementally compile the source files and compute a program change that can be applied on the VM. Then you can continue running the modified program. All of these changes happen from the side and not from the program itself.

We still have limited support for 'live programming' so it will be a little while before this is actually ready for use.

Cheers,
Mads

I found where I originally read about it:



Peter Ahé

unread,
Jan 29, 2016, 9:40:48 AM1/29/16
to Jirka Daněk, Dartino Discuss
This is precisely the "live programming" feature Mads mentions. The primary use case  is for making changes to the program while it is running from an IDE, not for the program to modify itself.

Taking it one step further, it is possible to imagine providing a Dart API to the Dartino compiler. But this API would be running on the Dart VM, not the Dartino VM itself. So not self-modification.

Having this feature available, one can implement self-modification by having the Dartino program talk to a server running on a Dart VM that uses the API to modify the running program that initiated the request. However, this doesn't seem like an attractive setup for small IoT devices.

My take on reflection is that it is really great to have available when I develop, but I don't want to pay for the overhead when my program is deployed. If my program needs to make reflective computations before it starts up, chances are I waste my end users' time. I want to have computed such things before I deploy my program to my end users.

--
You received this message because you are subscribed to the Google Groups "Dartino Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dartino-discu...@googlegroups.com.
To post to this group, send email to dartino...@googlegroups.com.

Jirka Daněk

unread,
Feb 9, 2016, 6:39:20 AM2/9/16
to Dartino Discuss
On Friday, January 29, 2016 at 3:40:48 PM UTC+1, Peter von der Ahé wrote:
On Fri, Jan 29, 2016 at 11:43 AM Jirka Daněk <jirka...@gmail.com> wrote:
On Friday, January 29, 2016 at 9:59:17 AM UTC+1, Mads Ager wrote:
 

My take on reflection is that it is really great to have available when I develop, but I don't want to pay for the overhead when my program is deployed. If my program needs to make reflective computations before it starts up, chances are I waste my end users' time. I want to have computed such things before I deploy my program to my end users.¨
 
I guess this is a matter of preference. JavaScript templating engines used to parse templates on page-load and everybody was OK with that for a long time. Many still do just that. Some people push for inexpensive object constructiors (initializing instance variables on first access, doing https://en.wikipedia.org/wiki/Lazy_initialization and there are surely other techniques) so that the programs start up faster.

Speaking for myself, I do not have a clue what generative reflection can be used for, except live programming, that is not better served by code generation. But it might be just because I never really used a language that supported it, and if it did, then doing it was frowned upon.
 
We still have limited support for 'live programming' so it will be a little while before this is actually ready for use.

The term "live programming" has been hijacked by artists, see https://en.wikipedia.org/wiki/Live_programming. It should be best called https://en.wikipedia.org/wiki/Interactive_programming now.

Are there any design documents for this available, so that I may explore what was done and what the plans are?
Reply all
Reply to author
Forward
0 new messages