-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
wrong error on load "1abcde" #2036
Comments
Submitted by: BrianH It's guessing you're trying to write a decimal because of the e, which it interprets as an attempt at scientific notation. It's an error either way, so it's not really a bug. |
Submitted by: IngoHohmann I find the difference between raised errors unintuitive, and they make it hard to use transcode/next/error See this difference between "1km" and "1miles" >> transcode/next/error to binary! "1km"
== [make error! [
code: 200
type: 'Syntax
id: 'invalid
arg1: "integer"
arg2: "1km"
arg3: none
near: "(line 1) 1km"
where: [transcode]
] #{}] >> transcode/next/error to binary! "1miles"
== [make error! [
code: 200
type: 'Syntax
id: 'invalid
arg1: "decimal"
arg2: "1miles"
arg3: none
near: "(line 1) 1miles"
where: [transcode]
] #{}] Furthermore, the error may hint at a possible place for optimization. The moment, that a character other than "e" is found, it is clear that it is an error, so why check the following characters, wether there might be an "e"? |
Submitted by: BrianH TRANSCODE needs a lot of work (see #1327, #1857, #1915, #1916, and possibly #537, plus any syntax tickets), so we might want to adjust things. However, I don't think that you are right here. The errors triggered or returned by TRANSCODE are some of its most important features, and we need to make them as useful as possible. Given that what you are trying to load is not correct, TRANSCODE can only apply some heuristics and guess that you were trying to do. Seeing whether there is an e there is a reasonable clue that you were failing to write a decimal, rather than failing to write an integer. TRANSCODE can't read your mind, it has to go by the evidence at hand to guess your intentions. Nonetheless, tweaking the heuristics (like in #537) might help us improve the errors triggered. |
Submitted by: Ladislav "The errors triggered or returned by TRANSCODE are some of its most important features, and we need to make them as useful as possible." - agreed. However, Ingo is right that after finding out that there was an error it is a bad idea to parse additional characters from the input. Without a mind-reading module TRANSCODE cannot guess what the intent was. (might have been some kind of cut&paste error inserting some garbage) The most useful information for me would be a part of input found to be wrong by TRANSCODE. What it was meant to be is not useful since there is no way how to correctly determine that. |
Submitted by: IngoHohmann
LOADing a number followed by upto 4 characters returns an invalid integer error.
With more than 4 characters invalid decimal is returned
CC - Data [ Version: r3 master Type: Bug Platform: All Category: Error Handling Reproduce: Always Fixed-in:none ]
The text was updated successfully, but these errors were encountered: