-
Notifications
You must be signed in to change notification settings - Fork 3
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
VeLaObSource: code editor undo/redo; new "Check" button: check code and parameters before execution #443
Conversation
…nd parameters before execution
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good @mpyat2. Thanks!
This works well as a syntax check. A refinement would be to check that the function has a real parameter and return type. This will pass the check for example:
f(t:real) { t^2 }
However, the error will still be picked up when the OK button is clicked.
I have a question. undo/redo is mentioned in the title of this issue. Is that intended to be undo/redo in the Edit menu? I don't see those menu items change (on my Mac at least). I see that ctrl-Z / cmd-Z works for undo, which is cool. I'm not sure what key redo is bound to.
Hi @dbenn About undo/redo: well, I did not mention it anywhere; actually, I've implemented CTRL+Z / CTRL-Y keystrokes for the undo and redo operations respectively, not a menu commands; I suppose on Mac it should be COMMAND+Z / COMMAND+Y. |
Thanks @mpyat2. Yep, command+Y on Mac works. I was initially thinking you were using VStar's UndoableEditManager, hence the confusion. May be able to make a link in future, but no worries for now. Re: parameter, return type checking, have a look at
If Having said all that, if you want to just wait for it to be picked up at run time, that's fair enough too. |
@mpyat2 on an unrelated note, I noticed that this dialog's "Add to Current?" checkbox defaults to checked, unlike all other observation source dialogs (as far as I know). |
Hi @dbenn , I've implemented the stricter check for the model function definition. Probably too straight and not elegant. What I've noticed:
The second (short) function will be used, the first will be ignored. About "Add to Current?" which is checked by default: the observation source is something between the 'true' obs. source and the model. I thought that it would be used to plot a 'continuous' model over the data. If you think it would be better to uncheck the "Add to Current?" checkbox by default (for consistency with other sources), I'll do it. |
Thanks for all this @mpyat2. No worries re: undo/redo. I agree with what you say re: "Add to Current?" so leave as you have it now. Interesting question about functions being redefined. A philosophical language design question. I have taken the same approach as some languages, e.g. Python, in which a function can be redefined:
That doesn't mean I agree with all of Python's design choices. Definitely not. Some languages allow this, some don't, e.g. Java does not. It's a good question. I think I'd like to spend some time considering it, weighing up the pros and cons as part of a separate issue, and not to delay merging the current work. Is that OK with you? |
Hi @dbenn , |
Thank you, @dbenn ! |
Thank YOU @mpyat2! :) |
see #442