You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
]a=file.open("unknown")
]a
Error: file not found
]a isa string
1
]a=file.open("unknown")
]a
Error: file not found
]a=file.open("unknown", "w")
]a
{"__isa": FileHandle, "_handle": OpenFile}
]
MiniMicro, file.open return a string when file not exist, and create it when mode is "w"
> a=file.open("unknown")
> a
{a: Handle, ... }
Miniscript commandline, windows version, file.open return a Handle, even if file not exist, and no mode set
which is better?
MiniMicro file.open return different type depending on whether file exists
Miniscript commandline always return same type Handle, even if filename is invaled name such as NUL, and always create this file
a = file.open("test", "r")
a isa null
1
Miniscript commandline returns null when set mode to "r"
so Miniscript commandline default file open mode is "w" ?
anyway, I think that:
file.open default open mode is better set to "r"
file.open better returns null when failed, not return string.
The text was updated successfully, but these errors were encountered:
The default open mode (which you can see with @file.open) is "r+" in both environments, as correctly documented here. This opens the file for reading and writing, but only if it already exists. Otherwise, you get an error string.
So Mini Micro's behavior here is correct, and command-line MiniScript is misbehaving when the mode is "r+" by creating the file if it does not exist.
JoeStrout
changed the title
file.open default mode is w ?
[Command-line] file.open with mode "r+" incorrectly creates nonexistent file
Jul 22, 2024
MiniMicro, file.open return a string when file not exist, and create it when mode is "w"
Miniscript commandline, windows version, file.open return a Handle, even if file not exist, and no mode set
which is better?
MiniMicro file.open return different type depending on whether file exists
Miniscript commandline always return same type Handle, even if filename is invaled name such as NUL, and always create this file
Miniscript commandline returns null when set mode to "r"
so Miniscript commandline default file open mode is "w" ?
anyway, I think that:
file.open default open mode is better set to "r"
file.open better returns null when failed, not return string.
The text was updated successfully, but these errors were encountered: