Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate object and meta languages #15

Open
jstolarek opened this issue Feb 6, 2017 · 6 comments
Open

Separate object and meta languages #15

jstolarek opened this issue Feb 6, 2017 · 6 comments

Comments

@jstolarek
Copy link
Owner

When we evaluate a program we essentially convert from expression to a value. But the evaluation of pslice actually produces an expression. I introduced a new constructor of Value, VExp, to store the result of pslice. The conceptual end effect is that we end up with values and expressions getting mixed.

At the moment we can only visualize an expression that is result of a pslice, but what else might we want to do with it? Resugaring and pretty printing sounds like an obvious thing to do, which means we need a new language primitive for doing this.

I wonder where all of this leads us to. I feel something is wrong here but I can't find a way to put it into words.

@rolyp
Copy link
Collaborator

rolyp commented Feb 7, 2017 via email

@jstolarek
Copy link
Owner Author

If I understand you correctly, this is a (mostly undesirable) consequence of having these meta-operations in the object language.

Yes, I think this the exact cause of the problem.

My suggestion a while back was to take these out of the object language. However, having seen the REPL, I realised one advantage of having them in the language is that they become available in the REPL without having to introduce dedicated commands (:trace, :pslice, etc) that implement them.

I think that adding meta operations to the REPL would be trivial. Changing the implementation to actually consist of meta- and object languages seems like a lot of work, though. Probably not something I would want to do before the ICFP deadline.

@rolyp
Copy link
Collaborator

rolyp commented Feb 7, 2017 via email

@jamescheney
Copy link
Collaborator

As discussed before, the "trace" and other meta-operations are currently kind of a hack. One way to make them less of a hack could be to introduce types for "quoted" expressions and traces, so that we can work with them quasi-safely. This is beyond the scope of our current goal but I would like to come back to it at some point.

In any case, values contain expressions (in our environment/closure based semantics) anyway, so I'm not sure that this is more of a problem in the presence of the trace operations than in their absence.

@jstolarek jstolarek changed the title Values now contain expressions - is that a problem? Seprating object and meta languages Feb 7, 2017
@jstolarek jstolarek changed the title Seprating object and meta languages Seprate object and meta languages Feb 7, 2017
@jstolarek
Copy link
Owner Author

Note to self: one more benefit of doing this would be easier benchmarking. We could parse and evaluate a file in the object language and then call functions like pslice through the library API and precisely benchmark performance.

@jstolarek jstolarek changed the title Seprate object and meta languages Separate object and meta languages Feb 13, 2017
@jstolarek
Copy link
Owner Author

I'm trying to imagine how this should look from the user's perspective. I imagine having two completely separate languages: TML (object language) programs would be stored in *.tml files, whereas meta-programs would be stored in, say, *.slc files and would refer to source files containing TML programs. Some things to consider:

  • in this setting, what will be the overlap between two languages. For example, if we want to have a list as a slicing criterion then there must be a way to write lists in the meta language. Does this require duplicating the data definition in the meta-program? Or are we able to reuse data declarations of a TML program? Perhaps we can reuse them, but this seems to require parsing TML program before desugaring meta program.

  • in the current setting we are able to trace only selected expressions in the program. In the proposed setting this seems impossible - we would have to slice whole programs. Is that acceptable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants