qtxie on master
FEAT: handles PAUSE key and SCR… (compare)
qtxie on master
FIX: Win: issue #5170 (key in o… FIX: GTK: issue #5170 (key in o… (compare)
dockimbel on master
FIX: issue #5176 (Lexer events … (compare)
wow such a hot debate..
@dockimbel
@hiiamboris About your Red stack related post :point_up: September 10, 2019 9:59 AM:
I don't understand your point here. The stack is a working place for Red functions, so it's heavily used in many different places, as a lot of processing happens on the stack.
You are making a generality from a specific case (and you've picked up one of the worst). Fortunately, it's not that bad, even though the current stack handling is not fully satisfying.
I don't see how that would be helpful. Which problem are you trying to solve with that?
The point is that when I make Red function calls from R/S, I have to make sure my stack layout is correct. But I have no means to test for that correctness. Okay, sure, I can write a ton of asserts, but this approach has some shortcomings..
Anyway, it was just a vague idea born from pretty brief R/S exposure, that I wanted to share with you. If you say this problem is uncommon, I trust your judgement :)
*** User Error: {Invalid json string. Near: {^^/ "name": "debug_002_RRDB_ESRGAN_x4_DIV}}
*** Where: ???
load/as {{
"name": "debug_002_RRDB_ESRGAN_x4_DIV2K"
, "use_tb_logger": true
}} 'JSON
Though I have not read and understood all discussion here(Sorry, not have enough time and knowledge for me), I just want to comment
VS Code treats JSON
and JSON with Comments
as different languages.
https://drive.google.com/file/d/1rH2lXn1Nms_BDHamyNFMOBin7hgf-ufK/view?usp=sharing
Maybe this is one practical choice example that JSON
and JSON with Comments
are different.
If Red distinguishes them in the same way, JSON
codec(if it is not JSON with Comments
codec) does not allow comments is understandable.
getHandleComments
boolean getHandleComments()
Whether to parse or ignore comments - either reading or writing
setHandleComments
IParser setHandleComments(boolean value)
/parse
function and/or local storage of available parsers in a block. Imagine if some standard develops, and you might welcome versioning, it could be codec/parsers: [1.0 [.....] 1.2 [....]]
. Any such storage is dynamically extendable, sortable, searchable, as it is a block or a map.
>> load-json {^{^/ "name": "debug_002_RRDB_ESRGAN_x4_DIV2K"^}}
== #(
name: "debug_002_RRDB_ESRGAN_x4_DIV2K"
)
>> load-json {^{^/ "name": "debug_002_RRDB_ESRGAN_x4_DIV2K" // comment ^/ ^}}
*** User Error: {Invalid json string. Near: ^{^^^{^^/ "name": "debug_002_RRDB_ESRGAN_x4_DI^}}
*** Where: ???
My thoughts are that @Oldes problem is perhaps not lack of comments support, but poor Red error message? A problem I also stumbled upon many times. Useful message would be Invalid json string. Near: ^{// comment^}
, which would point exactly where the problem is.
Red is expressive enough that (provided you know where exactly your problem is) it's faster to write your own parse
rule to clean comments than looking for a suitable npm library in JavaScript world.
@loziniak in current codec implementation (which is not even 1.0, mind you), error reporting has coarse granularity, i.e. it marks location before malformed JSON value (object in this case), and reports it only after parsing have failed.
As for "poor Red messages" see red/red#3282 thread. Informative error reporting in dynamic and homoiconic language (such as Red) is not a trivial problem to solve.