MPS 3.0RC2: Referencing concept instances from the console

I was playing with the console offered by MPS 3.0. This seems like an interesting concept (i.e., offer an interactive way to interact with concepts, including a history).

With build 129.269, I was able to create a concept that implements Command. The concept I created requires references to other concepts. I have a sandbox with instances of these concepts, but I was unable to refer to the sandbox concepts to create references in the sandbox.

How would one create concepts that will be visible in the console to establish references? Should I make a command that creates these concepts?
13 comments
I found that importing the jetbrains.mps.console.base language in a sandbox creates a new console where model concept instances are visible. This would seem to answer my previous question. However, such consoles do not have the execute command button, and pressing control-Enter as indicated in the console text at the top of commands has no effect. So I now have the the ability to assemble commands, but not to execute them. It sounds like the console is almost doing what I need, but fails short. Any plan to make execute work in sandboxes?
0
Fabien,
The code you see in console is contained in a console model. What you can see from console is what you can see from this model. By default, at opening project MPS automatically adds all languages extending console.base as used languages to this model. It also imports a hardcoded list of general-purpose languages such as baseLanguage(+its extensions) and smodel language.
To add a new language/import to console, just use standard ctrl-m and ctrl-l shortcuts.
It's now impossible to make a list of languages/models to be imported into console model at startup. We are now developing the console functionality and, I suppose, this feature will be available in 3.1.
0
It wasn't planned that anybody will use console languages in a regular models as you can try you new commands right from console. The action is registered only for console tool then.
Actually, I'm not sure it's really needed - we've developed console commands without any sandbox model. Maybe my previous comment will help.
Workaround is copypaste your command from samdbox model into console tool.
0
We'd like to explore interactive uses for MPS. By this I mean we are
looking for ways to have a command line-like interactive shell that can
execute long running tasks.

It seems that the primary reason you developed the console is to interact
with MPS internals, and to have an interactive way to play/evaluate with
baselanguage expressions,  but I think another use would be for developers
to interactive commands that reference models in a sandbox.

What I see from the console suggests it would be a good place to do add
functionality towards this end (e.g., referencing models concept instances
and starting long running tasks). If you are actively developing this use
case, would be great if you could consider this use case. It would
certainly enable new kind of uses for MPS (interactive uses where
intentions are not sufficient to parameterize the task). I am happy to
discuss this more if needed.

Fabien


On Thu, Dec 5, 2013 at 8:59 AM, Mihail Muhin - Meta Programming System <
jetforum@jetbrains.com> wrote:

* Meta Programming System
<http://forum.jetbrains.com/forum/Meta-Programming-System> * > * MPS
3.0RC2: Referencing concept instances from the console
<http://forum.jetbrains.com/thread/Meta-Programming-System-878> * 8:59 am<http://forum.jetbrains.com/thread/Meta-Programming-System-878?message=Meta-Programming-System-878-2>  Mihail
Muhin <http://forum.jetbrains.com/user/Mihail.Muhin>

Fabien,
The code you see in console is contained in a console model. What you can
see from console is what you can see from this model. By default, at
opening project MPS automatically adds all languages extending console.base
as used languages to this model. It also imports a hardcoded list of
general-purpose languages such as baseLanguage(+its extensions) and smodel
language.
To add a new language/import to console, just use standard ctrl-m and
ctrl-l shortcuts.
It's now impossible to make a list of languages/models to be imported into
console model at startup. We are now developing the console functionality
and, I suppose, this feature will be available in 3.1.

   Fabien Campagne <http://forum.jetbrains.com/user/Fabien%20Campagne> @ Jul
31 <http://forum.jetbrains.com/thread/Meta-Programming-System-878>

I was playing with the console offered by MPS 3.0. This seems like an
interesting concept (i.e., offer an interactive way to interact with
concepts, including a history).

With build 129.269, I was able to create a concept that implements
Command. The concept I created requires references to other concepts. I
have a sandbox with instances of these concepts, but I was unable to refer
to the sandbox concepts to create references in the sandbox.

