%"" instead of none in these cases:>> split-path %/ == [%/ none] >> split-path %./ == [%./ none] >> split-path %../ == [%../ none]
split-path tests, based on Ladislav's idea that rejoin split-path should produce the original result. I always liked that idea, but as @hiiamboris it's not a silver bullet, just a different design choice.none.until until loop and check if file part is none%""split-path: function [ "Returns a block containing a path and target." path [any-string!] ][ target: any [find/last/tail path slash path] reduce [copy/part path target to file! target] ]
split-path, but with rejoin?>> rejoin [%/ none] == %/none
none to %none? I know it's just just forming it, but it doesn't seem that helpful to me. The empty file %"" seems weirder to me than none for "no file"rejoin.form, but rejoin, since it is producing a file!, not a string! in this case. It just seems weird to me that you would get a file named "none" out of the value none.split-path the best it can be first.help now.split-path is too dense. Your split-path is better, is it not?Red 0.6.4 for Linux built 30-Dec-2021/17:47:48-07:00 commit #972994dSplits a file or URL path. Returns a block containing path and target, split-path %"" should be [%./ none] Right?none better for "no file part", instead of a file! which cannot exist. But maybe there are some use cases which are really awkward dealing with that? I've never used it so far though. I always run into little things that are different from my expectations, and it's not always clear to me what the idiomatic way would be.help being specific in the attrs it checks for, rather than just accepting a block, and suffered the classic fate of other changes breaking that. :^\help will then choke on. What it does in that case is show you the source as a fallback.[USR: [content]] and everything inside it is ignored but accessible. It would be great for flagging, tagging, cataloging, so extending the functions info.Red []
register-scheme make system/standard/scheme [name: 'len actor: context [
open: func [port] [port]
length?: func [port] [20]
]]
probe length? port: open len://test ;== 75611332sys/make-scheme [ name: 'len actor: [ open: func [port] [port] length?: func [port] [20] ] ] length? open len://test ;== 20
>> b2: ["aa" "bb"] == ["aa" "bb"] >> unique form b2 == "a b" >> b2: ["aa" "bb" "cc" "dd"] == ["aa" "bb" "cc" "dd"] >> unique form b2 == "a bcd"
>> unique probe form b2: b2: ["aa" "bb" "cc" "dd"] "aa bb cc dd" == "a bcd"
unique on strings removes all duplicate chars just as it should, I'd say. unique removes all duplicate values from string arguments. sort in there to prime the problem pump.Re: WRT: func ['name content][ <add content to system catalog> ] WRT incr [<INCR metadata here>]
face/extra. >> context [meta: "My additional thoughts on this func" set 'my func [arg /meta][if meta [print self/meta] arg]]() >> my/meta 1 My additional thoughts on this func == 1
self/extra or /user and you can store and you LOAD without reducing anything. F-INFO: [
STATUS: []
VERSION: 1.0
LOG: {}
TODO: {}
NOTES: {}
DOCS: {}
IDEAS: {}
]f: func [
arg
/local
any-local
F-INFO {
STATUS: [WORKING]
VERSION: 1.0
LOG: {}
TODO: {}
NOTES: {}
DOCS: {}
IDEAS: {}
}
] [
<my-function-body>
]>> parse spec-of :f [thru 'f-info s: (probe info: load first s) to end]
[
STATUS: [WORKING]
VERSION: 1.0
LOG: ""
TODO: ""
NOTES: ""
DOCS: ""
IDEAS: ""
]info contains our information block.>> x: block!
== block!
>> ? x
code length: 0 index: 24 []
b length: 0 []
p length: 0 index: 7 []
e length: 0 index: 3 []
included-scripts length: 26 [%/d/devel/red/common/expect.red %/d/de...? x and ? block! but talk about shooting off one's feet..>> x: block! == block! >> ? block! Found these words: any-object! block! length: 3 any-path! block! length: 3 bar-effect block! length: 4 base-effect block! length: 4 ctx-edit block! length: 152 ctx-viewtop block! length: 371 datatypes block! length: 54 dtw-keymap block! length: 18 immediate! block! length: 17 internal! block! length: 3 scalar! block! length: 7 suffix-map block! length: 25 >> ? x No information on x (word has no value)
>> x: block! == block! >> ? x No block values were found in the global context.
>> x: block!
== block!
>> ? x
val length: 6 [455x1055 15x15 square to-right 0x0 []]
B1 length: 119 index: 2 [translate 0x0 [push [fill-pen 0.0.0 line-width 1.0 box 0x0 15x1...
B2 length: 115 index: 6 [translate 15x0 [push [fill-pen white line-width 1.0 box 0x0 15x...
...>> x: block!
== block!
>> ? x
No block values were found in the global context.
>> ? block!
No block values were found in the global context.
>> b: []
== []
>> ? x
b length: 0 []
>> ? block!
b length: 0 []x's value is, not how many blocks there are around :)x in this case is the type parameter passed to me by the lexer, and I wanted to know if it passes me words or datatypes (?? is of no help here, nor mold/all)type? is not good?print [type type? type], but obviously during debugging I'd like to intrude less into the code, so ? was my first trydatatype? ?>> x: block! == block! >> ? block! BLOCK! is a datatype. It is defined as a series of values. It is of the general type block. Found these related words: datatypes block! length: 57 [end! unset! none! logic! integer! decimal! percent! money! char! pair! tu... >> ? x X is a datatype of value: block!
>> ?? ?
...
datatype? :value [
spec: spec-of :value
either :word <> to word! :value [
output ajoin [
"^[[1;32m" uppercase mold :word "^[[m is a datatype of value: ^[[32m" mold :value "^[[m^/"
]
] [
output ajoin [
"^[[1;32m" uppercase mold :word "^[[m is a datatype.^[[m^/"
"It is defined as" either find "aeiou" first spec/title [" an "] [" a "] spec/title ".^/"
"It is of the general type ^[[1;32m" spec/type "^[[m.^/^/"
]
unless empty? value: dump-obj/match/only system/contexts/lib :word [
output ajoin ["Found these related words:^/" value]
]
]
throw true
]>> x: block! == block! >> ?? x x: block! >> v: mold x == "block!"
>> x: block! == block! >> ? x x is a datatype It is defined as a series of values It is of the general type block No values defined for x >> ? block! block! is a datatype It is defined as a series of values It is of the general type block Found these related words: datatypes block! length: 58
? x is not helpful there IMO. And this is the key question: What should help do?view [base rate 0:0:3 on-time [unview]] works for meview [] (enter) and show another window :)view [base]. Click into console. Mouse over console icon in bottom of screen and close the view from there. My console hangs. Does yours?ESC view [] ENTER blindly even though it doesn't reflect keystrokescase/all crash. Red 0.6.4 for Windows built 4-Feb-2021/17:06:04-07:00 commit #6440af5 >> foreach i jo [ print [ type? i mold i ]] datatype logic! datatype percent! datatype date! datatype file! datatype tuple! datatype pair! datatype string! datatype word! datatype set-word! >> find jo file! == [file! tuple! pair! string! word! set-word!]
>> find jo file! == none
/only. You can use find/only for now, but we should check tickets, as there are a couple related to this.file! datatypefile! datatypetrim works on binary as:>> trim/head #{0011002200}
== #{11002200}
>> trim/tail #{0011002200}
== #{00110022}trim/head/with, it should throw an error, that incompatible refinements are used instead of ignoring the /head silently:>> trim/head/with #{0011002200} 0
== #{1122}>> head trim/tail back tail #{0000110000}
== #{0000110000} ;<--- Wrong, should be #{00001100}>> head trim/head back tail #{0000110000}
== #{00001100}/head and /with` be incompatible, conceptually?/with is same as /all, but with alternate chars... as is noted in the doc string:/with => Same as /all, but removes characters in 'str'.
str [char! string! binary! integer!]trim [#[none] 1 #[none] 2 #[none]] should be [1 #[none] 2] instead of [1 2], because that is known issue https://github.com/red/red/issues/4210 >> sort/compare [[a 3] [c 1]] 2 *** Script Error: incompatible or invalid refinements *** Where: sort *** Near : 2 *** Stack:
body-of applied to a native! give an error?>> set/some [a none c][1 2 3] == [1 2 3] >> a == 1 *** Script Error: ask does not allow integer! for its question argument *** Where: ask *** Near : result *** Stack: ask
a not previously set to anythingBody-of returning an int is something we can note, about why, but it doesn't hurt anything to do so at this time.none to be 2, so all bets are off on behavior after that.'none specially if on the left hand side.none value, it's just a word.reflect works yet, but:>> probe get 'print
make native! [[
"Outputs a value followed by a newline"
value [any-type!]
]]23reduce [1 none 3], it works as expected.[1 #[none] 3]set reduce anything?>> x: ["a" "b" "c"] == ["a" "b" "c"] >> y: [none none none] == [none none none] >> type? y/1 == word! >> z: collect [foreach i x [keep find i "Oh"]] == [none none none] >> type? z/1 == none!
b?#[none]none as it hurts the eye lessnone (and logic values) would make things easier.I sometimes run into that too, especially in parse where you write a dialect that checks for none! and depending if a human writes it or if the machine produces it, none can be either a word! or none!.#[none] [on off yes no]? Those are also logic values and will break code that uses them just like [true false]. And unset? *All* the datatype! words? Those suffer the same problem. Then what about if and every other standard function. You tripped over none, but redefining any standard function will break code. The more common, the more code. none unevaluated word! and none evaluated to none! and for example unevaluated string! word and evaluated string! datatype!.none: "hi" or similar.s: "string" string! and string!. Can you tell which is a word and which is a datatype?view [ title "TABS"….progress is the culprit. The program works on Mac when I comment it out.Red [ needs: 'view]
view [ below
progress 100x20 data 20% react [face/data: s/data]
s: slider 100x20 data 20%
]*** Script Error: float! type is not allowed here *** Where: eval-set-path *** Near : no *** Stack: view layout eval-set-path
face/data: s/data?progress issue not long ago. We have other tickets for it, but I don't see that one.Red [needs: 'view]
view [
progress 50% 100x20
]*** Script Error: float! type is not allowed here *** Where: eval-set-path *** Near : no *** Stack: view layout eval-set-path
Red [
needs: 'view
]
view [
p: progress 200
do [p/data: 50%]
]>> #{11111111} xor #{ffffffff}
== #{EEEEEEEE}>> head ((skip #{11111111} 2) xor #{ffffffff})
== #{EEEEFFFF} ;<---- I expected #{1111EEEE}
>> head ((skip #{11111111} 2) xor #{ffff})
== #{EEEE} ;<---- I expected #{1111EEEE}xor-in-place routine that xor would dispatch to but it should be a REPxor-in-place?#{EEEE}>> #{11111111} xor #{0000ffff}
== #{1111EEEE}change it with the result depending on your needsred a: make block! 0 b: at [1 2 3 4 5 6 7 8 9] 5 insert/part a b -2 a ;== [5 6 7 8 9] ;<---- it should be [3 4], like in Rebol!
sort seems to honor it, but reverse does not, and reverse/part b -3 in R2 is an error.copy/part b -2 ;== [3 4]
insert and append.reverse/part should also work... in Rebol3 it does:>> b: [1 2 3 4] reverse/part tail b -2 == [4 3] >> b == [1 2 4 3]
series! value for length/range is different than an number!, so we need to define the behavior for both. part amounts, but I *am* saying that we shouldn't propagate unspecified behavior. +100 for a complete /part evaluation, design spec, and proposal. :^)part func and design as well, which should be the first thing someone looks at.append buffer copy skip tail b -2
append/part buffer tail b -2
part func should support negative length too.part func proposal?limit as abs part and skipping back the same amount.>> remove/part (make bitset! "ABC") "AB" *** Script Error: missing a required argument or refinement *** Where: remove *** Near : "AB" *** Stack:
bad-refines: "incompatible or invalid refinements">> remove/key (make bitset! "ABC") "AB"
== make bitset! #{000000000000000010}invalid-arg but agree that the existing message is wrong. There's a ticket about messages.>> rejoin [#{00} [#{01} #{02}]]
== #{000102}>> rejoin ["a" ["b" "c"]] == "ab c" ;<---- I expected the inner block to be also joined, so have "abc"
>> rejoin ["a" ["b" now]] == "ab now"
rejoin/deepselect/skip in Rebol2 was like:>> data: [a 1 2 b 3 4] == [a 1 2 b 3 4] >> select/skip data 'a 1 == 1 >> select/skip data 'a 3 == [1 2] >> select/skip data 'b 3 == [3 4]
>> select/skip data 'b 3 == 3
find/tail, so pointless>> either tmp: find/skip/tail data 'a 3 [copy/part tmp 2][none] == [1 2]
skip-size > 2skip-size <= 1, than it works like if there is no /skip and that in R3 the _block selection_ was never done.find. Making yet another special case in the design only to omit one if-expression is not worth it.either tmp: find/skip/tail data 'a 3 [copy/part tmp 2][none]if tmp: find/skip/tail data 'a 3 [copy/part tmp 2]skips the indexes that are not integer multiples.find/skip/tail returns *after the skip*, not after needle as in your example.select/skip data 'a 3
if tmp: find/skip data 'a 3 [copy/part next tmp 2]
select/skippick select/skip data 'b 3 2 ;provided /skip returns block
pick find/skip data 'b 3 3
row: find/skip ... row/1 row/2 .. than work with the copyselect/skip, roughly discounting dupes by eye. Most common skip value by far is 3. Next is 2. A few used 4. 2 is kind of funny, because it's the same as 1, but returns a block. I imagine this was Carl's clever way of letting you get a single value or a block, but it's a bit odd from a consistency reasoning perspective. I'll come back to this.help. Lots of tests for it though./skip part applies to the value/key/needle you're searching for; what's returned is separate from that./skip 2 when you do that, for select or path syntax. *This* design chat I do remember coming up at times in R2. Most R2 code is probably OK, but every time path syntax is used, or plain select, it runs the risk of finding the key as part of a record or non-key value. That's bad. I can't be the only one with multiple versions of helper funcs to avoid this problem. I even ported mine to Red.>> blks: [a [1 2] b [3 4]] == [a [1 2] b [3 4]] >> select/skip blks 'a 2 == [[1 2]]
>> blks: [a [1 2] b [3 4]] == [a [1 2] b [3 4]] >> select/skip blks 'a 2 == [1 2]
/skip 2. /only is already used for the key, so we can't even add that to flatten the result. This is a rock and a hard place. It makes perfect sense to return everything in a "record" when you select for its key (the R2 model), but it also makes perfect sense to optimize for the most common use case. part REP. The idea being that series values could have an internal skip value. But that's beyond this issue for now.select/skip doesn't apply as often./last is not deep. Is that an issue?deep. Good exercise to think about why. :^)read/info supposed to be used with the new IO? Because it has no doc-string now.[response-code headers content]. Full I/O behavior is TBD.read/all/partread/all is better than read/info.. because for example in case of error, it returns the error html content page too.. and not just error. Which is useful.select/skip discussion with Carl on Altme, but don't remember the conclusion :) b: new-line/skip [a b c d e f g h i] on 3
>> select/skip probe b 'd 3
[
a b c
d e f
g h i
]
== [e f]e and f.find.reactivity.redselect/skip only with length = 2 (mostly because there was no map! type for key-value pairs in Rebol2)select with a path! to get at a nested value.>> select [a: [b: 123]] 'a/b == none
select is looking for a literal path!, but these didn't confirm that suspicion either...>> select [a: [b: 123] a/b 456] 'a/b == none
/only. But select does not go deep: *"Find a value in a series and return the next value, or NONE"*/only works same as block:>> select [a: b: 123 a/b 456] [a b] == 123 >> select [a: b: 123 a/b 456] 'a/b == 123
>> select/only [a: b: 123 a/b 456] 'a/b == 456 >> select/only [[a: b:] 123 a/b 456] [a: b:] == 123 >> select/only [[a: b:] 123 a/b 456] [a b] == 123
select*: function [blk key /only][case [
only [select/only blk key]
path? key [foreach k key [blk: select/only blk k]]
true [select blk key]
]]
select* [a: [b: 123] a/b 456] 'a/b
;== 123
select*/only [a: [b: 123] a/b 456] 'a/b
;== 456
select*/only [[a: b:] 123 a/b 456] [a b]
;== 123
select* [a: b: 123 a/b 456] [a b]
;== 123
select* [a: [b: 123] a/b [c 456]] to-path [a/b c]
;== 456
>> select* [a: [b: [c: [x y z d 123]]] a/b [c 456]] 'a/b/c/d
== 123
select* [a: [b: [c: [x y z d 123]]] a/b [c/d 456]] to-path [a/b c/d]
== 456transcode "1.79769313486232e308" (or typing 1.79769313486232e308 in the console) hangs Red 0.6.4 for Windows built 19-Feb-2022/3:17:54+01:00 commit #abb5641.do it, but hadn’t gotten that working yet>> type? load "[test" *** Syntax Error: (line 1) missing ] at [test *** Where: transcode *** Stack: load >> type? load-json "[test" == error!
load return error, or load-json should cause error instead?unescape is now a routine that fires an error. XML has a lot of do make error! calls. @rebolek, is there a reason you don't use cause-error?if error? data: load-json or if error? try [data: load-json ..]. And answer here is clear as it comes down to what user gets if he omits if error?: a clear error from the JSON codec or something like error! type is not allowed here.if error?try, so their app crashes?try that is, but if you just use a reasonable number of tryes then it may even easily be a win), and exceptions were invented much later than C. view [a: area 600x480 button "Load" [a/text: form load %fail2.json]]cause-error is quite low level. Preferred way should be the #error macro in most cases. cause-error is just a Red wrapper for that.cause-error is that by using error catalog you don't have to duplicate the same message all over. And also your compiled code also doesn't have to include extra error message strings. So it makes sense to wrap it in *some* contexts.cause-error in place of clear to-the-point error messages we forfeit important clues and waste our and everybody's time in the end.do make error!, but it's a bulkier alias in this case.do make error! makes you think a lot more. At least it does me.#error is the lack of an active verb in the name, so it looks like a definition more than an action.do/cause/fire/throw/... in the error domain as with all the variants of append/extend/rejoin/reform/join/ajoin/combine/merge in string and structure building.#error#err better?Math is probably best suited as an optional piece. It's a nice example to have included, also so small that it seems silly to break it out. OTOH, it's also limited in scope and math is a very broad term. And handy if people want to expose math expressions to end users. They shouldn't have to know about Red's internals. do-math or eval-math at least verbify it.Layout is interesting, because it is a verb as well as a noun, and so works very well mapped to a declarative dialect.lay-out as a verb?what.complain is cute, but kind of informal or something. I seem to remember that appearing somewhere else. Does what need to be a global value? Maybe it could be folded into help. It seems like it doesn't have a clear role distinct from help. For instance, either returning a value, _or_ printing results (and maybe printing and returning). I think it would have more utility if it just returned results. And why does it reuse the same output buffer?cause-error extremely confusing. There is no indication what type or id are used for. And when you intercept an error, it's not super clear what you are supposed to do with it either...>> probe try [do make error! "ack"]
make error! [
code: 800
type: 'user
id: 'message
arg1: "ack"
arg2: none
arg3: none
near: none
where: 'do
stack: 75580124
]where is nice, but most other languages would call that the stack. So what is this stack for? If you just want to present the message to the user, do you just show them arg1? What are the other args for?What we simply inherited from Rebol, but changing it doesn't break anything beyond unlearning it. I doubt it's used much anyway (I know I don't), because the information isn't presented in a terribly useful way.cause-error needs improvement, so I'll ping Nenad on that. Just let him know we're talking about it and may propose something better.Where vs stack is interesting, and I believe it's OK in the context of Red being data centric, including "code". The new interpreter instrumentation, and @hiiamboris 's improvements on the mezz wrappers are great. Another case of needing to outline guidelines for people as an important step.cause-error a bit more: As CSV is part of the main distro, probably it shouldn’ throw user error but its error should be added to error catalog. Then cause-error would make sense using.throw, note, syntax, script, math, access, reserved1, reserved2, user, internal in SYSTEM/CATALOG/ERRORS, we might have codec or data for JSON, CSV, XML codecs.>> c: context [a: 1]
== make object! [
a: 1
]
>> c/b: 1
>> c
== make object! [
a: 1
]font-size 0 error.view [
button "layout with font-size 0" [
the-vid-code: [base1: base "HELLO" font-color white font-size 0]
either error? err: try/all [
output-panel/pane: layout/only the-vid-code
true
][
print "error"
][
print "no-error"
]
]
output-panel: panel 400x400
]attempt didn't seem to catch it either.base "x" font-size 0 crashesecho 'Rebol[] do/args %red.r "-d -r --no-view %environment/console/CLI/console.red"' | rebol +q -s from latest master.[http://test.com]. When I press Enter, Red opens a block for me. I must type space before the closing bracket to get this input accepted.#"a" - #"b" *** Math Error: math or number overflow 0 + #"a" - #"b" == -1
-1 imho instead of the error.>> #"b" - #"a" == 1 >> #"a" - #"b" == -1
>> #"a" + #"b" == #"Ã"
#"a" - #"b"
>> 2/2/2 - 1/1/1 == 397
32 - #"a", which is a case for consistency. >> loop 10000 [t: dt [loop 1000 []] if t < 0 [probe t]] -0:00:00.0001707 -0:00:00.0005066 -0:00:00.0003257 -0:00:00.0003281 -0:00:00.0003163 -0:00:00.0004959 == none
>> y: [none none!] >> quote none = pick y 1 ** Script Error: = operator is missing an argument *** Where: catch *** Near : = pick y 1 *** Stack:
>> quote none == none >> = pick y 1 *** Script Error: = operator is missing an argument *** Where: catch *** Near : = pick y 1 *** Stack:
'nonelit-word! like any other.quote (none = pick) y 1
do dialect, see>> do/next [quote none = pick y 1] 'step == none >> step == [= pick y 1] >> do step *** Script Error: = operator is missing an argument
spec-of :quote to see how that is defined and why therefore your line is explicitly not evaluated the way you assume. (none = pick) would itself raise an error, because then pick would be missing it's arguments. If any, then quote (none = pick y 1) ⇔ quote (none = 'none) ⇔ quote false (with the parens only for explicitly demonstrating alledged evaluation order), but as shown: no, not in this order.>> quote none = pick y 1 *** Script Error: = operator is missing an argument >> (quote none) = pick y 1 == true
quote uses a get-arg.>> mold to url! "http://aa/bb[]cc" == "http://aa/bb%5B%5Dcc" ;<--- OK >> mold to url! "http://aa/bb()cc" == "http://aa/bb()cc" ;<--- WRONG, it should be: "http://aa/bb%28%29cc"
>> %"aa:bb"
== %aa:bb ;<=== not backwards loadable
>> load {%aa:bb}
== [%aa :bb] ;<=== two values>> out: copy [] == [] >> loop 10000 [collect/into [keep [[a: 1]] ] out] == [[a: 1] [a: 1] [a: 1] [a: 1] [a: 1] [a: 1] [a: 1] [a: 1] [a: 1] [a: 1] [a: 1] [a: 1] [a: 1] [a: 1] [a: 1... >> ; probe out >> >> >> unique out *** Internal Error: stack overflow *** Where: unique *** Near : out *** Stack:
[a: 1]? Just to make sure. Then there is no need to 10'000 times collect, you can often use it only once as an outer "bracket". And then there is keep/only to insert blocks as blocks:>> out: collect [loop 10000 [keep/only [a: 1]]]
unique remains. It happens with most any-block! types but interestingly doesn't happen for map!:>> unique collect [loop 10000 [keep/only [a: 1]]] ;*** Internal Error: stack overflow
>> unique collect [loop 10000 [keep/only quote (a: 1)]] ;*** Internal Error: stack overflow
>> unique collect [loop 10000 [keep/only quote a/b]] ;*** Internal Error: stack overflow
>> unique collect [loop 10000 [keep/only quote :a/b]] ;*** Internal Error: stack overflow
>> unique collect [loop 10000 [keep/only quote a/b:]] ;*** Internal Error: stack overflow
>> unique collect [loop 10000 [keep/only #(a: 1)]]
== [#(
a: 1
)]return center between widgets causes a syntax error. I'm sure that bugs exist for other attributes as wellview [
style chk: check "Option" data yes
style vline: base 2x60 red
across top vline button "Ok" text "Text" field chk return
across middle vline button "Ok" text "Text" field chk return
across bottom vline button "Ok" text "Text" field chk
]return accepts either new row with middle/top/bottom or new column with center/left/right, but when you mismatch these you get the errorlayout work :)return doesn't do anything either (I am still learning VID)view [ below text "a" return center below text "b" ]
self-related tickets out there. If you can't find this one, please add it.;; create sub-programs
attempt [make-dir %utility-scripts]
write %utility-scripts/math.red "Red []^/^/halt"
write %utility-scripts/gui.red "Red []^/^/halt"
;; create main program
write %test.red {
Red [needs: View]
#include %utility-scripts/math.red
#include %utility-scripts/gui.red
halt
}
;; compile with -e
write %compile-test-with-e.bat {
echo on
red-2022-05-17 -r -e -t windows test.red
pause
}
;; compile without -e
write %compile-test-without-e.bat {
echo on
red-2022-05-17 -r -t windows test.red
pause
}*** Compilation Error: include file not found: utility-scripts/gui.red
inline>> to integer! "3.4e2" == 3 >> to integer! "3e2" *** Script Error: cannot MAKE/TO integer! from: "3e2" *** Where: to *** Near : "3e2" *** Stack:
. is a common punctuation, so once it's encountered the parser stops>> to integer! "3x2" *** Script Error: cannot MAKE/TO integer! from: "3x2" *** Where: to *** Near : "3x2" *** Stack: >> to integer! "3 inches" *** Script Error: cannot MAKE/TO integer! from: "3 inches" *** Where: to *** Near : "3 inches" *** Stack:
' delimiter is also questionableRed [] #system [memory-stats 3]
do/args %red.r "--release --debug %memtest.red" fails with PS C:\Users\Christian Ensel\Development\red-master> .\memtest.exe
====== Red Memory Stats ======
-- Node frames --
#1: used = 10000/10000 (100%), free = 0/10000 (0%)
#2: used = 424/10000 (4%), free = 9576/10000 (96%)
2 frames
-- Series frames --
#1: used = 1048520/1048576 (99%), free = 56/1048576 (1%)
- 05450014: size = 64000, offset pos = 0, tail pos = 25568 T
- 0545FA28: size = 53491844, offset pos = -88472092, tail pos = 4
*** Runtime Error 98: assertion failed
*** in file: /C/Users/Christian Ensel/Development/red-master/runtime/debug-tools.reds
*** at line: 194
***
*** stack: red/list-series-buffers 05450004h
*** stack: red/memory-stats 3memory-stats in a while?;; Create a couple of fairly small images:
im-1: to-image view/no-wait compose [box 500x500 red (copy/part mold system 4000 )]
im-2: to-image view/no-wait compose [box 400x400 blue (copy/part mold system 2000)]
save/as %image-1.jpg im-1 'jpeg
save/as %image-2.jpg im-2 'jpeg
unview/all
view/no-wait [im: image 200x200 count: text 100x50]
recycle/on
try [delete %log-file.txt]
n: 0
;; swap between the images until failure:
loop 5000 [
n: n + 1
count/text: rejoin [form n " " stats]
im/image: load/as %image-1.jpg 'jpeg
im/image: load/as %image-2.jpg 'jpeg
write/lines/append %log-file.txt count/text
recycle
]
print "worked this time" ;; be nice to see this message :)$ ./red-16jun22-15b93aff8 Gtk-Message: 14:32:15.045: Failed to load module "xapp-gtk3-module" Gtk-Message: 14:32:15.045: Failed to load module "xapp-gtk3-module" --== Red 0.6.4 ==-- Type HELP for starting information. >> system/build/date == 24-Jun-2022/12:28:44
port? not implemented into RED while PORT! is, it is correct?f1: func [/local data1 data2] [
data1: "hello" data2: none
f2 words-of context? 'data1 ;<--------- The difference is here
reduce [data1 data2]
]
f2: func [ctx] [
set next ctx reduce [uppercase get ctx/2 " world!"] ;next avoids /local
"DUMMY RETURN"
]>> f1 ["HELLO" " world!"] >>
f1: func [/local data1 data2] [
data1: "hello" data2: none
f2 context? 'data1 ;<--------- The difference is here
reduce [data1 data2]
]
f2: func [ctx] [
ctx: words-of ctx;<--------- The difference is here
set next ctx reduce [uppercase get ctx/2 " world!"] ;next avoids /local
"DUMMY RETURN"
]*** Internal Error: stack overflow *** Where: data1 *** Near : "hello" data2: none f2 context? 'data1 reduce *** Stack: probe f1 f2 words-of f2 words-of f2 words-of f2 words-of f2 words-of f2 words-of f2 words-of f2 words-of f2 words-of f2 words-of f2 words-of f2 words-of f2 words-of f2 words-of f2 words-of f2 words-of f2 words-of f2 words -of f2 words-of f2 words-of f2 words-of f2 words-of f2 words-of f2 words-of f2 words-of f2 words-of f2 words-of f2 w ords-of f2 words-of f2
ctx: words-of :ctx and it will be ok.context? and not the function itself. Changing it to ctx: words-of :ctx has solved.Gtk-Messages, but build date – it's different than filename. 16 vs 24 Jun.try/all functional? It looks that try catches these break, continue, exit, etc. exception any time. >> error? try [exit] == true >> error? try/all [exit] == true >>
>> ? try
USAGE:
TRY block
DESCRIPTION:
Tries to DO a block and returns its value or an error.
TRY is a native! value.
ARGUMENTS:
block [block!]
REFINEMENTS:
/all => Catch also BREAK, CONTINUE, RETURN, EXIT and THROW exceptions.
/keep => Capture and save the call stack in the error object.try/all is finetry/all, the try don't catch these exceptions:>> error? try [1 / 0] == true >> error? try [exit] ** Throw error: return or exit not in function
try/all could be removed in Red and Rebol should be able to catch these exceptions by default like Red does.try/all? And you don't have to send help on try. I'm not a newbie!>> do reduce [does [try [return 42]]] == 42 >> do reduce [does [try/all [return 42]]] *** Throw Error: return or exit not in function *** Where: return *** Near : 42 *** Stack: run eval-command do-command try-do
>> to-string quote a/b: == "a/b:" ;<-- keeps decoration >> to-string quote b: == "b" ;<-- removes decoration
form quote a/b: and to string! quote a/b: should remove the decoration like it is with set-words?email!, ref!, url!, tag! etc.?>> to-url quote a/b: == a/b: >> to-url quote a: == a
: is ok in urls refs emails tags>> to string! [(a b) [c d] e/f g h] == "a bc de/fgh"
"a b c d e/f g h" looks like better result :/^ behaves strangely when used in file:>> %^ == %"^" >> %"^" == %""" >> %""" *** Syntax Error: (line 1) invalid string at "
>> %"^"" *** Syntax Error: (line 1) invalid string at " *** Where: set *** Near : token/y *** Stack: load
--== Red 0.6.4 ==-- Type HELP for starting information. >> system/words/what *** Runtime Error 1: access violation *** at: 080943BBh
what by itself works fine.char! key into a map! it is always case-sensitive... as there is put/case available, I guess that put without /case should be insensitive:>> m: #() put m #"a" 1 put m #"A" 2 m
== #(
#"a" 1
#"A" 2
)>> m: #()
== #()
>> put m "ab" 'ab
== ab
>> put m "AB" 'AB
== AB
>> m
== #(
"ab" AB
)#"a" = # »A »is also true with R3f: func [ a /b arg-b word! "Should work?" /local ] [ either b [ probe a * arg-b ] [ probe a ] ]
/b has 2 arguments: arg-b and word!! is just a convention.>> f: func[word! [string!]][ probe word! ] == func [word! [string!]][probe word!] >> f "a" "a" == "a" >> f 1 *** Script Error: f does not allow integer! for its word! argument
word! and string! are just words like word and string.word! and not correct [word!], but it would be expensive.probe bound? to-lit-word word! == none
to-lit-word to-word word!
to-lit-word word!
bound? to-lit-word word! in Rebol2>> type? to-lit-word word! == word! ;<= should be lit-word! like in Rebol3 and Red
rebol > >> type? to-lit-word word! > == word! ;<= should be lit-word! like in Rebol3 and Red >
help on the function.invalid utf-8 encoding: #{A0D0A7FE} red-words: words-of system/words foreach [wordx] red-words [ probe wordx ]
RED: [ branch: "master" tag: #v0.6.0 ahead: 8140 date: 16-Jun-2022/2:23:20 commit: #15b93aff8e561de22905572ada060699eb3a4146 ] PLATFORM: [ name: "Windows 10" OS: 'Windows arch: 'x86-64 version: 10.0.0 build: 19044 ]
lunedì (Monday)pi@Pi4B:~ $ cat /etc/os-release PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)" NAME="Raspbian GNU/Linux" VERSION_ID="11" VERSION="11 (bullseye)" VERSION_CODENAME=bullseye ID=raspbian ID_LIKE=debian HOME_URL="http://www.raspbian.org/" SUPPORT_URL="http://www.raspbian.org/RaspbianForums" BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs" pi@Pi4B:~ $ getconf LONG_BIT 32 pi@Pi4B:~ $ Red/red --== Red 0.6.4 ==-- Type HELP for starting information. >> quit pi@Pi4B:~ $ Red/red-view Red/red-view: error while loading shared libraries: libcrypto.so.1.0.2: cannot open shared object file: No such file or directory
libcrypto.so.1.1 (libc6,hard-float) => /lib/arm-linux-gnueabihf/libcrypto.so.1.1
sudo ln -s /lib/arm-linux-gnueabihf/libcrypto.so.1.1 /lib/libcrypto.so.1.0.2
go use static link by default.libcrypto doesn't follow this rule. libcrypt and libcrypto are two different libraries.>> type? #[none] == none! >> type? #[none!] == datatype!
>> type? #[unset] == datatype! ;<--- I was expecting `unset!` >> type? #[unset!] == datatype!
>> find reduce [string! binary!] #[binary!] == none >> find [#[string!] #[binary!]] #[binary!] == none
find/only>> ? find
USAGE:
FIND series value
...
/only => Treat series and typeset value arguments as single values.and datatype in it>> type? #[unset] == datatype! ;<--- I was expecting `unset!`
--test-- "to-tag!-integer!" --assert <-1> = to tag! -1
> <-1> = to tag! -1 *** Script Error: <-1> has no value *** Where: = *** Near : <-1> = to tag! -1 *** Stack:
--test-- "#4781" --assert 3:3:3.3000000001 = transcode/one "3:3:3,3"
>> 3:3:3.3000000001 = transcode/one "3:3:3,3" == false >> transcode/one "3:3:3,3" == 3:03:03.3
--assert 3 = first transcode/one "3:3:3,3" --assert 3 = second transcode/one "3:3:3,3" --assertf~= 3.3 third transcode/one "3:3:3,3" 1e-12
mold pi is only displaying 15 significant digits "3.14159265358979" whereas the test is expecting 16 significant digits "3.141592653589793">> ls
README.gtk3
>> read %readme.gtk3
*** Access Error: cannot open: %readme.gtk3
*** Where: read
*** Near : %readme.gtk3
*** Stack:
>> read %README.gtk3
== {sudo apt install at-spi2-core #for Error retrieving accessibility bus address: org.freedesktop.DBu...
>> equal? %readme.gtk3 %README.gtk3
== trueblk: copy [1 2 3 4 5 6] insert blk skip blk -2 + length? blk probe head blk == [3 4 1 2 3 4 5 6]
== [5 6 1 2 3 4 5 6]
blk: copy [1 2 3 4 5 6] insert blk COPY skip blk -2 + length? blk probe head blk == [5 6 1 2 3 4 5 6]
null in this case.. but that does not exists in redbolone value, but none found)/next and /scan as well. /next has the same behaviorempty? input/next does the same thing.equal? %a %A ;== true yes, but also strict-equal? %a %A ;== false in OS independent ways. I don't think equal? returning true even on Linux is a contradiction to the fact that Linux allows them to be different files. And no contradiction in Windows not treating %a and %A as the same file either. As in both cases file names are compared, not files.load "" sets a precedent, does it not?transcode itself, without the refinement. /one means is the crux, as it's not clearly defined yet.one means exactly one valuetranscode "" always returns a block of zero or more values, one is unsuitable for zero casetranscode input as a series of transcode/one input: then /one on empty should be undefined, otherwise it breaks the model/next solves this, as does /scan, right? Following your logic, /next would throw an error at the end, meaning all transcode/next loops still have to check for empty input or handle the possible error if you go to the end. This is why I asked for use cases. How do we expect /one to be used?[] indefinitely)#[unset] is not good enough and there is no null type, than the only acceptable result (for me) would be:>> transcode/one "" ** Script error: out of range or past end
transcode/next "" imho.remove-each: the following gives an error>> a: [1 2 3 4 5] == [1 2 3 4 5] >> remove-each w a odd? w *** Script Error: w has no value *** Where: odd? *** Near : w *** Stack:
odd? w be in a block?t: func [ a /copy /local out-data o ] [ out-data: system/words/copy [] o: make object! compose/only [ copy: (copy) ] ] t2: func [ a /local out-data ] [ probe out-data: copy [] ] probe t [] probe t2 []
make object! [
copy: false
]
none
[]none should be [] but copy in the second function is none. The third [] should not exists.copy in the object of the first function, I get the correct result. o: make object! compose/only [ ;copy: (copy) ]
/copyso both copy and (copy) should not interfere with the global words.function which encloses both functions. It seems it makes copy: local. function would collect any set-word! even on prototypes keys in object creationfunc instead of function. Having nested functions and objects definition inside them, makes function really a plague! You must shield any block with set-word!s from binding, defining them in a word outside the function binding range and then reduce the word when needed. But then you loose the binding of the refinement word to the inner function and you must bind the block manually. OMG, you can go crazy with this!function/with in Rebol3, keeping my structures outside the function's block.context [structures... f: function [] [...]]word: [proto] setting operation and a small binding overhead. transcode/one, @oldes what are you using it for? Anyone else have use cases?; Trim because all spaces is like an empty string to transcode input: trim "your data here" ; Current design: choose empty default/logic as you wish val: either empty? input [none][try [transcode/one input]] if error? val [ ; Invalid data for sure ] ; New error proposal val: try [transcode/one input] if error? val [ ; Is the error because it's empty or invalid data? ]
Transcode takes an input, and we probably all agree that inputs should be checked. An empty input is a legal edge case. It is not an error. It's also not a value placeholder (unset). But it has to return something. Can't distinguish empty from #[none] if we go that way, which is an issue elsewhere (e.g. select). Today we can't tell "" from "[]" either.trim tags?>> input: trim <your data here> *** Script Error: trim does not allow tag! for its series argument *** Where: trim *** Near : <your data here> *** Stack:
one (next) value requested - condition that cannot be fulfilled by empty input.take returns none in this case though, understandably (still an error, but we chose to muffle it)translate in Rebol3. So my use case was to write test cases with acceptable results. I don't consider current Red result for this case correct, so I mentioned it here./error refine for relaxed behavior.. returning error instead of throwing it, so no need to use try. I'm on mobile now.. so no advanced example./line is new there, and I will have to make time to see what translate is. Thanks.d: [test: none] x: none set d/test 'x
none value globally.>> help load
USAGE:
LOAD source
DESCRIPTION:
Returns a value or block of values by reading and evaluating a source.
LOAD is a function! value.
...load itself.>> help layout Func spec couldn't be parsed, may be malformed. ...
[no-trace] ?? layouthelp issue.>> replace/all/deep "abc" [skip] "" *** Script Error: PARSE - matching by datatype not supported for any-string! input *** Where: parse *** Near : deep? *** Stack: replace also
any-list though.replace/all/deep "abc" ["b"] "" - works?>> about Red 0.6.4 for Windows built 14-Aug-2022/9:23:14+02:00 commit #4eb8ad8
system/view/silent?: yes system/view/auto-sync?: no view compose [ below inp: field 200 "pen green circle 30x30 20" focus on-key-up [out/draw: load inp/text show out] out: base do [out/draw: load inp/text] ]
silent? crashes it?Red []
system/view/silent?: yes
system/view/auto-sync?: no
text: "pen green circle 30x30 20"
view [
out: base rate 10 on-time [
remove skip text 4
out/draw: load text show out
]
]help issue before I'm back online I'll look into it.*** Access Error: cannot open: %"" *** Where: read *** Near : 'Red *** Stack:
not end before https://github.com/red/red/blob/58444429bcaf09ed4500496936a1c3657b533969/environment/functions.red#L758 will fix it?system/options/args returns [""] instead of `none.system/view/silent?, I don't know if this makes things easier or not but when I forgot to use compose:>> system/view/silent?: yes == true >> drawing: [pen green circle 30x30 20] == [pen green circle 30x30 20] >> view [ [ below [ inp: field 200 (form drawing) focus on-key-up [out/draw: load inp/text out] [ out: base draw drawing [ ] *** Throw Error: no catch for throw: silent *** Where: either *** Near : no *** Stack:
enter after a do/later and then stop in a subcall?>> to block! make vector! [2] == [2] >> >> to block! make vector! [] *** Runtime Error 98: assertion failed *** in file: /mnt/share/downl/red-master/runtime/allocator.reds *** at line: 903 *** *** stack: red/alloc-series-buffer 0 16 0 *** stack: red/alloc-series 0 16 0 *** stack: red/alloc-cells 0 *** stack: red/block/make-at 08920554h 0 *** stack: red/vector/to-block 08920564h 08920554h *** stack: red/block/to 08920554h 08920564h 5 *** stack: red/actions/to 08920554h 08920564h *** stack: red/actions/to* *** stack: red/interpreter/eval-arguments 08920544h F65B0A00h F65B0A00h 08920524h 00000000h 00000000h F67B0DF8h *** stack: red/interpreter/eval-code F67B0DF8h F65B09C0h F65B0A00h 08920524h false 00000000h 00000000h F67B0DF8h *** stack: red/interpreter/eval-expression F65B09C0h F65B0A00h 08920524h false false false *** stack: red/interpreter/eval 08920524h true *** stack: red/natives/catch* true 1 *** stack: ctx||495~try-do F7F8B808h *** stack: ctx||495~do-command F7F8B808h *** stack: ctx||495~eval-command F7F8B808h *** stack: ctx||495~run F7F8B808h *** stack: ctx||495~launch F7F8B808h *** stack: ctx||514~launch F7F8B214h *** stack: ***_start
do a script that opens a windowprint "" ; open console for debug view [text "Hello world!" button "Hi" [alert "All right"]]
help layout broke mid-December of last year.no-trace was added, which a patch was made for on 11-Jan-2022, but 'layout must not have been used when testing it.help can't parse func attributeshelp forgiving, but it points out why specs are important.>> ?? throw-on-error
throw-on-error: func [
{Evaluates a block, which if it results in an error, throws that error.}
[throw]
blk [block!]
][
if error? set/any 'blk try blk [throw blk]
get/any 'blk
]> print "" ; open console for debug > view [text "Hello world!" button "Hi" [alert "All right"]] >
ShowWindow SW_HIDE 0 Hides the window and activates another window.
>> a: context [x: none] >> a/x: func [x][] *** Script Error: a/x: is missing its x argument *** Where: x *** Near : [] *** Stack: x
Compiling to native code... *** Loading Error: file access error: %../image-utils.reds *** in file: %/D/devel/red/spaces/programs/datatypes/image.reds *** at line: 13
-r any script leads to this errordecode-attributs should be decode-attributes.help from:opt func-desc= opt func-attr=
opt func-attr= opt func-desc=
>> a: random "lak4tl24k43g3rvuj" probe reduce [random a random a] ["3342atvur4kl4jlgk" "3342atvur4kl4jlgk"]
random works in place, so by the time you probe, a still refers to the original series...both times. :^)>> a: random "lak4tl24k43g3rvuj" == "llk43kt4u2r3avgj4" >> reduce [x: random a y: random a] == ["vk3rl3kuj442atg4l" "vk3rl3kuj442atg4l"] >> same? x y == true
hash! table with this loop:table: make hash! [[a b c d e]] random-string: "lak4tl24k43g3rvuj" repeat idx 100000 [ random-string: random "lak4tl24k43g3rvuj" append/only table reduce [ random-string random-string random-string head insert copy [] idx random-string ] ]
>> random "lak4tl24k43g3rvuj" == "llk43kt4u2r3avgj4" >> random "lak4tl24k43g3rvuj" == "k3akjltv2u44l3g4r"
>> s: "lak4tl24k43g3rvuj" >> random s == "jlva32l44t3grk4uk" >> random s == "4vrgu24jl43katk3l"
random?random just modifies content of the series' datarandom/seed when you need consistent results and copy when you want a new series.>> s: "12345" == "12345" >> random/seed 1 >> random copy s == "52134" >> random copy s == "31425" >> random/seed 1 >> random copy s == "52134" >> random copy s == "31425"
random-string: function[/length len [integer!]][
len: any [len 8]
str: make string! len
loop len [append str to char! (47 + random 73)]
]>> s: "lak4tl24k43g3rvuj" reduce [random s random s] == ["kuglj3at432vlk4r4" "kuglj3at432vlk4r4"] ;------ In the console >> random s == "lg4ajurltkvk34243" >> random s == "t3r43kg42vlk4ajlu"
Random modifies (shuffles) the original series, why using it twice in a block does not modify the series and I get the same results in both first and second position?random s a second time in the console, you get a different resultb has two pointers to the same series data, which are modified by random. But this is not right group for this chat. It is basic working with series in redbol languages.>> s: "lak4tl24k43g3rvuj" random/seed 1 reduce [probe random s probe random s] "ll3v2ru4k34gkat4j" "4gvkuj4k3r2tlal43" == ["4gvkuj4k3r2tlal43" "4gvkuj4k3r2tlal43"]
random s a second time in the console, you get a different result>> s: "12345" random/seed 1 b: reduce [probe random s probe random s] "52134" "15324" == ["15324" "15324"]
>> s: "12345" b: reduce [probe append s "x" probe append s "y"] "12345x" "12345xy" == ["12345xy" "12345xy"]
>> s: "12345" random/seed 1 b: reduce [s s] == ["12345" "12345"] >> random s == "52134" >> random s == "15324" >> b == ["15324" "15324"]
copy when working with series.random modifies the series a second time, so that all results, being the same series are modified. In my code there are 4 random numbers but see just the last result in all (the last modification of the series).randomwas returning a new instance of the series, randomizing its content in the copy, and at the same time returning the same randomized original value when called again in the block.happend, I would still be entrapped. Redbol languages have multiple possible working scenarios you can imagine, because of the multiple ways things could be done. Maximum value of result (modified when series)Returns a random value of the same datatype; or shuffles seriesReturns a random value of the same datatype; shuffles the original series and returns it>> random a: "lak4tl24k43g3rvuj" == "llk43kt4u2r3avgj4" >> random b: "lak4tl24k43g3rvuj" == "k3akjltv2u44l3g4r" >> same? a b == false
a: "k3akjltv2u44l3g4r" [random a random a] would not modify the original series but it was generating the same random value when it encounters "k3akjltv2u44l3g4r" for the first time. Instead, as all the elements of the block were referring to the same string, the result of the last round of RANDOM was shown into all the elements of the block. This is the same output you have if the function would work not modifying the original string and genereating the same output when it is called over "k3akjltv2u44l3g4r" template I set options they are delete and overwritten by user options, is it by design?:system/view/VID/styles/ascroller: [ default-actor: on-change template: [ type: 'scroller size: 16x16 options: [direction: -2] ] init: [] ] view [ scrl: ascroller options [a: 1 b: 2] ] ?? scrl/options ; scrl/options: [a: 1 b: 2 style: ascroller vid-align: top at-offset: none]
options ?Options is just a piece of data like any other. There's is no built-in mechanism for templating or merging from VID. For now, the best you can do is document it for users, unless you want to do quite a lot of deep work on VID itself. In that case, the first thing to do is make a proposal to see if it may be accepted.libcrypto.so.1.1 if it's compiled with target -t RPi.>> f: func compose/deep [n [(number!)]] [? n] == func [n [make typeset! [integer! float! percent!]]][? n] >> f 10 N is an integer! value: 10
>> f: func compose/deep [n [(number!) (any-string!)]] [? n] ?? f f: func [n [make typeset! [integer! float! percent!] make typeset! [string! file! url! tag! email! ref!]]][? n] >> f "abc" N is a string! value: "abc"
helps problem>> f: func compose/deep [n [(number!) (number!) (number!)]] [? n] ?? f f: func [n [make typeset! [integer! float! percent!] make typeset! [integer! float! percent!] make typeset! [integer! float! percent!]]][? n] >> f 10% N is a percent! value: 10%
help should be adjusted to take such cases into account.>> o: object [x: 1 on-change*: func [w o n] [print mold/part context? w 200]]
== make object! [
x: 1
]
>> set o none
make object! [
datatype!: datatype!
unset!: unset!
none!: none!
logic!: logic!
block!: block!
paren!: paren!
string!: string!
file!: file!
url!: url!
char!: cha
== none
>> o
== make object! [
x: none
]
>> ;) 'x word was reported bound to `system/words`system/words is not a normal context, it serves as a first-class symbol table also. So every symbol gets an entry there (set to unset!) by default. It's an implementation choice (same as in R2, not sure if R3 changed it or not). Anyway, modules inclusion might change that implementation model eventually.>> to-word "googles" == googles >> skip tail words-of system/words -1 == [googles]
>> o/x: 1
make object! [
x: 1
]
== 1
>> set in o 'x 2
make object! [
x: 2
]
== 2
>> o/('x): 3
make object! [
x: 3
]
== 3set obj value also take words from object's context?on-change*, though it seems that can't be always [guaranteed](https://github.com/red/red/blob/master/modules/view/view.red#L422).Load has the following refinement: /unbound - Do not bind the blockred-word!s, they don't carry the binding info? I see _object/set-many just passes them as is to fire-on-set.copy-cell those slots instead of properly constructing them when needed. Also object events now could benefit from pre-bound words from context's symbols array.>> about Red 0.6.4 for Windows built 4-Sep-2022/12:59:01+02:00 commit #d85b2ef >> view [text "targets react to slider , slider reacts to field" bold font [size: 10]]
wrap flag that's the culpritdo [do [do [do [... crash I reported but can't find. And involves throw and certain stack depth.>> about Red 0.6.4 for Windows built 4-Sep-2022/12:59:01+02:00 commit #d85b2ef >> system/view/silent?: yes == true >> view [base (error)] *** Throw Error: no catch for throw: silent *** Where: either *** Near : no *** Stack:
>> type? http://http://http://@http://http://?http://#http:// ;== url! >> url-parser/parse-url http://http://http://@http://http://?http://#http:// ;== none
url! are simple, and don't match the RFC spec, which decode-url is meant to.none in that case, leaving it to the user to set if desired.>> m: #() >> k: 1 >> m/:k == none >> unset 'k >> m/:k *** Script Error: cannot access :k in path m/:k *** Where: catch *** Near : m/:k *** Stack:
k is unset or smth. Otherwise it looks as if I'm accessing an object, because map lookups are not producing errors usually. Had to double check that it's indeed a map.>> b: [] == [] >> k: 1 == 1 >> b/:k == none >> unset 'k >> b/:k *** Script Error: cannot access :k in path b/:k *** Where: catch *** Near : b/:k *** Stack:
win: view/no-wait [
p: panel 200x200 [box 100x100 blue box 100x100 red]
return
button "update"
on-up [
clear p/pane
append p/pane layout/only compose [box 100x100 (random white) box 100x100 (random white)]
p/visible?: true ; <-- this!
]
]a: 0.1 + 0.1 + 0.1 b: 0.3 ; than: equal? a b ;== true as expected ; but: lesser-or-equal? a b ;== false ?!
strict-equal? is not related to it. At least if the equality check in lesser-or-equal? is not supposed to be strict-equal as well.lesser-or-strict-equal?lesser-or-equal? and greater-or-equal?? Then you'll open another trap: both lesser-or-equal? and greater? could return true at for the same value.equal? ? :)lesser/greater+-or-equal? should be relaxed, as this makes things consistent. It does mean a different gap in logic, and we have to ask if that needs to be filled. We don't have to do it until someone complains, and that can also be worked around for those rare cases. While still awkward, those cases should be much rarer.a: 0.1 + 0.1 + 0.1 b: 0.3 true == equal? a b true == lesser-or-equal? a b true == greater-or-equal? a b true == not strict-equal? a b true == not lesser? a b true == not greater? a b
>> a: 1.0 == 1.0 >> b: to float! head change back tail to binary! a 1 == 1.0 ;) 1.0 + epsilon! >> b == a == false >> b < a == false >> b > a ;) greater? is already true == true
lesser-or-equal? will be true as well<= etc.) to be unidirectional?add or something :)<= and >= because almost equal numbers will satisfy both, provided their near equality is tested first. But in testing < one could also perhaps first test = (with deviation allowed) and if that is true, < will be false; i it is not true, only then < will be tested.<= problem.>> a = b == true >> a <= b == false
= is relaxed but <= isn't.<=/>= that people need to be aware of. Is it *enough* to warn them? I'd still love, if we can link static bits in the future, to try dropping in Crockford's ASM-sourced DEC64 for decimal! use, to see how it fares in real use. Nothing is perfect, but having different rules for different numeric types is a recipe for human error...on top of FP errors. :^)<= < > >= operators (or at least functions). It will be a bigger mess than just = ==a >= b we'll write to logic! any [a == b a > b], nice, especially for library code ;).1 + .1 + .1 <> .3.opt port part wrong.Expected: foo://example.com:/over/there?# Got: foo://example.com/over/there?# Expected: telnet://192.0.2.16:/ Got: telnet://192.0.2.16/
§3.2.3 says "URI producers and normalizers should omit the port component and its ":" delimiter if port is empty or if its value would be the same as that of the scheme's default." We don't have defaults for schemes, so will only worry about the missing port case. That makes round-tripping lossy, as the ":" will go away if no port is specified. The alternative is to include the colon but still omit the port. Since it still meets the RFC spec for the URL grammar, and we aren't technically a normalizer, that seems best. But it's problematic as we don't have a reference URL, so can't know if it was included to start.
< and <= I care about strictness, even though it's just one unlikely value of difference. Sorry but this is not serious proposal at all. You are for example suggesting that 1e-20 <= 1e-300 and 1e-20 >= 1e-300 at the same time. Or that 1e-20 is not positive? nor negative? number, but zero?. So 1 / 1e-20 should also be not negative not positive, but infinite (of undetermined sign, so maybe a NaN?). And so on.= just doesn't work.assertf~= function, with about the same tolerance, not equality.pair! type is in a transition state, until we decide if/how to support floats in pairs (or in a new datatype).decimal! datatype. I'm very sceptical of DEC64 after seeing the horrifying math issues with DEC32. There's a good reason no language adopted that format for his number type.float! and not decimal!. Yes! But let's make people *choose* to use them, and offer something better.money!, but percent! is a float under the hood. unview/all view/no-wait [
rich-text 100x100 data [
font 9 i "" /i /font
]]
*** Script Error: f has no value
*** Where: either
*** Near : f
*** Stack: view layout fetch-options rtd-layout pop cause-error>> f: function [w] [a: 1 b: 2 get select #(x a y b) w] >> f 'x *** Script Error: a has no value *** Where: get *** Near : get select #(x: a y: b) w *** Stack: f
>> f: function [w] [a: 1 b: 2 get bind select #(x a y b) w :f]
== func [w /local a b][a: 1 b: 2 get bind select #(
x: a
y: b
) w :f]
>> f 'x
== 1map! is not a data-structure primarily used for representing code to evaluate, so it does not get automatically bound to local contexts like for any-block! series.save/as "" system 'redbin *** Access Error: cannot decode or encode (no codec): routine ["Internal Use Only"][bool: as red-logic! stack/arguments bool/header: T
system.decode-url:string! but always return none: >> decode-url "http://example.com" ; == none (regression?)decode-url directly calls parse-url which has throw-error refinement, wouldn't be nice to have that refinement on decode-url?parse-url molds the arg, whether it's a string or not. mold is there because form doesn't hex-encode URLs, but if it's given a string, can we all agree that it's on the user to ensure they are hex-encoded, or do we drop string support?decode-url is meant to be higher level, and exists mainly as a name to balance encode-url, so I don't think we need to expose the refinement there. Do you have a specific use case where that seems better than using parse-url directly?parse-url directly.string! support from parse-url, but would be ok to keep it in decode-url high level function. And instead of mold, to url! can be used if the argument is a string!.parse-url?area face that has enabled? set to false does not allow scrolling. I use such a face to display search results and I don't want the user to modify these, but when there are more results than fit in the visible area, I want the user to be able to scroll down. Do we have a bug or a feature here?field is a single line edit box, it's not supposed to support vertical alignmentarea we should ask @qtxie if it's even possible to scroll a disabled controltext in a scrollable panel insteadtext is dumb though, I can't seem to make it autosize itself properlyview [field "abcd"]txt: " this text^/should be^/ readable" img: draw 70x70 drw: compose [text 8x10 (txt)] view [image 70x70 draw drw image 70x70 with [image: img]]
rich-text, so it can't work without View. We could maybe in the future isolate that API, so that it could be used without View, as we do for images.draw size-text r: rtd-layout ["a"] compose [text 0x0 (r)] but seems like extra work.to-image will use face's size rather than size-text...none.> >> to-image rtd-layout ["a"] > == none >
view and produce an image?rich-text use D2D to draw the content. While the OS API used in to-image only works on native controls. I'll see how to support it.draw size-text r: rtd-layout [ red "a" ] compose [text 0x0 (r)]Red [ ] home: select list-env "HOME" home: select list-env "USERPROFILE" appDir: to-file rejoin [home "/Programmation/Red/BabyCry/code/"] print ["App Dir: " appDir] change-dir %.. print pwd change-dir appDir
*** Access Error: cannot open: %"/C/Users/fjouen/Programmation/C:\Users\fjouen/Programmation/Red/BabyCry/code/" *** Where: do *** Near : print pwd change-dir appDir *** Stack: change-dir cause-error
to-red-file to convert filenames to an interchangeable representation>> m: #(a b)
== #(
a: b
)
>> keys-of m
== [a]
>> foreach [k v] m [?? k]
k: a:m/(quote a:) after all.index? is only defined on series .... So would it not be better to throw an error when used on a map, rather than the current odd behavior?
`index? word returns word's offset in the object where it's boundview [rich-text "abcdefghij" data [3x4 bold 5x4 underline]]
>> view [rich-text data ["ab" b "cd" u "ef" /b "gh" /u "ij"]] *** Script Error: RTD - invalid syntax at: [/b "gh" /u "ij"] *** Where: do *** Near : spec: fetch-options face opts style spec *** Stack: view layout fetch-options rtd-layout cause-error
ab cd ef gh ? It looks like an unnecessary complication to me.>> parse [1 a] [collect [keep set x integer! (?? x) keep set x opt integer! (?? x)]] x: 1 x: none == [1]
keep collect none instead of the empty block?keep is block oriented, so maybe not.AB CD EF GH is handled by the Adoption Agency Algorithm which would, as speculated, resolve to AB CD EF GH.[2x7 bold italic] and so on. tag [is described as](https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-b-element) _"The b element represents a span of text to which attention is being drawn for utilitarian purposes without conveying any extra importance and with no implication of an alternate voice or mood, such as key words in a document abstract, product names in a review, actionable words in interactive text-driven software, or an article lede."_ above _"[The i element](https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-i-element) represents a span of text in an alternate voice or mood, or otherwise offset from the normal prose in a manner indicating a different quality of text, such as a taxonomic designation, a technical term, an idiomatic phrase from another language, transliteration, a thought, or a ship name in Western texts."_ 🙂)-d option-r -e -d flags and run the exedo your script or pass it as an argument to console exe*** Runtime Error 1: access violation *** in file: /e/red/red/modules/view/backends/windows/gui.reds *** at line: 146 *** *** stack: gui/get-face-values 00210BBEh *** stack: gui/paint-background 00210BBEh 50011627h *** stack: gui/render-base 00210BBEh 50011627h *** stack: gui/WndProc 00210BBEh 20 1342248487 0
base is involved>> cs1: charset [31]
>> cs1/31: off
>> cs1
== make bitset! #{00000000}
>> cs1 = charset []
== falsecs1 = make bitset! length? cs1). == may still perform fast equality then. <= >= not sure.cs-3: make bitset! auto-trim? I don't think so. If so, it does nothing but inefficiently. :^)cs: charset [100000] then cs/100000: off will have to scan all bits to determine the new (zero) length. So this only takes care of the allocations.trim it when needed :)>> about/debug -----------RED & PLATFORM VERSION----------- RED: [ branch: "master" tag: #v0.6.4 ahead: 4573 date: 23-Nov-2022/3:49:21 commit: #ee723a91c5007c4338b8252956063dcd668cf012 ] PLATFORM: [ name: "Windows 10" OS: 'Windows arch: 'x86-64 version: 10.0.0 build: 19044 ] -------------------------------------------- >> m: make map! [0 0 1 1 2 1] *** Syntax Error: (line 1) invalid integer at 0 0 1 1 2 1] *** Where: set *** Near : transcode/trace buffer :delimiter-lex
>> about
Red 0.6.4 for Windows built 29-Dec-2022/13:00:14-07:00 commit #6af0b70
>> m: make map! [0 0 1 1 2 1]
== #(
0 0
1 1
2 1
)m: make map! [00 1 1 2 1] thought it was weird makes a little sense now. looks the same in view. not my first utf copy & paste bug. sorry