attempt [load compress "hello"]
*** Access Error: invalid UTF-8 encoding: #{8B000000}
; the ATTEMPT was not trapped, and now system/words is partially inaccessible:
system/words
*** Access Error: invalid UTF-8 encoding: #{8B000000}
recycle
system/words
== make object! [...]read http://www.repubblica.it and similar with latest Red, I get a read timeout. It should be connected to the Italian language of the page, any hint to debug it?invalid UTF-8 encodingread/lines thoughread/lines, it times out now.>> read/lines https://www.repubblica.it
== ["<!DOCTYPE html>" {<html class="no-js" lang="it">} " <head>" " <meta chars.../lines.read/lines:>> x: read/lines http://www.ilmessaggero.it *** Access Error: cannot connect: http://www.ilmessaggero.it reason: timeout *** Where: read *** Stack:
>> x: read/lines http://www.ilmessaggero.it
== [" <!doctype html>" {<html lang="it">} "<head>" {<meta http-equiv="content-language"...
>> about
Red 0.6.4 for Linux built 25-Dec-2020/10:51:48>> %{}%%
{ }%
{ }%
{cd is wrong in using get-word? change-dir: func [
"Changes the active directory path"
dir [file! word! path!] {New active directory of relative path to the new one}
][
unless exists? dir: normalize-dir dir [cause-error 'access 'cannot-open [dir]]
system/options/path: dir
]
>> source cd
cd: func [
"Changes the active directory path"
:dir [file! word! path!] {New active directory of relative path to the new one}
][
change-dir :dir
]cd is a shortcut for use in terminal:dir?file! syntax. e.g. cd %... The more we think in terms of Red values, the more power we can leverage.% curl -fsSL https://static.red-lang.org curl: (35) error:1408F10B:SSL routines:ssl3_get_record:wrong version number
SSLv2 not offered (OK) SSLv3 not offered (OK) TLS 1 offered TLS 1.1 offered TLS 1.2 offered (OK)
openssl s_client -connect static.red-lang.org:443 -status to see what protocol is used on your system.curl --version to validate, that your libcurl is not too old.curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.9 libidn2/2.3.0 libpsl/0.21.0 (+libidn2/2.3.0) libssh/0.9.3/openssl/zlib nghttp2/1.41.0 librtmp/2.3 Release-Date: 2020-01-08 Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp Features: AsynchDNS brotli GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets
% openssl s_client -connect static.red-lang.org:443 -status CONNECTED(00000003) 140166965028160:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../ssl/record/ssl3_record.c:331: --- no peer certificate available --- No client certificate CA names sent --- SSL handshake has read 5 bytes and written 320 bytes Verification: OK --- New, (NONE), Cipher is (NONE) Secure Renegotiation IS NOT supported Compression: NONE Expansion: NONE No ALPN negotiated Early data was not sent Verify return code: 0 (ok) ---
docker run -it --rm ubuntu:groovynot here on https://static.red-lang.org/ page.https://static.red-lang.org/dl/win/red-064.exe and result is same)squares: make image! 2x2 squares/1: red squares/2: green poke squares 3 blue poke squares 4 yellow view layout [ image squares 100x100 ]
a: make object! [
s: copy []
empty?: function [return: [logic!]] [
return empty? s
]
]
a/empty?;; No warning when too little arguments (i.e. misuse on-change* signature)
obj: make object! [
a: "Obj"
s: copy []
on-deep-change*: function [word old new][
print ["Hello:"]
print "Word" probe word ; word is owner
]
]
append obj/s 1
;; No warning either when too many arguments ...
obj: make object! [
a: "Obj"
s: copy []
on-deep-change*: function [owner word target action new index part one-too-many][
print ["Hello:"]
print "Owner" probe owner
print "Word" probe word
print "One too many" probe one-too-many
]
]
append obj/s 1a: "foo"
ca: compress a
dca: decompress ca
probe dca ; #{666F6F} and not "foo"
print to-string dca ; there it is
equal? dca a ; strange !
strict-equal? dca a ; stranger !on-deep-change I commented and closed the ticket before seeing the chat here. @hiiamboris are there other cases where this kind of thing is caught, or how would Red do that without significant changes (or checking the arity of the callback func before calling it every time)?one-too-many case, I'd have to look at the calls to on-deep-change to see why it gets none rather than unset, which would trigger an error.function/calc-arity is used when objects are made. But you could replace the callback func, so it would still have to check every time.obj: make object! [
a: "Obj"
s: copy []
on-deep-change*: function [owner word target action new index part][
print "Old"
]
new-on-deep-change*: function [owner word target action new index part one-too-many][
print "New"
]
]
append obj/s 1
obj/on-deep-change*: :obj/new-on-deep-change*
append obj/s 2return or exit not in function is thrown in the event handler of a view.*** Throw Error: return or exit not in function *** Where: return *** Stack: do-file run view do-events do-actor do-safe error? on-expression-update as-string rejoin empty? compute _compute-rec _compute-rec _compute-rec _compute-rec
on-deep-change here are some thoughts:try reboot and recent VID layout work and some reactivity stuff as well), but I don't remember if you tackled ownership yet. If so, point us to it.on-deep-change*: func [ owner [object!] word [word!] target [series!] action [word!] new [any-type!] index [integer!] part [integer!] ][...]
word/action or index/part), and new is a wildcard as well, but this comes for free right now.(expr) vs expr tells me that it's a bug indeed, so worth a mention therea: context [
r: [ "1" | "2" ]
]
parse "1" a/r ; (1)
b: context [
r: [ a/r ]
]
parse "1" b/r ; (2)
c: context [
ra: a/r
r: [ ra ]
]
parse "1" c/r ; (3)[... (word: rule1) if match (word: rule2) word ...]word for it is yours to changeparse data compose/deep/only [... (my/path/rule)...] btwparse in general, even if you never use them. If it's half the speed and everybody takes a hit but it's only used in 1% of cases, then it's a valid concern.parse language playtime experiments was a Logo interpreter. I stumbled on things the same way, falling out of my chair when I realized I could parse a func spec and immediately add it to the block of rules.lo: copy [] loop 10 [append lo compose [at (random 200x200) box loose 100x100 (random 200.200.100) on-over [do make-top face]]]
make-top: func [
face [object!]
/local
parent z-index
][
parent: face/parent
z-index: find parent/pane face
if last? z-index [exit]
remove z-index
append parent/pane face
]
view/no-wait lomake-top: func [
face [object!]
/local
parent z-index
][
parent: face/parent
if parent/extra [ wait 0.01 if parent/extra [exit]] ;; wait or yield
parent/extra: true
z-index: find parent/pane face
if last? z-index [parent/extra: false exit]
remove z-index
append parent/pane face
parent/extra: false
]
view/no-wait lolo: copy [] loop 10 [append lo compose [at (random 200x200) box loose 100x100 (random 200.200.100) on-over [do make-top face]]]
make-top: func [
face [object!]
/local
parent z-index
][
parent: face/parent
z-index: find parent/pane face
if last? z-index [exit]
move z-index tail parent/pane
]
view/no-wait lolo: copy [title "hiiamboris + n count"] loop 10 [append lo compose [at (random 200x200) box loose 100x100 (random 200.200.100) on-over [do make-top face]]]
make-top: func [
face [object!]
/local
parent z-index n
][
n: []
append n 1
parent: face/parent
z-index: find parent/pane face
print [length? n index? z-index] ;; print Nth invocation + z-index of box being topped
if last? z-index [exit]
move z-index tail parent/pane
]
unview/all view/no-wait lolo: copy [title "hiiamboris + n count"] loop 10 [append lo compose [at (random 200x200) box loose 100x100 (random 200.200.100) on-over [do make-top face]]]
make-top: func [
face [object!]
/local
parent z-index n rec
][
n: []
append n 1
parent: face/parent
z-index: find parent/pane face
print [length? n index? z-index] ;; print Nth invocation + z-index of box being topped
if last? z-index [exit]
move z-index tail parent/pane
rec: parent/pane
forall rec [rec/1/text: form index? rec] ;; label boxes with their z-index value
]
unview/all view/no-wait lomove z-index back back tail parent/pane
face-to-screen from here https://gitlab.com/hiiamboris/red-mezz-warehouse/-/blob/master/relativity.red probe to-file location: "C:\Users\xxx\AppData\Local\Google\Chrome\User Data\Profile 1\bookmarks"
%"C:\Users\xxx\AppData\Local\Google\Chrome\User Data\Profile 1\bookmarks"
to-red-file C:\ has been properly converted
`to-file and `to-red-file.to file! has only to do with the datatype, not the local file/path format.access violation but I've seen other messages too. Unfortumately the crash is hard to reproduce as it takes a lot of time before it happens.access violation error) that are also downloading. I believe that consoles not downloading are running fine.send-request rewritten for new IO I can test it.unset 'do-it unview/all view [box "click" on-up [do-it]]
>> a: object [s: next "abc"]
>> b: copy a
>> c: make a []
>> head a/s
== "abc"
>> head b/s
== "abc"
>> head c/s
== "bc"
>> c: make a [probe head s]
"bc" ;-- truncated before user code evaluates
== make object! [
s: "bc"
]>> help any-type! ANY-TYPE! is a typeset! value: [datatype! unset! none! logic! block! paren! string! file! url! char! integer! float! word! s
s? And why the block is not closed?read-thrufile! datatype... like this one:>> %aaa\ == %"aaa\" >> dir? %aaa\ == false
%20 in them is very, very human unfriendly. >> dir? %aaa\ == true
dir??>> make-dir %new-dir ;<---- path accepted without a slash (OK) == %new-dir/ >> exists? %new-dir ;<---- path accepted without a slash (OK) == true >> delete %new-dir == false ;<----------- not deleted! (BUG) >> delete %new-dir/ == true
to-red-file.>> read %"r:\" ;<---- using file path in system format! == [%"System Volume Information/" %Temp/ %VS_Fallback/ %x.png %xx/]
red >> dir? %"r:\Temp\" == false ;<---- not recognized as a DIR... ;... but accepted by READ >> read %"r:\Temp\" == [%0600fd54-a93d-491e-8817-cbb2795e263e.tmp %0ada0c50
dir? checks for slash at tail (which my local version obviously extends to backslash as well ;^)./ is not a *back*slash ;)file! it should work with files of any format.file! is normalized like in Rebol:>> %path\ == %path/
url! the _backslash_ is not for dirs.dir? track with underlying I/O API use. e.g. in R2 it asked the OS if the thing was actually a dir, not just a string that looked like one.>> %aa/bb\cc == %"aa/bb\cc"
dir? - if we make it accept \, we will want the same for split-path, clean-path and others, increasing overall complexity and pushing the problem aroundto>> ? any-type!
ANY-TYPE! is a typeset! value: [datatype! unset! none! logic! block! paren! string! file! url! char! integer! float! word! set-word! lit-word! get-wor
>> help-string any-type!
== {ANY-TYPE! is a typeset! value: [datatype! unset! none! logic! block! paren! string! file! url! char! integer! float! wo...
>> print help-string any-type!
ANY-TYPE! is a typeset! value: [datatype! unset! none! logic! block! paren! string! file! url! char! integer! float! word! set-word! lit-word! get-worhelp's fault. @hiiamboris @qtxie worked on a console issue recently, which I thought was resolved, but the above is from a fresh build here.>> probe help-string any-type!{ANY-TYPE! is a typeset! value: [datatype! unset! none! logic! block! paren! string! file! url!^/}help.help-string?what/buffer and help-string are not really meant for normal use. Help in general is console oriented, so the goal is to present information in the console. We did add the ability to get those formatted results for tools to leverage.root: 7669/106222, runs: 4, mem: 7618812 *** Runtime Error 1: access violation *** in file: /mnt/share/prj/x3m/wallet2/allocator.reds *** at line: 461 *** *** stack: red/update-series F45D5B1Ch 2867320 1103392 *** stack: red/cross-compact-frame F4760004h 084C4648h *** stack: red/collect-frames 1 *** stack: red/collector/do-mark-sweep *** stack: red/collector/do-cycle *** stack: red/alloc-series-buffer 48 1 0 *** stack: red/alloc-series 48 1 0 *** stack: red/alloc-bytes 48 *** stack: red/binary/do-math 7 *** stack: red/binary/xor~ *** stack: red/actions/xor~*
allocator.reds in this folder anway)recycle very hard for almost three minutes and no crash! :-)view [base 80x210 snow draw [fill-pen off translate 40x15 shape [move 0x-10 line 30x0 0x10 -30x0] ]] close keywordis is escaping help?>> help is x *** Script Error: is does not allow word! for its 'field argument *** Where: is *** Stack:
is is unique here. loop 1000 [
print xx: to-binary random/secure 31415926535
attempt [load xx]
mold system/words ;; trigger error if system/words is now messed up
]>> transcode #{8B}
*** Access Error: invalid UTF-8 encoding: #{8B000000}
*** Where: mold
*** Stack:
>> system/words
*** Access Error: invalid UTF-8 encoding: #{8B000000}system/words.transcode in this case, but from mold:>> transcode #{8B}
*** Access Error: invalid UTF-8 encoding: #{8B000000}
*** Where: mold
*** Stack:
>> error? try [transcode #{8B}]
== false>> transcode #{42137E26C646365C}
*** Syntax Error: (line 1) invalid character at \
*** Where: transcoderecycle mold system/words == "make object! [...]"
>> sort ["água" "azedo" "Casa" "carro"] == ["azedo" "carro" "Casa" "água"]
["água" "azedo" "carro" "Casa"]strcoll instead of cmpfunc(?)>> about/debug
-----------RED & PLATFORM VERSION-----------
RED: [ branch: "master" tag: #v0.6.4 ahead: 3581 date: 5-Feb-2021/0:06:04 commit: #6440af53301c09ea21166d320b1045d9548e0469 ]
PLATFORM: [ name: "Linux Mint 19.3" OS: 'Linux arch: 'x86_64 version: 5.4.0 build: {#73~18.04.1-Ubuntu SMP Tue Jan 19 09:02:24 UTC 2021} ]
--------------------------------------------sortsort/compare ["água" "azedo" "Casa" "carro"] func [a b][a/1 > b/2]sort/compare [stuff...] func [a b][a < b] etcstrcoll is on Windows, but we need to be portable. Unfortunately, there are two right answers for sorting: ordinal and linguistic (locale based). From a quick search, there are also locale-invariant considerations. As @hiiamboris notes, the best way to start on this is a custom comparison. transcode, load/trap doesn't work anymore. >> load/trap {a: [}
== [[a:] "" make error! [
code: 201
type: 'syntax
id: 'missing
arg1: #"]"
arg2...transcode/trace can be used, but that's a bit more work`prin ""Red 0.6.4 for Windows built 28-Jan-2021/14:26:17+03:00 commit #bae0c34 though it shouldn't matter>> parse to binary! "a" ["a"] == true >> parse "a" reduce [to binary! "a"] == false
print to the does block, it blows up. Known?book: object [
title: author: none
list-fields: does [print words-of self]
]
book/list-fieldsdoes [words-of self]>> cd .. == %/ >> ls bin/ dev/ srv/ boot/ lib64/ mnt/ lib/ swapfile media/ cdrom/ home/ proc/ run/ sbin/ sys/ var/ tmp/ root/ usr/ lost+found/ opt/ etc/ >> pwd %/ >> cd root *** Access Error: cannot open: %/root/ *** Where: set-current-dir *** Stack: cd change-dir >> pwd %/root/
%/root/delete %not-existing-file now returns false instead throwing an error, I still believe, that it _should_ throw an error, if the file exists and cannot be deleted (rights, locked..).load {%"} crashes Red. Affects trying to type file! values into fields.b: [] repeat i 2'000'000 [append b rejoin ["aoofhoahohd" i]]>> loop 5 [probe dt [save/as %111 b 'redbin]] 0:00:18.2836 0:00:09.13954 0:00:08.97996 0:00:08.97397 0:00:09.48476 == 0:00:09.48476 >> loop 5 [probe dt [load/as %111 'redbin]] 0:00:15.0108 0:01:24.0658 0:01:35.6338 0:01:32.5812 0:01:35.375 == 0:01:35.375
recycle call never returns, so I'm not using it. That smells like a bug btw.about typed in the console?Red 0.6.4 for Windows built 25-Feb-2021/1:27:54+01:00 commit #0645c80>> loop 5 [probe dt [save/as %111 b 'json]] 0:01:11.1895 0:00:11.2962 0:00:11.6351 0:00:11.9162 0:00:11.6467 == 0:00:11.6467 >> loop 5 [probe dt [load/as %111 'json]] 0:00:29.9287 0:00:28.6335 0:01:29.7587 0:02:36.5228 0:01:28.7192 == 0:01:28.7192
anon: func [val][
alpha: "aieouAEIOU bcdfghlmprst BCDFGHLMPRST"
copy/part random rejoin [val alpha] length? val
]
rule: [
some [
[{"guid": "} | {"name": "} | {"url": "}]
st: copy tmp to {"} change st (anon tmp)
| skip
]
]
;s: read %bookmarks
;print parse ss: copy s ruledo %mytest.r, so I suppose the second icon is the effect of a second process being run. Then the huge workload blocks the draw engine from removing it. When the append loop ends, the second icon is removed.copy. So the array is increasing its size of 2.000.000 string for each round. While you would expect similar results, the last round takes **19 times** than the first one. How many times should I loop generate array? > 6 How many times should I loop redbin-save? > 1 generate array: cycle # 1 Time: 0:00:19.7088 generate array: cycle # 2 Time: 0:00:50.4766 generate array: cycle # 3 Time: 0:01:45.3246 generate array: cycle # 4 Time: 0:03:03.3033 generate array: cycle # 5 Time: 0:04:47.9442 generate array: cycle # 6 Time: 0:06:33.0716 save-redbin: cycle # 1 Time: 0:01:28.4641
CLEAR on the array, it has ended immediately, then a manual recycle.. the result is interesting: the console is frozen and I am actually seeing the used memory by the red task going down on a 2MB rate per second. It will take at least 10 minutes to garbage collect everything. recycle)recycle process, I can see it in my inner task manager ;-)b: copy [] at the start of each loop:How many times should I loop generate array? > 6 How many times should I loop redbin-save? > 1 generate array: cycle # 1 Time: 0:00:18.2067 generate array: cycle # 2 Time: 0:00:35.351 generate array: cycle # 3 Time: 0:00:21.2558 generate array: cycle # 4 Time: 0:00:21.3288 generate array: cycle # 5 Time: 0:00:20.8471 generate array: cycle # 6 Time: 0:00:42.6395 save-redbin: cycle # 1 Time: 0:00:12.7431
b: clear head b recycle
>> help stats/info *** Script Error: unsupported type in stats/info get-path *** Where: get *** Stack: help help-string >>
help ticket. For the others, we need a simple test case to reproduce. GC issue is probably not a bug. It's designed to run periodically, so as not to stop the world. Allocations are made for Red which can release the memory, but that doesn't mean the OS will reclaim it if it's not needed. help stats. help does not support paths that form functions with refinements. The actual issue boils down to:>> :append/only *** Script Error: unsupported type in :append/only get-path *** Where: catch *** Stack:
help should ignore the refinement part or provide more helpful error information.>>help my-horrible-mess/messier-inside/a-messy-object/process/with You got yourself into this mess.
SAVE on ss: otherwise I will loose the work.random on the first pass but wanted to provide more anonymity) it would lighten the load by not having to shift the big string.RECYCLE/OFF and let see if it will be placed on the second core and if it will surpass the first one. print refresh it.do-events from every print is likely to hang in a lot of cases. And since GUI console is a regular View window it has no other way to update itself in current design.do-events/no-wait command then ;)anon function, forgetting it was used by the parse routine. In this situation, each match in parse would be set to "none".>> do %prj-bookmarks/anonymize.r DT Result: 9:17:36.5448 >> write %definitive.txt ss *** Internal Error: not enough memory *** Where: write *** Stack:
recycle/off)rule: [
some [
[{"guid": "} | {"name": "} | {"url": "}]
st: copy tmp to {"} change st (anon tmp) ;skip
| skip
]
]rule2: [
some
[
1 {"} 1 [{guid} | {name} | {url}] 1 {": "}
st: copy tmp to {"} change st (anon tmp) ;skip
| skip
]
]rule3: [
some
[
{"} [{guid} | {name} | {url}] {": "}
st: copy tmp to {"} change st (anon tmp) ;skip
| skip
]
]change in the parse rule but instead build a new data using append... ideally writing the new data into file directly and so save some memory.to end performance issue.. it wad reproducible in simple one liner.. so no need of huge data.Load/as xx 'json returns an error? value as result.read working?change is inexplicably slow.anon: func [val][
;RED
;alpha: "aieouAEIOU bcdfghlmprst BCDFGHLMPRST"
;xx: copy/part random rejoin [val alpha] length? val
xx: random val
change/part st xx en
]
rule3: [
some
[
{"} [{guid} | {name} | {url}] {": "}
st: copy tmp to {"} en: (
;Uncomment for debugging. It shows the string before and after the first
catch position
;probe copy/part skip st -20 skip st 20
;Checks for empty string "", otherwise anonymize
if (index? st) < (index? en) [anon tmp]
) skip
| skip
]
]
source-file: %bookmarks
s: read source-file
ss: copy s
parse/all ss rule3en defined by rule3change in parse. I will investigate and report. Start Time: 27-Feb-2021/23:54:51+01:00 "-- start read file--" Source-size: 91265933 Characters to-scan: 1000 time: 0:00:00 "-- start read file--" Source-size: 91265933 Characters to-scan: 10000 time: 0:00:00.0040034 "-- start read file--" Source-size: 91265933 Characters to-scan: 100000 time: 0:00:00.064964 "-- start read file--" Source-size: 91265933 Characters to-scan: 500000 time: 0:00:01.17734 "-- start read file--" Source-size: 91265933 Characters to-scan: 1000000 time: 0:00:04.99314 "-- start read file--" Source-size: 91265933 Characters to-scan: 2000000 time: 0:00:23.0888 "-- start read file--" Source-size: 91265933 Characters to-scan: 3000000 time: 0:00:53.2765 "-- start read file--" Source-size: 91265933 Characters to-scan: 4000000 time: 0:01:49.5493 "-- start read file--" Source-size: 91265933 Characters to-scan: 5000000 time: -23:57:10.2192 (halted)
DT not recognizing this? If someone confirm we have "the cinderella bug"* :-)use-change: true to false to obtain the find speed without change. use-change: false, on pure find, speed result is Rebol being 5x faster on the average, peaking at 6xSource-size: 91286172 Characters to-scan: 5000000 time: 0:00:01.06039
Source-size: 91331302 Characters to-scan: 5000000 time: 0:00:00.156
:, \ and what is before the first :. I will change only numbers with numbers and alphabetic characters with other of the same type (Am I missing something?) / is a problem. If you just use alpha chars, it should be fine.url-parser used by decode-url is probably what you're after.[one, two three\]load/trap, at least for now, but you can [roll your own](https://gist.github.com/greggirwin/91dc025b1c25b9efc24996af0207bde2). @toomasv has a tweaked version as well, depending on your needs.>> show-nice-trap-info load-trap "[one, two three\]" So far I loaded 0 values The last of which are [] But I stopped parsing after "one" On line 1 Where I thought I found a word! But then saw ", two three\]"
pre-load patterns people could use on their non-Red data that would make it Red friendly. view/flags/options [
origin 0x0
at 0x0
button "click to close" [
print reduce [
"button/offset:" face/offset ; -1x-1
"window/offset:" event/window/offset ; 0x0
]
unview
]
][] [offset: 0x0]view [
button "Window"
[
pos: ( event/offset + face/offset + event/window/offset )
print reduce [
"w2/offset:" pos
]
view/flags/options [
button "Close" [
print reduce [
"w2/offset:" event/window/offset
]
unview
]
][
;no-title no-border no-buttons
][
offset: pos
]
]
button "Close" [ unview ]
]view [
button "Window"
[
pos: ( event/offset + face/offset + event/window/offset )
print reduce [
"w2/offset:" pos
]
view/flags/options [
button "Close" [
print reduce [
"w2/offset:" event/window/offset
]
unview
]
][
no-title no-border no-buttons
][
offset: pos
]
]
button "Close" [ unview ]
]offset: facet. I raised the question in https://github.com/red/red/issues/4270 but didn't receive an answer.( event/offset + face/offset + event/window/offset ) returns position on the screen that's one titlebar higher than you think it is. That's why your borderless example shows window higher too. And I take my words back - it's a not a Red bug, it's your bug.( event/offset + face/offset + event/window/offset ). You miss by a titlebar, then Red missed by a titlebar and it *looks like* none of you missed. But it's not the case ;)view/options [] [offset: 0x0] open your window with titlebar *outside* the visible screen?view [button "ok" [probe system/view/screens/1/pane unview]]- I don't probably get it - you are able to get the screen resolution, your View window size and offset, so you should be able to calculate those things? Of course if not displaying the top bar does not mess with offsets, etc.>> view/options [button "ok" [probe system/view/screens/1/pane/1/offset unview]][offset: 200x200] 200x200
system/view/metrics the place where info about window title and edges should be available?system/view/metrics the place where info about window title and edges should be available?GetWindowRect API (at least on Windows) work for this? If so, do other OSs have a similar API?>> $ *** Syntax Error: (line 1) invalid money at $ *** Where: case *** Stack: load >> -$ == -$4.00 >> +$ == $4.00
load-money in %lexer.reds right now. :^) OK, I can guess that the lack of a denomination and the sign skipping combine to not see it's at the end of the value and throw an error.view/no-wait [p: progress 200x20 data 0.5] p/size: 400x20
p/data: integer does nothingview [h1 "red 2020-06-16" box draw [line 0x0 100x100]] view [h1 "red 2021-03-09" box draw [line 0x0 100x100]]
about/cc now will automatically copy the version into the clipboard, saving you from mouse/touchpad aiming exercise ;)view/no-wait compose [h3 (system/build/date/date)
b: box 100x100 draw [
pen off fill-pen black spline 100x100 100x50 50x50 50x100
]]
repeat w 30 [
xx: random length? b/draw
if pair? b/draw/:xx [b/draw/:xx: random 100x100]
]Red 0.6.4 for Windows built 18-Mar-2021/22:28:01+03:00 commit #73d9bd2 here and it's smooth and looks identical to the 1st onenoneset 'a/b "dddd"date: 19-Mar-2021/7:34:02 commit: #7316b75f3454a13bbe9ec5f112b6bc53bdb96cbd
*** Stack: view do-events do-actor do-safe update-font-faces *** Script Error: cannot access state in path none
unview/all view/no-wait [ar: area "AAAA" hs2: h2 "HHH"] ar/font: make font! [] ;; AREA has no font object in Windows ar/font/color: red hs2/font/color: blue
font-color inside VID should be enough.Red [ needs: view ] random/seed now/time view layout [ title "Tests" button "Color" [ c: random white ar/font/color: c ;--correct ret/text: form t1/font/color ;--OK color updated t1/font/color: c ;--bug macOS ] button "Quit" [quit] return t1: h3 "Test" font-color blue ret: field return ar: area 100x100 "Test" font-color red font-size 25 ]
find "aaa <bbb> ccc" <bbb> == "bbb> ccc"
% cannot be used as a word inside a path:>> o: make object! [%: 1]
== make object! [
%: 1
]
>> o/%
*** Syntax Error: (line 1) invalid path at o/%
>> get in o '%
== 1>> '%/% *** Syntax Error: (line 1) invalid word at '%/% *** Where: case *** Stack: load
invalid lit-word)% for files... like in %/root/% cannot be used in paths and that's it>> p: make path! [a v c] == a/v/c >> insert p '% == a/v/c >> p == %/a/v/c
Red 0.6.4 for Linux built 23-Mar-2021/2:29:50-06:00 commit #6378183 >> system/console/do-command *** Runtime Error 1: access violation *** at: 08090D7Eh
<_ ,<@, <# and many more probably.<-<-< should be single word or 3 words as it is now.. simply having some spec what is expected and what not could be useful.<---, <===, <<=-=-, <<<-> or <->>> should be valid... but now there is also:>> type? first probe [<=_.] [<=_.] == word!
<_ should be a word, not tag according to that spec.<. as an operator (which is not valid according to the spec)>> .<.: 1 == 1 >> .<. == 1 >> load "'.<." *** Syntax Error: (line 1) invalid tag at <. *** Where: = *** Stack: load
>> type? load {<-~~}
== word!
>> type? load {<~~}
*** Syntax Error: (line 1) invalid tag at <~~<=foo or <=f&@o should be valid words (as it is now) or rather not.<<< word, but it's not possible to use it:>> <<<: 1 *** Syntax Error: (line 1) invalid word at <<<: 1
docs/lexer](https://github.com/red/red/tree/master/docs/lexer). https://github.com/red/red/commit/d2230781a9bc58752d63474b13d9480d62d584e8 specifically introduced some support for them.red
> >> load {:<<<}
> == [:< <<]
>Here there be Tygers.>> [<==> <== ==> <= >= <- -> <-- -->] == [<==> <== ==> <= >= <- -> <-- -->]
>> last [<==> <== ==> <= >= <- -> <-- -->] == --> >> last [<==> <== ==> <= >= <- -> <!-- -->] == <!-- -->
= - and ~ with < and > of course. is a tag.. I don't see a reason why <-- --> should be tag as well. It's not used anywhere what I know.<% %> and <%= %>... PHP has , ?> and = ?>. All is fine as it does not starts with - or =.[21:03Although in this case one can at least close the " string and ] block and is back. But try to type in console <@ and hit enter. 2147483637 // 11 *** Math Error: math or number overflow *** Where: + *** Stack: mod
>> set '-1 2 == 2 >> get '-1 == 2 >> minus-one: reduce [to-get-word '-1] == [:-1] >> reduce minus-one == [2]
'-1x. Extend that to pairs and you have another area. You can't do it with % in the word though. e.g. '+1% fails.>> +1 == 1 >> set '+1 2 == 2 >> +1 == 1 >> ++1 *** Script Error: ++1 has no value *** Where: catch *** Stack: >> set '++1 3 == 3 >> ++1 == 3
pair! case?' starts a lit-word or lit-path, so '[sign][digit][letter] shouldn't be allowed0 is returned. But Red/System [implementation of quit-return routine](https://github.com/red/red/blob/c5722b6efcd299c46df6469d14d23020bca40d95/environment/routines.red#L17) is: quit status, so returning 0 does not seem intentional to me. Also, I have no idea how could this quit status be "bypassed" or what?>> to word! "<<<>>>" == <<<>>> >> '<<<>>> *** Script Error: <<>>> has no value *** Where: catch *** Stack:
a: reactor [
x: 1
y: "positive"
update: function [ val [integer! ]][
x: val
y: either val >= 0 ["positive"]["negative"]
; un-comment for triggering the update
; self/y: either val >= 0 ["positive"]["negative"]
]
]
view/no-wait [
text react [ face/text: a/y ]
button "positive" [ a/update 1 ]
button "negative" [ a/update -1 ]
button "close" [ unview ]
]Red [] smartobj!: object [ method: func [spec [block!] body [block!]] [ parse body [any [ to [set w any-word!] if (in self w) change only skip ( as switch type?/word w [get-word! [get-path!] set-word! [set-path!] lit-word! [lit-path!] word! [path!]] reduce ['self to word! w] ) ]] function spec bind body self ] ] dumpxy: func ['o] [print [o "x=" select get o 'x "y=" select get o 'y]] context [ x: y: 0 test: make smartobj! [ x: 1 f: method [] [x: 2 y: 2 print ["test/f:" x y]] ] ?? test/f dumpxy test test/f dumpxy test dumpxy self test2: make test [ x: y: 1 g: method [] [x: 3 y: 3 print ["test2/f:" x y]] ] ?? test2/f ?? test2/g dumpxy test2 test2/f dumpxy test2 test2/g dumpxy test2 ]
create-node: function [][
node0: make object! [
node-type: 'node0
label: none
value: none
parent: none
]
node1: make node0 [
node-type: 'node1
child: none
]
n0: make node0 []
n0/label: 'n1
n0/value: 1
n1: make node1 []
n1/child: n0
n0/parent: n1 ; if commented no crash
n1/label: 'sine
return n1
]
a: reactor [
node: none
push: function [][
self/node: create-node
]
pop: function [][
self/node: none
]
]
a/push
a/popn: create-node modify n 'owned none
modify line ;)-d flag-d>> 0 = 0:00 == true >> 0:0 = 0 == true
false in Rebol as [Carl wanted](https://www.curecode.org/rebol3/ticket.rsp?id=1103).100% = 0:0:1 ;== true but I know I can use 100% == 0:0:1 ;== false*** Driver Internal Error: Script Error : status needs a value
*** Where: run-console
*** Near: [status: either all [Windows? gui?] [
gui-sys-call exe any [all [file form-args file] ""]
]] sys-call routine is defined without an integer return valuecheck-event: function [from event][
print [ from "type:" event/type "key:" event/key "flags:" event/flags "ctrl?:" event/ctrl? "shift?:" event/shift? ]
]
win: layout [
h: field 0x0 hidden
text "click a key and check the console"
]
win/actors: object [
on-key: function [face event] [
check-event "window" event
]
on-key-down: :on-key
on-key-up: :on-key
]
view/no-wait win#"K" is a combo: +Shift +K -K -Shift it's 2 key-downs and 2 key-ups, there is simply no such thing as 'releasing a #"K" key' (which you expect in on-key-up)view [
style op: button bold font-size 18
on-down [ face/font/size: 20 ]
on-up [ face/font/size: 18 ]
op "Click-me" [ print "Morning Joe!" ]
op "Click-me-also" [ print "Morning Jack!" ]
]view [
style op: button bold font-size 18
on-down [ face/font: op-clicked/font ]
on-up [ face/font: op/font ]
style op-clicked: op font-size 20
op "Click-me" [ print "Morning Joe!" ]
op "Click-me-also" [ print "Morning Jack!" ]
]view [
style op: button bold font-size 18
on-down [ face/font: a-op-clicked/font ]
on-up [ face/font: a-op/font ]
a-op: op 0x0 hidden ""
a-op-clicked: op 0x0 hidden "" font-size 20
op "Click-me" [ print "Morning Joe!" ]
op "Click-me-also" [ print "Morning Jack!" ]
]win: view/no-wait [
a-button: button "Click" [ print "Hello" ]
on-create [ a-button-for-all-1: a-button ]
do [
a-button-for-all-2: a-button
]
]
do-actor a-button-for-all-1 none 'click
do-actor a-button-for-all-2 none 'click
dump-face win
truea: [ (1) 2 ] a reduce a compose a
>> a: [
[ 1
[ (2)
[ 3
[ ]
== [1
(2)
3
]
>> reduce a
== [1 2
3
]
>> compose a
== [1 2
3
]a: load "1.2354e-16" ;=> 0.0 print a ; 0.0 probe a ; 1.2354 a * 1.E16 ; 1.2354 ; no it's still there mold a ; 1.2354e-16
probe system/options/float/pretty? load "1.2354e-16" ;=> 0.0
system/options/float/pretty?: false load "1.2354e-16" ;=> 1.2354e-16
f: function [
"My function"
value [integer!] "Value"
return: [string!] "Returned value"
][
s: copy "res"
append s to-string value
return s
]f: func [
"My function"
value [integer!] "Value"
return: [string!] "Returned value"
][
s: copy "res"
append s to-string value
return s
]
help fis-zero: function [ value [integer!] return [logic!] ][
if value = 0 [ return true ]
return false
]
a: 0
either any [ is-zero a a = 1 ] [ print "Yes" ] [ print "No" ]is-zero: func[value][value = 0]return: inside function specification is interesting bug:f: function [return: [string!] ][s: copy "res" return s] ;= OK f: function [return: [string!] "a"][return "s"] ;= OK f: function [return: [string!] "a"][s: copy "res" return s] ;= ERROR f: function [return: [string!] "a"]["a"] ;= OK f: function [return: [string!] "a"][a: "a"] ;= ERROR
return vs return: exception, restrictions may help you learn but you only learn for a short time. After that restrictions only limit your expressive power. Red is a language that aims not to do that.'none instead of none. But I did use return as a /local.; Try with a block ending with an exit is not usable f: function [v] [ divide 10 v exit ] err: try [ f 10 ] ; Ok I need to add a final value to be returned in all cases err: try [ f 10 true ] error? :err err: try [ f 0 true ] error? :err ; But I may not know what the block is doing. ; Try should do that job of making sure to return something in any case (maybe return unset! as a convention)
f: function [v][ print [ 10 / v ] ]
cmd: [ f 5 ]
either error? err: try cmd [
print [ "NOK:" mold err ]
][ print "OK" ]f: function [v][ print [ 10 / v ] ]
cmd: [ f 5 ]
if error? err: try [ do cmd true ] [
print [ "NOK:" mold err ]
][ print "OK" ]err: in the first place (but set/any 'err).unset!. As I told before, every Red expression returns something.f: function [v][ print [ 10 / v ] ]
cmd: [ f 5 ]
set/any 'err try cmd
either error? err [
print [ "NOK:" mold err ]
][ print "OK" ]f: function [v][ print [ 10 / v ] ]
cmd: [ f 5 ]
set/any 'err try cmd
either all [ not unset? :err error? err ] [
print [ "NOK:" mold err ]
][ print "OK" ]:errget/any 'err if you're feeling verbosetry to replace some classes of return values would be a silly limitation.try returns transparently any value from the code it evaluates.err: try code pattern on a code you didn't write. Just as you shouldn't use x: do code pattern.try? It's your mistake of not knowing how to handle unset values.try is no magic bullet to fix syntax errors a programmer makes. It's mechanism to handle runtime errors.try has been debated at length for REBOL 2. The design is simple but I find it bad overall. Especially in R2 where errors blow up, and you have to be wary of unset! values and a number of other issues. This means that if you are writing a *generic* function that uses try you have to bend over backwards to handle all edge cases. Red is a little better but not much IMHO.if error? err: try [...] [...] - you write try [...] 'err [...] which does not require anything else to handle *all* cases. (Including the code legitimately returning an error! value, which you *cannot* handle in R2 and Red.)try [open ..]-like scenarios.#assert [error? e: try [code that should produce an error] 'e]except is an OK name too. Thanks. I'll consider it in my mezz.try/except [...] :on-error-quit-gracefullytry/except [...] [on-error-quit-gracefully]?rebol >> on-error: func[e][print ["oh no," e/type "error again!"]] try/except [1 / 0] :on-error oh no, Math error again!
system/state/last-error, so I can do also:>> try [1 / 0] probe system/state/last-error ()
make error! [
code: 400
type: 'Math
id: 'zero-divide
arg1: none
arg2: none
arg3: none
near: [/ 0]
where: [/ try]
]% echo "abc: 15 probe abc" | ./red-23mar21-637818323 --== Red 0.6.4 ==-- Type HELP for starting information. 15 *** Internal Error: not enough memory *** Where: append *** Stack: ^C%
try [open ..]-like scenarios.unset! too for eg. but that didn't pass. :) One of the reasons I made Topaz was to actually test those ideas (among many others).'no-value - what value does it have internally?same? but be aware that there are different nans, e.g. 0 / 0 isn't the same as 0 * 1.#inf'no-value - what value does it have internally?null. You can think of it as a hidden unset! if you wish, though it is never really the result of anything and it's not an actual Topaz value.>> i-have-no-value *** Script error: Word has no value: i-have-no-value *** Stack: i-have-no-value >> context-of 'i-have-no-value == context [ == conjure: native [ == "Conjure a value" == name [word!] == ... >> get/any 'i-have-no-value == none
adds: [ mults any [ adds-rec ] ] mults: [ into [ 'value integer! ] (print "MULT") ] adds-rec: [ into [ 'binary op-binary-add ] (print "ADD") mults ] op-binary-add: [ '+ | '- ] buffer: [ ['value 1] ['binary +] ] clear at buffer 2 probe buffer parse buffer adds ;= MULT / ADD - NOK buffer: [ ['value 1] ['binary +] ] take/last buffer probe buffer parse buffer adds ;= MULT / ADD - NOK buffer: [ ['value 1] ['binary +] ] remove at buffer 2 length? buffer probe buffer parse buffer adds ;= MULT / ADD - NOK buffer: [ ['value 1] ['binary +] ] buffer: copy/part buffer 1 probe buffer parse buffer adds ;= MULT - OK
Red 0.6.4 for Windows built 12-May-2021/6:12:03+03:00 commit #cebd5b9git status to see if you modified something and forgot about it-c flag, delete your libRedRT.dll to force it's rebuild on the next compilationnone for that.() or do []? none?unbind a word totally then.Topaz Interpreter - (C) 2011 Gabriele Santilli - MIT License >> do [] == none >> () == none
>> get make word! "no-context" *** Script error: Word has no context: no-context *** Stack: get make word! "no-context"
% ./red-14may21-a15845a9c --== Red 0.6.4 ==-- Type HELP for starting information. >> q *** Driver Internal Error: Script Error : status needs a value *** Where: run-console *** Near: [status: either all [Windows? gui?] [ gui-sys-call exe any [all [file form-args file] ""] ]]
echo 'Rebol[] do %red.r' | rebol +q -s without errors. Is there something more I can do?rebol -qs run-all.rq should be enough :)red executable?return: in function spec..% echo "Rebol [] a: func [return: [integer\!]] []" | ./rebol ... ** Script Error: Invalid argument: return ** Where: throw-on-error ** Near: func [return: [integer!]] []
Script Error : status needs a value error unfixed?Red [] a-func: function [ /ref [logic!] return: [unset!] ] [ either ref [ print "with ref" ] [ print "without ref" ] ] a-func ;= without ref a-func/ref ;= with ref
*** Compilation Error: invalid function spec block: [[logic!] return: [unset!]]
*** in file: D:\Developpements\RedTest\thetest.red
*** near: [[/ref [logic!] return: [unset!]] [either ref [print "with ref"] [print "without ref"]]
a-func
a-func/ref
]Red []
f: function [ v [integer!] return: [boolean!] ][
print "Here"
all [
v == 1
v == 2
]
]
f 3
print "There"Red []
f: function [ v [any-type!] return: [logic!] ][
return (type? v) == #[object!]
]
print [ f 3 ]*** Red Compiler Internal Error: Script Error : Out of range or past end *** Where: percent-value? *** Near: [forall blk [ if multi-line? [nl?: new-line? blk] item: blk/1 either any-block? :item [ either with [ emit-block/sub/with :item main-ctx
#[object!]Red []
a: 2
b: case [
a == 1 [ "1" ]
[]
]
probe b ;= none#[object!] is an invalid construction syntax, not worth reporting until somebody *designs* what construction syntax should be in the first placetype?/wordobject? vRed []
f: function [ a [integer!] return: [logic!]] [
res: false
either a > 10 [
print ["Sorry not covered"]
break
][
return true
]
]
f 1
print "Hello"*** Compilation Error: BREAK used with no loop
*** in file: D:\Developpements\RedTest\test.red
*** near: [
break
]f: function [ a [integer!] return: [logic!]] [
res: false
either a > 10 [
print ["Sorry not covered"]
break
][
return true
]
]
attempt [f 11]
print "Hello"
change at body-of :f 6 11
f 11file! with semicolon, for example %/mifs/.;/ (this is real example from my http server log), if you mold it (no matter if you use /all refinement), you get %/mifs/.;/. So if you save some block with a filename like this, you can’t load it back as everyhting after semicolon is ignored. I would suggest to check filename for a semicolon and when present, add quotes to get %"/mifs/.;/">> to-file {a"b}
== %"a"b"
>> %"a"b"
*** Syntax Error: (line 1) invalid string at "%"" form was introduced because percent-encoded files are unreadable and impossible to type by hand (unless you recall all the unicode table)none>> a: [b c d e [f g] h] == [b c d e [f g] h] >> :a/e == [f g] >> :a/e/j == none >> :a/e/f/z *** Script Error: path :a/e/f/z is not valid for word! type *** Where: catch *** Stack:
none if an element is non existant.none too>> a: [b c d e [f g] h] == [b c d e [f g] h] >> a/e/f/z *** Script Error: path a/e/f/z is not valid for word! type *** Where: catch *** Stack:
>> x: 'x == x >> x/a *** Script Error: path x/a is not valid for word! type *** Where: catch *** Stack:
invalid path value x would be better, `none because the element does not exist or because it is a return value of a function.>> ff: reduce ['lib reduce ['f func [/aref] [print "hello" none]] 'z] == [lib [f func [/aref][print "hello" none]] z] >> ff/lib/f hello == none >> ff/lib/g == none
ff/lib/g and ff/lib/f returns none but for very different reasons.exists? 'ff/lib/g which has some sense but with no luck.function? :ff/lib/g first?:ff/lib/f/aref but idk your needs>> function? :ff/z/a *** Script Error: path :ff/z/a is not valid for none! type *** Where: function? *** Stack: function?
attempt [function? :ff/z/a] where none is also the return value of attempt>> find/only reduce [1 integer! 2] number! == [1 integer! 2] >> find/only reduce [1 integer! 2] integer! == [integer! 2]
/only. value parameter could probably also use some docstring explanation. I don't know how else someone would discover that behavior changes depending on datatypeliteral as well, but that's confusing in other ways. e.g. there's no such thing as a literal block, because they always are. Adding docs for value is a great idea though.1.5 for?extract/index make hash! [a b c d] 2 2 == make hash! [1.5 b d]
>> extract/index make hash! [a b c d e f] 3 2 == make hash! [1.6666666666666667 b e] >> extract/index make hash! [a b c d e f g h] 4 2 == make hash! [1.75 b f]
>> extract/index/into make hash! [a b c d] 2 2 h: make hash! 2 == make hash! [b d] >> extract/index/into make hash! [a b c d] 2 2 h: make hash! 1.5 == make hash! [1.5 b d] >> make hash! 1.5 == make hash! [1.5]
make. Only checks for integers and blocks currently. Anything else falls to to, which should probably be an error. I can't imagine we want to rely on the current behavior, and hope it's not used anywhere.view [panel draw [line 10x0 160x50]]
C:>> a: #(a: 22 b: 33 c: x: 1)
== #(
a: 22
b: 33
c: x:
)
>> a: #(a: 22 b: 33 c: x: x)
== #(
a: 22
b: 33
c: x:
)
>> a: #(a: 22 b: 33 c: probe probe a)
== #(
a: 22
b: 33
c: probe
probe: a
)
>> a: #(a: 22 b: 33 c: x: a b)
== #(
a: b
b: 33
c: x:
)> >> #(a: 1 + 2) > == #( > a: 1 > +: 2 > ) >
>> probe compose #(a: 22 b: (3 + 4)) *** Script Error: compose does not allow map! for its value argument *** Where: compose *** Stack: probe
>> 2do: 22 *** Syntax Error: (line 1) invalid integer at 2do: 22 *** Where: case *** Stack: load >>
2do in a map! also."2do" instead I see no problem there:>> make map! compose ["2do" 22 b: (3 + 4)]
== #(
"2do" 22
b: 7
)GET-WORD VALUE couples, so I thought the "KEY" part could only be a get word. Ok, so the key part could be anything but Functions with Doc deprecates and a final decision has not been made.to map! object [a: 'a]?>> o: object [a: 'a] type? o/a == word! >> b: to block! o type? b/a == lit-word!
lit-word! makes sense if used with the make object! (because object construction is reducing the block), but it should not be present when block is created from object's value/key pairs.body-of and to block! on an object. (but I'm not sure if it's worth complications)>> #[object! [a: a]]
== make object! [
a: 'a
][a: a] of to block! #[object! [a: a]] makes more sense!construct, so one can convert object to block and back to object using:>> construct to block! object [a: 'a]
== make object! [
a: 'a
]>> reduce [to lit-word! 'a 'a to word! 'a] == ['a a a]
>> o: object [a: to lit-word! 'a] type? o/a == lit-word! >> o: object [a: 'a] type? o/a == word!
>> make object! [b: 22 c: 'z]
== #[object! [
b: 22
c: z
]]first reduce [true] should print in console #[true] instead of just true.help room, but it's all in bugs.radio does not toggle with the latest automated build?view [radio false radio] works for me on WSL2/Ubunturepeat or loop) and printing by prin. See #4929rename doesn't work for me with linux nightly buildload/next fails with non-ascii chars?>> load/next {"Gab’s Books"^/Work In P} 'pos
== "Gab’s Books"
>> pos
== "ork In P"
>> load/next {"Gab's Books"^/Work In P} 'pos
== "Gab's Books"
>> pos
== "^/Work In P">> to binary! {"Gab’s Books"^/Work In P}
== #{22476162E280997320426F6F6B73220A576F726B20496E2050}read.to string! read/binary does not seem to make a difference though.>> rename %cow.mp3 %chicken.mp3
*** Script Error: rename does not allow file! for its from argument
*** Where: rename
*** Stack:
>> help rename
USAGE:
RENAME from to
DESCRIPTION:
Rename a file.
RENAME is an action! value.
ARGUMENTS:
from [port! file! url!]
to [port! file! url!]>> v: make vector! [1.0] == make vector! [1.0] >> w: make v [] == make vector! [] >> append w 1.0 *** Script Error: invalid argument: 1.0 *** Where: append *** Stack: >> append w 1 == make vector! [1]
make just blindly takes the type of the value. And vectors are a single type. >> v: make vector! [1.0] == make vector! [1.0] >> w: make vector! v *** Internal Error: reserved for future use (or not yet implemented) *** Where: make *** Stack:
copy it is.>> v: make vector! [1.0] == make vector! [1.0] >> w: clear copy v == make vector! [] >> append w 1.0 == make vector! [1.0]
switch type for making vectors for vector!. Seems like a little hole to fill.>> f: func [arg][p: 'arg] f 1 context? p == func [arg][p: 'arg]
>> get p *** Script Error: context for arg is not available
context? should return something only in cases, when it is accessible, like in this case:>> f: func [arg][probe context? 'arg probe get 'arg] f 1 func [arg][probe context? 'arg probe get 'arg] 1
context? is evaluated, the function may not exist anymore, like in this case:f: func [arg][p: 'arg] f 1 f: none recycle context? p ;<--- will CRASH!!
>> v: make vector! b: [1.0] == make vector! [1.0] >> w: clear make v b == make vector! [] >> append w 1.0 == make vector! [1.0]
** Internal Error: Stack overflowclip seems not to work, or is it just me?view [box 200x200 beige draw [
clip [move 10x10 line 100x10 100x50 10x50 close]
[fill-pen gold box 10x10 198x198]]]a: [ 1 2] new-line? tail a ;= false as you would expect mold a ;= "[1 ^/ 2^/]"
>> new-line? load "[^/]" == false
tail marker is undefined and has to be deduced.>> load "[^/1 2^/3 4]"
== [
1 2
3 4
]a: [ 1 2] trim mold a ;= "[^/1^/2^/]" ; but a: [1 2] trim mold a ;= "[1^/2]" rather than "[1^/2^/]"
unable to execute ./red-064: Bad CPU type in executable
find accepts _binary_ target, but parse not?>> find "a" #{61}
== "a"
>> parse "a" [#{61}]
== false>> find/reverse tail %foo.x %.x == %.x
>> find/reverse/match tail %foo.x %.x == %.x ;<--- and not none as it is now?
>> index? find/reverse/last skip "2222" 2 #"2" == 4 ;<--- is 2 in Rebol2
parse with binary target against a string, if there's not a ticket, please open one. We should either allow it or doc why we don't.2 doesn't make any sensefind/reverse the question for me is not compatibility but expected behavior. Should we go past the head of an offset series reference? I think Red does the right thing here. For example, this seem surprising, doesn't it?>> str: skip "1234.2.." 2 == "34.2.." >> find/reverse/last str #"2" == "234.2.."
/last/reverse/last => Find the last occurrence of value, from the tail.
/reverse => Find the last occurrence of value, from the current index./reverse when /last is used](https://github.com/red/red/blob/19a74defb8260f2807305261af31ecbf3a674a18/runtime/datatypes/string.reds#L2071-L2090)This is a test file that can be used to test grep
Red/System [
Title: "Testing stuff out"
]
#include %./lib/simple-io.reds ; simple-io-minimal (from red/code)
if system/args-count < 2 [
print "Error: No file listed to check"
quit 1
]
fileName: system/args-list + 1 ; So I am incrementing pointer to get second cli arg (file name)
filePtr: simple-io/open-file fileName/item simple-io/RIO_READ no ; openning file by dereferencing the ptr to the command line arg (Along setting it to read mode)
buffer: declare pointer! [byte!] ; this declares a pointer
file: simple-io/read-data filePtr buffer simple-io/file-size? filePtr
i: 0 ; <-- This is the line that affects it
print file => outputs "st file
that can be used
to test grep"Red/System [
Title: "Testing stuff out"
]
#include %./lib/simple-io.reds ; simple-io-minimal (from red/code)
if system/args-count < 2 [
print "Error: No file listed to check"
quit 1
]
fileName: system/args-list + 1 ; So I am incrementing pointer to get second cli arg (file name)
filePtr: simple-io/open-file fileName/item simple-io/RIO_READ no ; openning file by dereferencing the ptr to the command line arg (Along setting it to read mode)
buffer: declare pointer! [byte!] ; this declares a pointer
file: simple-io/read-data filePtr buffer simple-io/file-size? filePtr
; i: 0 <--- this line is now commented out
print file => outputs "a test file
that can be used
to test grep"buffer, not the random non-zero value which it returns$ echo "Red [] quit/return 1" > ~/issue-4095.red $ git pull origin master $ echo 'Rebol [] do/args %red.r "-r -o console-new environment/console/CLI/console.red"' | ./rebol +q -s $ ./console-new ~/issue-4095.red; echo $? 1 $ ./red-16sep21-391fe774f ~/issue-4095.red; echo $? Compiling compression library... Compiling Red console... Gtk-Message: 17:37:23.229: Failed to load module "xapp-gtk3-module" Gtk-Message: 17:37:23.229: Failed to load module "xapp-gtk3-module" 0
system returns a value of *console* exit code, but [it's not returned](https://github.com/red/red/blob/15b13004d3263ad0a9182be6bcb851b77346f653/red.r#L510) from red.red command returns proper on W10>> ? quit
USAGE:
QUIT /return value
DESCRIPTION:
Stops evaluation and exits the interpreter.
QUIT is a native value.
REFINEMENTS:
/return -- Returns a value (to OS command shell)
value -- (Type: integer)REBOL/Core 2.7.8.4.3 (6-Jan-2011), probably the same one.>> if 0 = 0 % 10 ["rr"] *** Script Error: = does not allow logic! for its value1 argument *** Where: = *** Stack:
Script Error: % does not allow logic! for its value1 argument?copy from object!, which always sets the type header to object. It's the only type that inherits from object! currently, but if others are added, we certainly want their type preserved. replace regressed:>> replace "hi" [any newline end] lf == "hi^/" >> about Red 0.6.4 for Windows built 23-Sep-2020/18:24:34+03:00 commit #add4b06
>> replace "hi" [any newline end] lf == "hi" >> about Red 0.6.4 for Windows built 9-Dec-2020/0:03:34+03:00 commit #98457f4
end is a gray area of Parse right now. E.g. if a rule eats full input, it will stop parsing without waiting for your rule to contain end:>> parse "ab" [2 skip end (probe "at the end")] "at the end" == true >> parse "ab" [any [2 skip | end (probe "at the end")]] == true
end) will match the end position but is not required for Parse to terminate at that position. So little twists in the rule affect it.replace should expect non-empty rule matches ;)replace should not be using Parse at all, because it makes switches between Parse and non-Parse modes totally unpredictable.append trim/tail/lines "hi^/^/" lf?trim (probably known?)n: charset [not #"^/"] append clear find/last/tail "hi^/ho" n lf == "hi^/ho^/"
parse s: "hi^/ho" [to [change [any lf end] lf]] s if you could care less about performancetrim :)>> append trim/tail "hi^/ho " lf == "hi^/ho^/" >> append clear find/last/tail "hi^/ho " n lf == "hi^/ho ^/"
find is the correct and fast solutionreplace this looks like a regression.replace not to contain any hidden gotchas and be predictable as a hammer than to support edge cases like end or ""mapparse implementation suffers from this order dependence as well btw:>> mapparse [any lf end] "hi^/" [lf] == "hi^/" >> mapparse [any lf end] "hi" [lf] == "hi" >> mapparse [any lf end] "hi^/^/" [lf] == "hi^/"
>> parse "" [any [end (probe "ended") | skip]] "ended" == true >> parse "x" [any [end (probe "ended") | skip]] == true
any/some loops when it sees the end of input. We need solid arguments to justify that.replace (which is not defined) will not make your code robust and long-living ;)End in parse is a separate issue from using parse rules in replace. If end needs clarification, or design changes, we should absolutely address that. Replace is an ignorant accomplice when it comes to the use of parse within it. That is, it is not going to analyze the rule it was given to see if it makes sense. We can and should write tools to help people play, test, and understand it though. If someone then chooses to use end in their rule, that's up to them. A general bad-parse-rule analyzer would be great (as part of a general static analyzer). parse rules in replace, we shouldn't.Replace's code is not easy to understand at a glance. (Let's at least refactor it to remove also series either parse? ..., which a great way to hide an exit point and obfuscate the result in a function. Maybe I should start a "worst practices" wiki page to vent my opinions. ;^)parse rules. That is, you're not *really* writing a generic parse rule, but one that works in the context of those refinements. That should be made clear.>> foreach a [w 'w :w w: /w] [print to tag! :a] <w> <w> <w> <w> </w>
refinement! into closing tag is not a bad thing.to tag! /em to get a closing tag?map! make console quit:>> #(x: 44)
== #(
x: 44
)
>> #(x: 44 'test)
*** Script Error: invalid argument: (x: 44 'test)
*** Where: transcode
*** Stack:
[maciek@laptop ~]$read-clipboard has Runtime Error Access Violation if no data has previously been written to clipboardwrite-clipboard, or a user has to have copied something previous to the new session gdk>> to-red-file "//" == %/none >> to-red-file "\\" == %/none
%// should be root of the current logical drivenone thing)\\ is UNC path start actually>> to-red-file "\\machine\shareName\msvcSrc\crt\headerFiles\stdlib.h" == %/machine/shareName/msvcSrc/crt/headerFiles/stdlib.h
%//machine/shareName.. instead in Red. What if machine=c or d or any letter?file! works correctly to access the share, that's what I'm saying.a:a to see if that overrides the floppy. Oh, I don't have a floppy in this machine either. non-scalar type?read-clipboard @gltewalt:matrix.org reported, it also crashes if the argument is a block (probably other types would crash, didn't test yet)write-clipboard not read-clipboard; Red 0.6.4 for Windows built 17-Oct-2021/7:07:46+03:00 commit #80300ee >> write-clipboard [1 2 3] *** Runtime Error 1: access violation *** at: 0044C11Eh
data: [
foo: none
]
set data/foo "123"
probe dataset 'data/foo "123"to-lit-word to-path [a b c]
nonered
>> to-tuple #{0102030405060708090A0B0C}
== 1.2.3.4.5.6.7.8.9.10.11.12
>> to-tuple #{0102030405060708090A0B0C0D}
== 1.2.3.4.5.6.7.8.9.10.11.12 ;<--- is it ok that there was not an error?CC.YY.MM.DD.HH.MM.SS.nn.. . It allowed quite a bit of flexibility in searching.to errors, we carried over Rebol behavior for most everything I believe, but we don't have a table of which conversions cause errors (e.g. integer overflow from a large float) and those that don't (conversions from binary just taking as much data as needed). It's an important area, and we should nail it down when we work on full specs in the coming months.tuple!... Red allows shortening:>> t: 1.2.3.4.5.6.7.8.9.10 == 1.2.3.4.5.6.7.8.9.10 >> t/4: none == none >> t == 1.2.3
>> t/8: 8 == 8 ;<---- will be an error in Red so far >> t == 1.2.3.0.0.0.0.8
>> a: [#mo [words-of 1]] >> a/#mo/words-of *** Syntax Error: (line 1) invalid issue at #mo/words-of *** Where: set *** Stack: load
none for the full path. Check for tickets and file a new one if none match. Thanks.invalid issue error. You can escape it of course.>> a/(#mo)/words-of == 1
o: make object!: [words-of: func [][]] a: reduce [#mo o] a/#mo ... *** Syntax Error: (line 1) invalid issue at #mo/words-of ...
ws: [space | tab | cr | lf]
delimit7: compose [ws | (charset "])}:<>,")]
delimit1: compose [ws | (charset "[](){}^";@") | end]
issue-rule: [
#"#" [delimit7 (cause-error 'user 'message "Invalid issue")
| some [
[#"/" | #":"] (cause-error 'user 'message "Invalid issue")
| not delimit1 skip
]
]select or wrap in parensselect ['data [values] somename] somename = 'data and it won't be selected because the first data keyword would not permit this?select instead of paths.get-word or is there any difference?word! type that is transformed into select, not a word about the fate of parens and get-words after their evaluation>> unset 'k >> select b :k == none >> b/:k *** Script Error: cannot access :k in path b/:k *** Where: catch *** Stack:
>> selector: 'bar == bar >> my-block: [foo bar baz] == [foo bar baz] >> my-block/:selector == baz
>> o: object [] == make object! [] >> select o 'x == none >> o/x *** Script Error: cannot access x in path o/x *** Where: catch *** Stack:
select b: [1 2 3] k: [2] ;== 3 b/:k ;== none select b: [1 2 3] k: 2 ;== 3 b/:k ;== 2 select b: [1 2 3] k: [1 2] ;== 3 b/:k ;== none select b: [[1 2] 3] k: [1 2] == none b/:k ;== 3 select b: [[1 2] 3] k: [[1 2]] ;== 3
>> t: 1:2:3 == 1:02:03 >> poke t 1 2 *** Script Error: poke does not allow time! for its series argument *** Where: poke *** Stack: >> t/1: 2 == 2 >> t == 2:02:03
Time! isn't a series.pick/poke, R3 removed a few but added bitset support. make values from ordered blocks, which have assigned positions. We also have named accessors. There is a tension between unnamed slots and named/keyed attributes. Using paths makes it a bit more work, though not much, to use indirection. But this will come down to how they're used, as a non-path may be clearer, which is the real goal.put rather than poke, as the inverse of pick. If you can pick something, it makes sense that you can do the opposite. But here we get into deeper changes. Should pick support both keys and indexes for types that have special accessors, or objects and maps?pick on them, where you may now need to dispatch to different logic in otherwise generic funcs, lessening their leverage. copy issue, where we want consistency, but also need to look at whether it leads to *clearer* code or if a little less flexibility enforces patterns that make intent clearer. [#custom datatype-name! #management-object was one of the possible structures (also object is another one). echo -n "💖" | iconv -f UTF-8 -t UCS-4 -o ucs
red
>> read/binary %ucs
== #{0001F496}
>> save/as a: copy #{} "💖" 'redbin
== #{
52454442494E0200010000001000000007040000000000000100000096F40100
}
echo -n "ą" | iconv -f UTF-8 -t UCS-2 -o ucs
red
>> read/binary %ucs
== #{0501}
>> save/as a: copy #{} "ą" 'redbin
== #{
52454442494E0200010000001000000007020000000000000100000005010000
}iconv's byte order.echo -n "💖" | iconv -f UTF-8 -t UCS-4LE -o ucs
red
>> read/binary %ucs
== #{96F40100}$ red >> load %file.png *** Access Error: cannot open: %file.png *** Where: decode *** Stack: load
>> load %file.png
== make image! [1280x1143 #{
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000...#{56C5F2B97C679477856EFDF3CEFE6B30E3C214D0}ldd /path/to/red to list used librariesload other PNG files?-d switch during compilation** User Error: Bad face in screen pane! ** Near: size-text self
do/args %red.r "-d -r %environment/console/CLI/console.red"needs: view to console.red header to get View module in itlibgdk_pixbuf-2.0.so.0 on Linux. Maybe this lib cannot load png on void Linux.needs: view to console.red header to get View module in itview to use image anymore.gdk_pixbuf_new_from_file failed. Seems gdk_pixbuf cannot find the loader to decode the image.loaders.cache doesn't update for 32bit gdk on Void. https://github.com/void-linux/void-packages/blob/master/Manual.md#gdk-pixbuf-loaders# ls /usr/lib32/gdk-pixbuf-2.0/2.10.0/loaders libpixbufloader-ani.so libpixbufloader-ico.so libpixbufloader-qtif.so libpixbufloader-xpm.so libpixbufloader-bmp.so libpixbufloader-jpeg.so libpixbufloader-tga.so libpixbufloader-gif.so libpixbufloader-png.so libpixbufloader-tiff.so libpixbufloader-icns.so libpixbufloader-pnm.so libpixbufloader-xbm.so
gdk-pixbuf-query-loaders --update-cache for 32bit gdk-pixbuf ?>> mold/all 0.00263 == "0.00263" >> mold/all round/to 0.00263 0.00001 == "0.0026300000000000004" >> mold/all round/to 0.00263 10.0 * 1e-6 == "0.0026299999999999995"
round/ceiling and round/floor produce the same value, but not the original one ;)/to requires two multiplications: before and after roundingformat.> $ red > >> load %file.png > *** Access Error: cannot open: %file.png > *** Where: decode > *** Stack: load >
>> i: load/as %file.png 'png
== make image! [1280x1143 #{
000000000000000000000000000000000000000000000000...Red 0.6.4 for Linux built 6-Nov-2021/23:54:30-07:00 commit #fd1f289
Red 0.6.4 for Linux built 13-Nov-2021/3:17:19-07:00 commit #5f09829request-file>> m: #(ab 1 Ab 2 aB 3 AB 4)
== #(
ab: 1
Ab: 2
aB: 3
AB: 4
)
>> loop 4 [remove/key m 'ab]
== #(
Ab: 2
aB: 3
AB: 4
)none.524288 is not 1 << 18, but 1 << 19!7, I suppose, that CRUSH_HASH1_BITS should be 19.CRUSH_HASH1_BITS is not used anywhere (just in comments for the other defines)Red [] arr: ["1" ""] forall arr [ if empty? arr/1 [continue] ] ?? arr print "end"