How would one create concepts that will be visible in the console to
establish references? Should I make a command that creates these concepts?

  JetBrains Forum | Build #173 (Sep/19/2013 4:50PM) | Feedback<http://confluence.jetbrains.net/display/JETF/Feedback>




--
Fabien Campagne, PhD – http://campagnelab.org

Assistant Professor,    Dept. of Physiology and Biophysics
          Institute for Computational Biomedicine
Associate Director,      Biomedical Informatics Core,
       Clinical Translational Science Center

Weill Medical College of Cornell University
phone:  (646)-962-5613  1305 York Avenue
fax:    (646)-962-0383  Box 140
New York, NY 10021

Do you speak next-gen?

See how GobyWeb can help simplify your NGS projects at
http://gobyweb.campagnelab.org
0
  Mihail Muhin <http://forum.jetbrains.com/user/Mihail.Muhin>

Fabien,
...
*To add a new language/import to console, just use standard ctrl-m and
ctrl-l shortcuts.*


This is actually the bit I was missing. I asked about this on the
forum<http://forum.jetbrains.com/thread/Meta-Programming-System-878>,
but did not hear from anybody. May I suggest you add explicitly
  1. import-language #import-model interactive commands that can be discovered
by completion? The keystrokes are nice, but only if you know that they
exist and what they are.

Thanks. Fabien
0
It seems that the primary reason you developed the console is to interact

with MPS internals, and to have an interactive way to play/evaluate with
baselanguage expressions,  but I think another use would be for developers
to interactive commands that reference models in a sandbox.

I'm not sure I understand your idea right.
Do you mean we need to support (1) references from console to regular models and (2) support for long-running commands like progress indicators etc.?

If yes, the first one is already implemented. The second one is not, but we are thinking about this case (as one of the reasons to write console tool was to make a better tool for migrations, which are long-running activities)

I would be happy to get some proposals on console and to discuss it, for sure.
0
Agreed that it's not very discoverable. But, wouldn't it be better if we add a note on that to the top of the console? Just because ctrl-m chooser is better than the completion, at least?
Screen Shot 2013-12-05 at 20.05.28.png
0
Yes, I agree, documenting the feature on top of the console would make the most sense in this case.
0
Fixed, will be available in next minor release.
Just FYI: see also the ctrl-R shortcut, which allows to import model by the name of a root node from it. It's much more convenient to use.
0
Great. Thanks for ctrl-R, it is indeed quite handy.
0
I meant (1) mostly and I have been using it since you explained how I could import models into the console. However, I ran into a limitation:

1. When an interactive command references a root node in a solution [e.g., do_something ROOT_NODE, where do_something is a console interactive command, and ROOT_NODE is a root concept imported from a solution into the console] the root node is not rebuilt if it is out of date when the command is executed. I would expect this to occur automatically when the command is executed, or to have a way to trigger the rebuild from the behavior of the interactive command. I could not figure out a way to do this.

I am trying to use the console as a substitute to the RunConfigurations. The run configuration is useful for simple jobs, but does not allow to configure the run with concept instances.  This becomes possible when the console is used. I can see a need for multiple console tabs, where different histories can be kept and persisted, but this is less important than triggering rebuild for the concepts referenced by a command.
0
1. I don't think we'll enable making console model's dependencies as console is intended to perform refactorings, so it should work with non-generatable code referenced from it.

2. In 3.1, we've already implemented the "make" command that will allow to generate models and modules, so if you need it, you'll be able to do it right from your console command. As far as I understand, it's not very simple to integrate this functionality into 3.0, so we haven't planned to do so.

3.
The run configuration is useful for simple jobs, but does not allow to configure the run with concept instances.

Sounds a bit strange to me; as far as I know, you can parameterize run configs with nodes. E.g. our unit-test run configs allow to choose a node which will be executed. Maybe some further explanation of your case will help me understand the problem.
0

Please sign in to leave a comment.