oscar-system / Polymake.jl

Interface to Polymake using CxxWrap
Other
29 stars 19 forks source link

Questions about the polymake shell mode #426

Open fingolfin opened 1 year ago

fingolfin commented 1 year ago

I recently discovered the polymake shell mode trigger by $ pressed at the start of a Julia prompt, just like the Pkg and shell prompt modes in Julia. Nice!

I have some questions / suggestions on this:

  1. the prompt does not seem to echo results, unlike the Julia prompt. So if I do $i = 42; in one line; and then on the next line enter $i;, I would expect it to print 42 but it does not. I figured out that I can do print($i); to see it, but I think it would be nice to get this echo. Would this be possible to add?

  2. Is there any documentation? Or a desire at least for some? I'd be happy to contribute, too.

  3. Could we also make it accessible via say Polymake.prompt() to make it more discoverable? Just like we have GAP.prompt() (in return, I also would like to be able to trigger the GAP prompt with a key press, but it has problems, like: not being discoverable; unclear what to do if other packages use the same hotkey; difficult to visually show what happens when entering/exiting the mode in demos)

  4. Why is the prompt common > (with a space) and not common> or even polymake>?

benlorenz commented 1 year ago
  1. the prompt does not seem to echo results, unlike the Julia prompt. So if I do $i = 42; in one line; and then on the next line enter $i;, I would expect it to print 42 but it does not. I figured out that I can do print($i); to see it, but I think it would be nice to get this echo. Would this be possible to add?

This is supposed to mimic the normal polymake shell as closely as possible. Automatically printing objects can have some unintended side-effects in perl, e.g. visualization windows opening twice, because the to-string operator might be overloaded. So I would prefer not to change this.

  1. Is there any documentation? Or a desire at least for some? I'd be happy to contribute, too.

This seems to be undocumented, but we can add a short description for this prompt in a few places.

  1. Could we also make it accessible via say Polymake.prompt() to make it more discoverable? Just like we have GAP.prompt() (in return, I also would like to be able to trigger the GAP prompt with a key press, but it has problems, like: not being discoverable; unclear what to do if other packages use the same hotkey; difficult to visually show what happens when entering/exiting the mode in demos)

Yes, that should be easy to add. (I recently noticed that the $ hotkey is also used by the RCall package)

  1. Why is the prompt common > (with a space) and not common> or even polymake>?

It is again replicating the normal polymake prompt and common is one of the applications (like namespaces) in polymake. To avoid issues with function / type lookup Polymake.jl uses the most basic application as the global application and does not use polytope > by default as the polymake shell. You can switch the prompt with application("polytope"); (or using any other application) in the prompt.

But it might make sense to add polymake to the prompt as well to make it more clear that this is a polymake prompt, e.g. polymake (common)>.

fingolfin commented 1 year ago

+1 from me for polymake (common)> (or so) as prompt