Dyalog / ride

Cross-platform IDE for Dyalog APL
https://dyalog.github.io/ride
MIT License
204 stars 31 forks source link

Del editor in the session errors when trying to re-defined a pasted function with argument or local names #939

Open rikedyp opened 1 year ago

rikedyp commented 1 year ago

Describe the issue you are having

If a function (with an argument or local names in the header) is defined in the current namespace, pasting a ⎕VR definition fails with a VALUE ERROR

Did you connect to an already running interpreter or start the interpreter from RIDE?

Started from RIDE

How do you reproduce the issue?

Paste the following code into the session twice:

     ∇ Fn arg
[1]    ⎕←arg
     ∇

Instead of overwriting the definition (as works in the Windows IDE), there is the following output:

     ∇ Fn arg
[1]    ⎕←arg
     ∇      

     ∇ Fn arg
defn error
[1]    ⎕←arg
VALUE ERROR: Undefined name: arg
      [1]⎕←arg
           ∧

Paste the contents of Help → About (Shift+F1)

IDE:
  Version: 4.4.3716
  Electron: 13.6.9
  Chrome: 91.0.4472.164
  Node: 14.16.0
  Platform: Win32
  Date: 2022-08-12 07:57:09 +0200
  Git commit: b14d1be72166c5dcf55d4d6286224d73d123cfaf
  Preferences:{
    "autoCloseBrackets":"0",
    "autoPW":"1",
    "colourScheme":"Default (1)",
    "colourSchemes":"[{\"name\":\"Nord (1)\",\"theme\":\"dark\",\"styles\":\"com=fg:#616e88 diam=B,fg:#81a1c1 err=fg:#bf616a,bgo:0.5,U glb=fg:#ebcb8b kw=fg:#81a1c1 lnum=bgo:0,fg:#4c566a mod=bg:#434c5e,bgo:0.25 mtch=bg:#434c5e,bgo:0.5 norm=bg:#2e3440,bgo:1,fg:#eceff4 num=fg:#b48ead quad=fg:#ebcb8b srch=bg:#434c5e,bgo:0.5 str=fg:#a3be8c tc=bg:#434c5e,bgo:1,fg:#eceff4 tcpe=bg:#434c5e,bgo:1,fg:#eceff4 zld=fg:#b48ead vtt=bg:#434c5e dc=bg:#434c5e,bgo:1 cur=fg:#d8dee9 cubr=fg:#5e81ac asgn=fg:#88c0d0 lbl=fg:#81a1c1,B fn=fg:#81a1c1 qdl=fg:#d8dee9 var=fg:#d8dee9 sqbr=fg:#81a1c1 semi=fg:#81a1c1 idm=fg:#d08770 sel=bg:#434c5e par=fg:#eceff4 scmd=fg:#81a1c1 ucmd=fg:#81a1c1 vtip=bg:#3b4252,fg:#eceff4,bgo:1 ca=fg:#bf616a,bg:#434c5e,bgo:1 cm=fg:#a3be8c,bg:#2e3440,bgo:1 cv=fg:#ebcb8b,bg:#2e3440 cvv=fg:#88c0d0,bg:#2e3440,bgo:1 ma=fg:#ffffff,bg:#000000,bgo:1 na=fg:#b48ead,bg:#434c5e,bgo:1 qor=fg:#eceff4,bg:#bf616a,bgo:1 op1=fg:#88c0d0 op2=fg:#8fbcbb\"},{\"name\":\"Albrecht Dürer (1)\",\"theme\":\"light\",\"styles\":\"com=I diam=B err=bg:1,bgo:0.5,B,I,fg:#da1616,U glb=I kw=B lnum=bg:f,bgo:0 mod=bg:7,bgo:0.25 mtch=bg:c,bgo:0.5 norm=bg:f,bgo:1 ns=fg:8 num=fg:8 quad=fg:8 srch=bg:c,bgo:0.5 str=fg:8 tc=bg:e,bgo:1 tcpe=bg:dadada,bgo:1 zld=fg:8 vtt=bc:aaa dc=bg:#993333,bgo:1\"},{\"name\":\"Default (1)\",\"theme\":\"light\",\"styles\":\"asgn=fg:00f com=fg:088 dfn=fg:00f diam=fg:00f err=fg:f00,U,B,I fn=fg:008 idm=fg:008 kw=fg:800 lnum=fg:008,bg:f,bgo:0 mod=bg:7,bgo:0.25 mtch=bg:ff8,bgo:0.5 norm=bg:f,bgo:1 ns=fg:8 num=fg:8 op1=fg:00f op2=fg:00f par=fg:00f quad=fg:808 qdl=fg:c0c sel=bg:48e,bgo:0.5 semi=fg:00f sqbr=fg:00f srch=bg:f80,bgo:0.5 str=fg:088 tc=bg:d,bgo:1 tcpe=bg:c8c8c8,bgo:1 trad=fg:8 var=fg:8 zld=fg:008 scmd=fg:00f ucmd=fg:00f vtt=bg:ff0 ca=bg:828282,bgo:1,fg:0f0 cm=bg:0,bgo:1,fg:080 cv=bg:f,bgo:1,fg:0 cvv=bg:0,bgo:1,fg:0ff ma=bg:828282,bgo:1,fg:0ff na=bg:828282,bgo:1,fg:f qor=bg:f00,bgo:1,fg:f dc=bg:#993333,bgo:1\"}]",
    "confirmations":"{\"SaveFileOptionsExtension:.aplf\":100,\"SaveFileOptionsExtension:.apln\":100,\"SaveFileOptionsExtension:.aplo\":100,\"SaveFileOptionsExtension:.dyalog\":100,\"\":100,\"SaveFileOptionsExtension:.aplc\":100}",
    "indent":"2",
    "kbdLocale":"en_US",
    "keys":"{\"AC\":[\"Ctrl-Alt-C\"],\"DK\":[\"Ctrl-Delete\"],\"FX\":[\"Ctrl-S\"],\"QCP\":[\"Ctrl-Shift-P\"],\"VAL\":[\"Ctrl-Alt-Enter\"],\"ZM\":[\"Ctrl-Shift-M\"],\"PF29\":[\"Ctrl-L\"]}",
    "lbarOrder":"← +-×÷*⍟⌹○!? |⌈⌊⊥⊤⊣⊢ =≠≤<>≥≡≢ ∨∧⍲⍱ ↑↓⊂⊃⊆⌷⍋⍒ ⍳⍸∊⍷∪∩~ /\\⌿⍀ ,⍪⍴⌽⊖⍉ ¨⍨⍣.∘⍤⍥@ ⍞⎕⍠⌸⌺⌶⍎⍕ ⋄⍝→⍵⍺∇ & ¯⍬ ",
    "menu":"# see below for syntax\n\nDyalog                          {mac}\n  About Dyalog             =ABT\n  -\n  Preferences              =PRF\n  -                            \n  &Quit                    =QIT\n&File                           {!browser}\n  &Open...                 =OWS\n  &New Session             =NEW\n  &Connect...              =CNC\n  -                             {!mac}\n  &Quit                    =QIT {!mac}\n&Edit\n  Undo                     =UND {!browser}\n  Redo                     =RDO {!browser}\n  -                             {!browser}\n  Cut                      =CT  {!browser}\n  Copy                     =CP  {!browser}\n  Paste                    =PT  {!browser}\n  Select All               =SA  {mac}\n  -                             {!mac&&!browser}\n  Preferences              =PRF {!mac}\n&View\n  Show Language Bar        =LBR\n  Show Status Bar          =SBR\n  Show Workspace Explorer  =WSE\n  Show Debug               =DBG\n  Line Wrapping in Session =WRP\n  -                             {!browser}\n  Stops                    =TVB\n  Line Numbers             =LN\n  Outline                  =TVO\n  -                             {!browser}\n  Increase Font Size       =ZMI {!browser}\n  Decrease Font Size       =ZMO {!browser}\n  Reset Font Size          =ZMR {!browser}\n  -                             {!browser}\n  Toggle Full Screen            {!browser}\n&Window\n  Close All Windows        =CAW\n&Action\n  Edit                     =ED\n  Trace                    =TC\n  -\n  Clear all trace/stop/monitor =CAM\n  Weak Interrupt           =WI\n  Strong Interrupt         =SI\n&Help\n  Getting Started          =http://dyalog.com\n  Dyalog Help              =DHI\n  Documentation Centre     =DOX\n  -\n  Dyalog Website           =http://dyalog.com/\n  MyDyalog                 =https://my.dyalog.com/\n  -\n  Dyalog Forum             =http://www.dyalog.com/forum\n  -                             {!mac}\n  About                    =ABT {!mac}\n\n# Syntax:\n#   &x   access key, alt+x\n#   =CMD command code; some are special:\n#          LBR WRP WSE render as checkboxes\n#   =http://example.com/  open a URL\n#   {}   conditional display, a boolean expression\n#          operators: && || ! ( )\n#          variables: browser mac win\n#   -    separator (when alone)\n#   #    comment\n\n# The =PRF (\"Preferences\") menu item must be present.",
    "otherExe":"C:\\Program Files\\Dyalog\\Dyalog APL-64 18.1 Unicode\\dyalog.exe",
    "pfkeys":"[\"\",\"<VAL>\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"⍞←100⍴⎕UCS 10<ER>\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]",
    "selectedExe":"C:\\Program Files\\Dyalog\\Dyalog APL-64 19.0 Unicode\\dyalog.exe",
    "wse":"1",
    "zoom":"-2"
  }

Interpreter:
  Version: 18.2.45349
  Platform: Windows-64
  Edition: Unicode/64
  Date: Mar  8 2022 at 14:21:49
abrudz commented 1 year ago

Note that the Windows IDE's ability to handle this is very new, and part of the multi-line input feature, which RIDE doesn't quite support yet.