*** Runtime Error 1: access violation *** in file: /home/devel/prj/red/gtk/red-github/runtime/datatypes/string.reds *** at line: 1067 *** *** stack: red/string/concatenate-literal-part 00000001h 00443988h 4338534 *** stack: win32-startup-ctx/exception-filter 0012EC34h
-r) application. When interpreted, it runs fine.-e (encap mode) should let your app run, if interpreted is OK.to-word "ch"to-word, it will be a all-or-nothing case, so many illegal words could then be made again, as in R2.0Ch).0#... syntax support. Though in R/S where such hex literals are much more common, I find the current form really nicer to read.access violation error.Red [Needs: 'View] metrics: compose [ font: (make font! [ size: 15 color: 68.68.68 anti-alias?: true ]) ] context [ styles: reduce [ 'bomba [ default-actor: on-down template: [ type: 'base size: 200x75 extra: context [ redraw: func [face] [ probe metrics/font ;-- this causes access violation error ] ] actors: [ on-resizing: func [face [object!] event [event! none!]] [ face/extra/redraw face ] ] ] ] ] vid-code: [ on-resizing [ face/pane/1/size: 300x75 do-actor face/pane/1 none 'resizing ] bomba "BOMBA" on-create [ face/extra: make face/extra [a: 123] ] ] do [ set 'gui context [ display: does [view/flags layout/styles vid-code styles ['resize]] ] ] ] do [gui/display]
to-word hex literal. I don't have benchmarks, but seems to build and run faster since yesterday.Author: @someone >** invalid character at @cli.red for example@someone syntax is reserved in fast-lexer branch for a new datatype (not yet implemented). Just add a letter prefix to turn it into an email! value until the new type is added.>> p: 's/s == s/s >> clear p == >> type? p == path!
>> clear p == #[path! []]
set [a b c] image and set [a b c] vector do not set a,b,c to pixels or vector items, but to image/vector itself (contrary to other series)? (same with binary as well)set [a b c] string and set [a b c] path also do the same! Thus the only case of series types where individual items end up in a b and c is set [a b c] block/hash. That seems pretty much by design to me....set-many is indeed defined for images: https://github.com/red/red/blob/c97604c6c429fda6c0dbc2dbd9e35c6b44d0b811/runtime/datatypes/image.reds#L56>> set [a b] #(a: 1 b: 2) >> a == a: >> b == 1
set-many is defined indeed, but not used for the purpose we are discussing...>> q *** Access Error: cannot open: %/home/sony/.red/.Red-Console/console-cfg.red *** Where: write *** Stack: q _save-cfg save
foreach https://github.com/red/red/blob/master/runtime/natives.reds#L3097 but not implemented even there yet. So I'd say it's a TBD feature.set-many on maps is so strange - it was implemented with foreach in mind only.Red [Needs: 'View] metrics_font: make font! [] styles: reduce [ 'menu-button [ default-actor: on-down template: [ type: 'base actors: [ on-create: func [face [object!] event [event! none!]] [ face/draw: copy [] append face/draw compose [ font (metrics_font) ] ] ] ] ] ] vid-code: compose/only [ on-resizing [ print "ERROR?" probe metrics_font print "There was no error." ] menu-button [] ] window: layout/styles vid-code styles view/flags window ['resize]
ERROR? *** Runtime Error 98: assertion failed *** in file: /home/devel/prj/red/gtk/red-github/runtime/datatypes/string.reds *** at line: 1063 *** *** stack: red/string/concatenate-literal-part 00000062h 00438A1Eh 30422756 *** stack: red/string/concatenate-literal-part 01A300E4h 009E00C4h 10354885 *** stack: red/datatype/mold 01D03568h 01A300E4h false false true 00000000h 0 0 *** stack: red/actions/mold 01D03568h 01A300E4h false false true 00000000h 0 0 *** stack: red/error/reduce 01A300C4h 01A300A4h *** stack: red/error/form 01A300A4h 01A300B4h 01A30094h -18 *** stack: red/actions/form 01A300A4h 01A300B4h 01A30094h 0 *** stack: red/actions/form* -1 *** stack: red/natives/do-print true true *** stack: red/natives/print* true *** stack: do-safe *** stack: do-actor *** stack: ctx||403~awake 01703814h *** stack: gui/make-event 00577D0Ch 0 32 *** stack: gui/WndProc 000701F0h 5 0 1310836
about:config. Some plugins also work via url:command and no slashes.mailto:a@b.c>> [''] *** Syntax Error: missing #"]" at "'']" *** Where: do *** Stack: load >> ['a'] == ['a']
** Syntax error: invalid "word" -- "''" ** Near: (line 1) ['']
'a' instead of classic #"a" for chars, so wanted to try, what such a notation does in Red and Rebol. I wonder if '...' could not be used somehow. abc' is useful enough.>> [,] *** Syntax Error: missing #"]" at ",]" *** Where: do *** Stack: load
abc' is useful enough.a:b is valid URI.any instead of some.scheme-part: [copy =scheme [alpha some scheme-char] #":"]scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )mailto:a@b.c is also valid.' as a suffix on words at times. Admittedly, that's going to be confusing to users coming from langs that use single quotes for strings, but we're not going to remove the current char! syntax at this point.>> probe second read/binary/info http://red-lang.org
#(
Location: ["http://www.red-lang.org" "https://www.red-lang.org/"]
Date: ["Sun, 12 Jan 2020 08:28:53 GMT" "Sun, 12 Jan 2020 08:28:54 GMT" "Sun, 12 Jan 2020 08:28:54 GMT"]
Content-Type: ["text/html; charset=UTF-8" "text/html; charset=UTF-8" "text/html; charset=UTF-8"]
Server: ["ghs" "GSE" "GSE"]
Content-Length: "220"
X-XSS-Protection: ["0" "1; mode=block" "1; mode=block"]
X-Frame-Options: ["SAMEORIGIN" "SAMEORIGIN"]
Expires: ["Sun, 12 Jan 2020 08:28:54 GMT" "Sun, 12 Jan 2020 08:28:54 GMT"]
Cache-Control: ["private, max-age=0" "private, max-age=0"]
X-Content-Type-Options: ["nosniff" "nosniff"]
Accept-Ranges: ["none" "none"]
Vary: ["Accept-Encoding" "Accept-Encoding"]
Transfer-Encoding: ["chunked" "chunked"]
Last-Modified: "Fri, 10 Jan 2020 17:17:36 GMT"
)Date field holds two different values and there's redirect on red-lang.org, I guess that headers are not properly cleared on redirect. IIRC it worked fine before.>> probe second read/binary/info http://red-lang.org
#(
Cache-Control: "private, max-age=0"
Date: "Sun, 12 Jan 2020 10:02:13 GMT"
Transfer-Encoding: "chunked"
Content-Type: "text/html; charset=UTF-8"
Expires: "Sun, 12 Jan 2020 10:02:13 GMT"
Last-Modified: "Fri, 10 Jan 2020 17:17:36 GMT"
Accept-Ranges: "none"
Server: "GSE"
Vary: "Accept-Encoding"
X-Content-Type-Options: "nosniff"
X-XSS-Protection: "1; mode=block"
)Red 0.6.4 for Windows built 27-Dec-2019/1:01:27+03:00Red 0.6.4 for Windows built 8-Jan-2020/23:51:56+03:00 commit #e26452d same output>> probe second read/binary/info http://red-lang.org
#(
Location: ["http://www.red-lang.org" "https://www.red-lang.org/"]
Date: ["Sun, 12 Jan 2020 10:57:09 GMT" "Sun, 12 Jan 2020 10:57:09 GMT" "Sun, 12 Jan 2020 10:57:09 GMT"]
Content-Type: ["text/html; charset=UTF-8" "text/html; charset=UTF-8" "text/html; charset=UTF-8"]
Server: ["ghs" "GSE" "GSE"]
Content-Length: "220"
X-XSS-Protection: ["0" "1; mode=block" "1; mode=block"]
X-Frame-Options: ["SAMEORIGIN" "SAMEORIGIN"]
Expires: ["Sun, 12 Jan 2020 10:57:09 GMT" "Sun, 12 Jan 2020 10:57:09 GMT"]
Cache-Control: ["private, max-age=0" "private, max-age=0"]
X-Content-Type-Options: ["nosniff" "nosniff"]
Accept-Ranges: ["none" "none"]
Vary: ["Accept-Encoding" "Accept-Encoding"]
Transfer-Encoding: ["chunked" "chunked"]
Content-Security-Policy: "upgrade-insecure-requests"
Content-Security-Policy-Report-Only: {default-src https: blob: data: 'unsafe-inline' 'unsafe-eval'; report-uri https://www.blogger.com/cspreport}
Last-Modified: "Fri, 10 Jan 2020 17:17:36 GMT"
)>> decode-url a:b
== none ;<====== WRONG
>> decode-url aa:b
== make object! [
scheme: 'aa
user-info: none
host: none
port: none
path: %./
target: %bdecode-url returns just a block... is this difference intentional?>> decode-url a:b == [scheme: 'a host: "b"]
host, Red uses target. This is clearly wrong in Red:>> decode-url mailto:aa@bb.c
== make object! [
scheme: 'mailto
user-info: none
host: none
port: none
path: %./
target: %a>> decode-url mailto:aa@bb.c == [scheme: 'mailto user: "aa" host: "bb.c"]
>> decode-url foo://example.com:8042/over/there?name=ferret#nose
== make object! [
scheme: 'foo
user-info: none
host: "example.com"
port: 8042
path: %/over/make url! block behavior, and keys are fixed. make url! uses a couple simple rules, which R3 doesn't even do, and treats all non-block specs as strings....
== make object! [
scheme: 'mailto
user-info: "aa"
host: "bb.c"
port: none
path: none
target: none
>> encode-url oo
== mailto://aa@bb.cthere?name=ferret#nose part is completely missing.user-info. First of all, it looks strange that it is the only value, which has 2 words in name, and second is, that I prefer Rebol way, which also decoded password part:>> decode-url http://name:pass@example.com == [scheme: 'http pass: "pass" user: "name" host: "example.com"]
>> decode-url http://name:pass@example.com
== make object! [
scheme: 'http
user-info: "name:pass"
host: "example.com"
port: none
path: nonehost in Red version here?>> decode-url foo:name@example.com
== make object! [
scheme: 'foo
user-info: none
host: none
port: none
path: %./
target: %namequery part from the path. In case like:>> decode-url http://example.com/path?query == [scheme: 'http host: "example.com" path: "/path?query"]
object as a result is not good enough.mailto:fred@example.commailto:fred@example.com does not have host or user info? If we produce [scheme: 'mailto user-info: %fred host: example.com] as you ask, what logic do you propose to create the original url from a spec? If host exists, we *MUST* include // when making a url from it. mailto:fred@example.com has host and user, but I understand that you want to solve also the encoding (when to add //). There was not encode-url in Rebol so I never needed to solve it.user from mailto scheme, than I would prefer to have:>> u: decode-url mailto:fred@example.com == [scheme: 'mailto path: fred@foo.com] >> type? u/path == email!
fred@example.com as a target, but that violates your RFC, which you want to follow so much, as it clearly states that it is a path.rootless-path even if, to a human, it looks like it contains a user name and a host.load data is a good question.load. rootless-path, but for me as a human, after having several beers (at 01:10 local time), mailto:fred@example.com means: _send a mail to user **fred** at hosted domain **example.com**_.decode-url mailto:fred@example.com prefered result:== [scheme: 'mailto path: fred@foo.com]
== make object! [
scheme: 'mailto
user-info: none
host: none
port: none
path: %./
target: %fdecode-url should not resolve the user and host from this type of url.>> to float! "12e4" == 120000.0 >> to float! "12e" *** Runtime Error 1: access violation *** in file: /home/devel/prj/red/gtk/red-github/runtime/dtoa.reds *** at line: 1334 *** *** stack: red/dtoa/parse-exponent 08457000h 081E00BEh *** stack: red/dtoa/to-float 081E00BBh 081E00BEh FFACD93Ch *** stack: red/string/to-float 081E00BBh 3 FFACD93Ch *** stack: red/tokenizer/scan-float F5398EE3h 3 1 FFACD93Ch *** stack: red/float/to 09A2D854h 09A2D864h 12 *** stack: red/actions/to 09A2D854h 09A2D864h *** stack: red/actions/to* *** stack: red/interpreter/eval-arguments F553A7E0h F5398E58h F5398E58h 00000000h 00000000h *** stack: red/interpreter/eval-code F553A7E0h F5398E38h F5398E58h false 00000000h 00000000h F553A7E0h *** stack: red/interpreter/eval-expression F5398E38h F5398E58h false false false *** stack: red/interpreter/eval 09A2D824h true *** stack: red/natives/catch* true 1 *** stack: ctx||512~try-do F7F229ECh *** stack: ctx||512~do-command F7F229ECh *** stack: ctx||512~eval-command F7F229ECh *** stack: ctx||512~run F7F229ECh *** stack: ctx||512~launch F7F229ECh *** stack: ctx||529~launch F7F22530h *** stack: ***_start
Red 0.6.4 for Windows built 27-Dec-2019/1:01:27+03:00shape subdialect of draw. Lines that form the pentagram in this code are not aligned one to another. On the other hand, polygon Red [need: 'view]
canvas: 500x500
radius: 200
center: as-pair canvas/x / 2 canvas/y / 2
points: collect [
repeat angle-num 5 [
angle: angle-num * 72 + 18 ;-- +18 is required for rotation
keep as-pair (cosine angle) * radius + center/x (sine angle) * radius + center/y
]
]
view [
title "Pentagram"
base canvas white
draw compose/deep [
fill-pen red
line-width 5
;polygon (points/1) (points/3) (points/5) (points/2) (points/4)
shape [line (points/1) (points/3) (points/5) (points/2) (points/4)]
]
]pen off)halt in CLI console prints "(halted)" and just terminates it?halt need to be in a script to reproduce)python -i would be useful and error on syntax error like --test in some langquit :)call/wait/input "red" {Red []^/print "I am Red!"}--== Red 0.6.4 ==-- Type HELP for starting information. == I am Red! *** Runtime Error 1: access violation *** at: 000244A5h
-o compiler option regressed. On Win10, no matter what I use as an argument, when running it from the console, the libRT and final executable gets built in the source folder. Can someone confirm?red -c -o ..\out.exe rr.red and it built libraries and exe correctly in upper dir.red -c -o ..\out.exe rr.red and it built libraries and exe correctly in upper dir.-coption, like this red -c .\play.red -o ..\out.exe. At least this is the way the command gets executed by the Red VSCode plugin, and that is where it builds only in src folder.
-c accepts an argument at all? ;)-c or -r as script is never run, but forbidding it or otherwise reordering would complicate the command line parser unnecessarily.>> [a: 22 b: "hello]
*** Syntax Error: missing #"]" at {"hello]}
*** Where: do
*** Stack: load
>> [a: 22 b: "hello]" and not ]>> parse "aabbccdd" [ thru [p: (probe p) "cc" ]] "aabbccdd" "abbccdd" "bbccdd" "bccdd" "ccdd"
thru know where to jump to? By divination? :)parse-trace output and recent parse documentation by @9214to/thru means exposing the inner search loop to the user.>> (make vector! [200 100]) / 2 == make vector! [100 50] >> (make vector! [200 100]) * .5 == make vector! [0 0] ;<--------- should not be there make vector! [100 50] too?
julia> [2 3 5] .* 2.0
1×3 Array{Float64,2}:
4.0 6.0 10.0
julia> [2 3 5] .* 2
1×3 Array{Int64,2}:
4 6 10>> do/next [a: 1 + 1 a] 'p ? p P is a block! value. length: 1 index: 5 [a] >> preprocessor/fetch-next [a: 1 + 1 a] == [1 + 1 a] ;) I expected [a] here
>> f: func ['x] [] >> preprocessor/fetch-next [f f 1] == [] ;) expected [1] >> do/next [f f 1] 'p ? p P is a block! value. length: 1 index: 3 [1]
>> f: func [x][] >> preprocessor/fetch-next [f x: 1 y: 2] == [1 y: 2]
preprocessor/fetch-next is meant to analyze conditional expressions in some of the preprocessor's directives. It does not need to support the full Red evaluation semantics. It could be extended to cover more rules if we think it is necessary.fetch-next meant as a public func, or should we note preprocessor elements that are for internal use only?preprocessor/fetch-next is meant to be a public function? If it was meant for that, it would be exposed in the global context.fetch-next and func-arity? are leveraged not only by me, simply because language does not provide any other means (as of now) to satisfy the demand.trace-deep function](https://gitlab.com/hiiamboris/red-view-test-system/blob/master/dope.red#L78), that works like this:>> x: y: 2 f: func [x] [x * 5] >> probe trace-deep :inspect [x + f y] x => 2 y => 2 f 2 => 10 2 + 10 => 12 12
x? what was y? is it f that failed? etc). So I don't have to go torturing my test code to understand which part of it failed, because I can point my finger directly at it. Remember @giesse's idea that an ideal debugger should provide a way to go backwards in time? Well, this is not a time travel yet ☻ But it's somewhat along those lines.where's-my-error? :^)get)text-io-2 if I am using the Clipboard while the tests are running. That's really annoying as I keep getting false errors from time to time. If it's not possible to do such tests in isolation, maybe they should be removed?write-clipboard and subsequent read-clipboard? ;)get the value of a path in R2?get/any in calls before doing it.loop 100 [wait 1e-1 print [write-clipboard "" read-clipboard]] starts always reporting false after the 1st external write to the clipboard. If I add a do-events/no-wait to the loop, then it's only false once when clipboard was in use. But that's in GUI console. In CLI console - it never fails ;)select though, as in does not support series selectorsget the path. Now you realize how big of an improvement was get-path! in R3 and Red. ;-)get-path! in R3 and Red. ;-)any [length? none 0], which is big improvement over R2, where it throws error instead.length? being none-transparent is a good idea in the first place, as it removes a valuable argument type-checking, length? being a very common action. Red follows R3 there, but I don't remember relying on that in my own code ever. >> data: none bytes-needed: 16 + length? data *** Script Error: + does not allow none! for its value2 argument *** Where: + *** Stack:
clear and remove are used in common patterns clear find... and remove find... where letting nonepass-thru avoids boilerplate code. For length?, I am not aware of any common pattern justifying weakening the type-checking.None is a special case, if we consider scalars, which aren't allowed. That is, you could say the length of any of them is none. The funcs that allow none are fewer than those that don't, based on common patterns, as @dockimbel said. maybe or nullable option for vars. I don't think we want to go down that path (no pun intended), but maybe we do something like a parallel to attempt, which catches none errors, but not others. So you can mark a particular expression as "I know nones may trip this up, so ignore that". data: none bytes-needed: 16 + any [length? data 0]
data: none bytes-needed: 16 + either data [length? data][0]
16 + length? any [data []]>> data: none profile/show/count [[length? any [data []]][length? none]] 1'000'000 Count: 1000000 Time | Time (Per) | Memory | Code 0:00:00.136 | 0:00:00 | 284 | [length? none] 0:00:00.285 | 0:00:00 | 440 | [length? any [data []]]
panel tight option supposed to affect internal padding or what? I don't think it's doing anything at all:>> view [panel tight [box 20x20 on-created [probe face/parent/size]]] 40x40
origin 0x0 space 0x0.%VID.red at line 321:| 'tight (if opts/text [tight?: yes])
/text facet set. It will trigger a tighter face size around the inner text. For a panel, the size is calculated from his child faces, so this option has no effect there.button, area, group-box, text, radio, check, drop-list or drop-down styles (tight vs no tight)panel, don't you think?tight mode (remember that automatic size calculations are disabled if you provide a fixed size).tight keyword when applied to panels.view [ backdrop green below return text tight blue "text" text blue "text" return button tight blue "text" button blue "text" return radio tight blue "text" radio blue "text" return check tight blue "text" check blue "text" return drop-down tight blue "text" drop-down blue "text" return ]
Red 0.6.4 for Windows built 31-Jan-2020/17:12:41+03:00 commit #414cdb3view [radio "hello world" red tight radio "hello world" red]
base, text and field.a: object [af: does [b/bf]] b: object [bf: does [cf]] c: object [set 'system/words/cf does [df] cf: none] d: object [set 'df does [ff]] ff: does [ gf: does [do make error! "error"] gf ] a/af
*** User Error: "error" *** Where: do *** Stack: cf df ff gf
af or bf (unless I also define functions with the same name in system/words)put's series argument is defined to accept any series!, but I think it should be any-block! instead, because it is not implemented on any-string! types and vector!. And to be honest, I don't think it should be.block! variant, wouldn't it be better if the _key_ search would be done as with skip = 2, so only the _key_ values would be found?put into an object! is working also just partially (only when the key exists):
`put. [any-block! port! map! object!] instead of [series! port! map! object!] series! for sake of consistency....put is very nice with block. Just I am not sure, if the key lookup should not use skip.put is not very useful on objects, but as it is defined for maps...put is much clearer than set-paths when used with expressionsput is meant to be the modifying counterpart of select, so it follows the same lookup rules/skip support.>> s: "a1b2c3d4" == "a1b2c3d4" >> s/(#"b"): #"x" == #"x" >> s == "a1bxc3d4"
/usr/local/bin and run it from there, I get *** Runtime Error 1: access violation.*** Runtime Error 1: access violation *** Cannot determine source file/line info. ***
strace and see if you can pinpoint the crashing system call.dtruss:~ ❯❯❯ sudo dtruss -f -t open gui-console ✘ 1
Password:
dtrace: system integrity protection is on, some features will not be available
PID/THRD SYSCALL(args) = return
*** Runtime Error 1: access violation
*** Cannot determine source file/line info.
***
91956/0x1cca76: open("/dev/dtracehelper\0", 0x2, 0xFFFFFFFFBFFFF0C8) = 3 0
91956/0x1cca76: open("/System/Library/CoreServices/Encodings/libLatin2Converter.dylib\0", 0x0, 0x0) = 3 0
91956/0x1cca76: open("/usr/local/bin/gui-console\0", 0x0, 0x1FF) = 3 0
91956/0x1cca76: open("/usr/share/icu/icudt62l.dat\0", 0x0, 0xFFFFFFFFBFFFE264) = 3 0
91956/0x1cca76: open("/usr/local/bin/gui-console/..namedfork/rsrc\0", 0x0, 0x1B6) = -1 Err#2
91956/0x1cca76: open("/var/db/timezone/icutz/icutz44l.dat\0", 0x0, 0xFFFFFFFFBFFFBDAC) = 3 0
91956/0x1cca76: open("/System/Library/CoreServices/SystemAppearance.bundle/Contents/Info.plist\0", 0x0, 0x1B6) = 3 0
91956/0x1cca76: open("/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/SystemAppearance.car\0", 0x0, 0x1A4) = 3 0
91956/0x1cca76: open("/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/DarkAquaAppearance.car\0", 0x0, 0x1A4) = 3 0
91956/0x1cca76: open("/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/DarkAppearance.car\0", 0x0, 0x1A4) = 3 0
91956/0x1cca76: open("/System/Library/CoreServices/SystemVersion.plist\0", 0x0, 0x0) = 3 0dtruss is recommended instead of strace for macOS as there's no strace. This is not a pressing issue, GUI-console runs fine, but just not from /usr/local/bin/. So I'm going to look into it, but it's not a high priority to me.>> clean-path http://red-lang.com/.. == %""
http://red-lang.com/clean-path still has some problems, see @x8x's [comment](https://github.com/red/red/issues/4258#issuecomment-578373733) and his clean-path implementation. >> clean-path http://red-lang.com/../ == http://red-lang.com/ <-- OK >> clean-path http://red-lang.com/.. == http://red-lang.com/.. <-- BAD
Quick try.>> read %/ == [%A/ %C/ %R/ %X/]
[%/A/ %/C/ %/R/ %/X/]clean-path is not getting the attention it deserves. Good start would be writing tests for it, because even the test suite was broken recently.clean-path pull request, so I tried it./limit refinement before doing a PR, comments and bugs mostly welcome on the gist.>> clean-path http://red-lang.com/../ == http://red-lang.com/
>> clean-path http://red-lang.com/.. == http://red-lang.com/..
> >> read %/ > == [%A/ %C/ %R/ %X/] >
[%/A/ %/C/ %/R/ %/X/]read sort of returns relative paths ;) relative to %/ in this case*** User Error: "error" *** Where: do *** Stack: af bf cf df ff gf
a/b, if a is an object, the word b in the path will be rebound to that object. The lookup on second access will then be faster.recycle?ro2-o: none, hence making the test fail.read %/ returns drive letters and read %// reads from root of the active drive. That is good, but it it ok, that to-local-file in both cases return same result?>> to-local-file %/ == "\" >> to-local-file %// == "\"
>> to-red-file to-local-file %//GIT/ == %/GIT/ >> exists? %//GIT/ == true >> exists? %/GIT/ == false
read %"" for reading drive letters, and so %/GIT/ would mean current %//GIT/.\\share\rsrc paths%c:/temp instead of %/c/temp? which would be same like %/temp if user is on drive c already.test.red file content:Red [] halt
C:\red\build\bin>red --cli --catch test.red (halted) >> pick [a b] none *** Script Error: body does not allow none! for its index argument *** Where: pick *** Stack: >> pick [a b] none *** Script Error: pick does not allow none! for its index argument *** Where: pick *** Stack:
z: #{0010} print [z]. It's more complicated, so hard to reproduce, but print is the problem here. If I run this code with z like #{0010}, print turns it into #{1000}.>> load {<a<b>}
== <a<b>
>> load {<a<b>>}
== [<a<b> >]
>> append <a> <b>
== <a<b>>append chat.>> view [do [1] backdrop white] *** Script Error: VID - invalid syntax at: [backdrop white] *** Where: do *** Stack: view layout cause-error
do might be doing some setup in this specific case. do is "last resort" to put an aftertouch to setup. Window's title, size, backdrop and actors must come first, then everything else.do hurts readability or affects any layout logic. Sure, I can put do after backdrop (which is what I did), but still don't see a reason for the limitation. In fact, it may be even more readable to have do before the layout description, otherwise it sort of splits it in two separate partslayout relatively simple.do is for "any case" not easily provided by "normal" means.do in VID is mostly there for post-processing needs (view starts the event loop, so you can't put it after the view call). We could extend VID to allow do in the container section, though in that case, you could as well have the code before view call.view following it's own logic) and need to also do some initialization for it to work.do it, then do a view next [[] ...VID code...] . ;-)view [button [print "clicked"] size 10x10], you could assume that size refers to button, not window.do resets the current directory after do-ing the script1.red: Red [] print "loaded" change-dir %/>> do %1.red pwd loaded %/D/devel/red/red-src/red/ >> do load %1.red pwd loaded %/
random/ only, but that you have a function in a function. Compiler doesn't like that. Let me find releant issue for details.>> foreach element #(a: 1) [] *** Script Error: foreach does not allow map! for its 'word argument *** Where: foreach *** Stack:
*** Script Error: foreach does not allow map! for its series argument *** Where: foreach *** Stack:
>> foreach el object [a: 1][] *** Script Error: foreach does not allow object! for its series argument ... >> foreach el true [] *** Script Error: foreach does not allow logic! for its series argument ... >> foreach el #(a: 1)[] *** Script Error: foreach does not allow map! for its 'word argument
>> foreach [a b] #(x: 1 y: 2)[print [a b]] x 1 y 2
system/console/prompt: does [append now " >> "]
do prompt right now. (%engine.red@278)>> system/console/prompt: does [append now " >> "] == func [][append now " >> "] *** Script Error: append does not allow date! for its series argument *** Where: append *** Stack: ask string? prompt macmini:~ ralfwenske$
fast-lexer branch, but is this really good one?>> load {@a@}
== [@a @]>> load {@a@}
*** Syntax Error: (line 1) invalid character at @a@
*** Where: transcode
*** Stack: load>> a: 27-Feb-2020/10:04 b: a + 3:2:1 == 27-Feb-2020/13:06:01 >> b - a == 0 >> a - b == -1 ;<-------- why?
>> difference a b == -3:02:01 >> difference b a == 3:02:01
a - b would be of different type than a and bdifference here (but since it's not an operator I won't ☻)a - b + a and a + a - b to be equivalent expressionsdate! should be convertible to both time! (as a span since year 1 day 1 0:0:0) and integer! as a number of days within that span.>> 1/1/0001 - 1 == 31-Dec-0000
-0001)... But it's convenient for computations.2 weeks.>> m: #("a" 1 "A" 2 #"a" 3 #"A" 4)
== #(
"a" 1
"A" 2
#"a" 3
#"A" 4
)
>> select m #"A"
== 4
>> select m "A"
== 1>> x: [#"a" #"b" #"A" #"c"] == [#"a" #"b" #"A" #"c"] >> find x #"A" == [#"A" #"c"]
select/case ?>> #"A" = #"a" == true >> #"A" = to integer! #"A" == false
S1 = S1 if S1/:i = S2/:i for all iequal?, strict-equal? and same?. We're talking about first here> >> #"A" = #"a" > == false >
>> #"A" = #"a" == true >> (to-integer #"a") = to-integer #"A" == false
>> #"A" = #"a" == false >> (to-integer #"a") = to-integer #"A" == false
>> "A" = "a" == true >> (to-binary "A") = to-binary "a" == false
/case refinement should be changed to /strict to allow 3 = select/strict [1.0 2 1 3] 1mold/part on date is working strangely:>> mold/part 12345678 3 == "123" >> mold/part 12345678 4 == "1234" >> mold/part now 3 == "2-Mar-2020/1" >> mold/part now 4 == "2-Mar-2020/18"
form tootext (which I still like as an alias for string!, but that may never be possible in the core), which goes the other way. == provides an easy option, and works to say == is "more equal" than =.>> as tag! { "}
== < ">
>> [<tag flag=">]
== [<tag flag=">]
>> {tag flag=""}
== {tag flag=""}Red []
[<tag flag=">]
{tag flag=""}*** Syntax Error: invalid tag! at {<tag flag=">]{tag flag=""}}
*** Where: do
*** Stack: loadmold as tag! { "} where result has backward unloadable syntax, the mold should use _construction syntax_, and so the result should be: #[tag! { "}]>> img: make image! [1x1 1.2.3]
== make image! [1x1 #{010203}]
>> img/1
== 1.2.3.0
>> img/1/2
== 2
>> img/1/2: 42 ;<------------ should this be allowed?
== 42
>> img/1
== 1.2.3.0 ;<------------ it does not work anyway!>> 1.1.1 * 214748 == 255.255.255 >> 1.1.1 * 2147483648.0 == 0.0.0
255.255.255?append-char expected an integer! codepoint as its last argument, not a byte!. So the questions are much more prosaic — why type checker let it slide, how this byte got promoted to an integer, and what happens when you allocate a string unit at buffer's tail and fill it with a mishmash of a passed byte and whatever was on the native stack at the moment.as-integer before the patch, and I couldn't trick it into eating the garbage around my byte (I tried). Not saying that it's impossible though, esp. when used alongside macros. But then if it's an as-integer bug, we should expect remaining as-integer #"'" to also turn the back on us at times. In any case, this issue calls for an investigation.either flat? branch, and since you used /flat refinements it was never taken.recycle/off the problem goes away, although it's fair to expect trash in the stack regardless of GC state.Segmentation fault: 11 for me on a VM. But MacOS version does not respond to keypresses, although I can paste something there with mouse. Second attempt at view [area] outputs a lot of errors:2020-03-08 21:44:07.832 console-view[1651:507] _createMenuRef called with existing principal MenuRef already associated with menu 2020-03-08 21:44:07.833 console-view[1651:507] ( 0 CoreFoundation 0x905d2471 __raiseError + 193 1 libobjc.A.dylib 0x919f0091 objc_exception_throw + 162 2 CoreFoundation 0x905d238b +[NSException raise:format:] + 139 3 AppKit 0x957f2c9c -[NSCarbonMenuImpl _createMenuRef] + 69 4 AppKit 0x957f249d -[NSCarbonMenuImpl _instantiateCarbonMenu] + 161 5 AppKit 0x957f23e8 -[NSCarbonMenuImpl setupCarbonMenuBar] + 40 6 AppKit 0x957f08af -[NSApplication finishLaunching] + 1357 7 console-view 0x000d52a9 console-view + 869033
node: alloc-bytes len a few lines after them may trigger the GC. The memory p1 and p2 points to may be moved.blank was declared as a byte!, but it's stored as a 32-bit word on the stack. So there are 3 bytes garbage on the stack. Those garbage may make this 32-bit word looks like a pointer and changed by the GC. If we use integer!, we can ensure the 32-bit word won't be recognized as a pointer.byte! on the stack, and every byte! inside struct! [] value on the stack can be distorted by the GC, right?declared struct, this pointer won't be updated, but if I store it in a stack struct (as value), then it will be. Can you confirm this discrepancy exists?*** Runtime Error 98: assertion failed *** in file: /Users/francoisjouen/Programmation/Red/OsteoFaces2/datatypes/common.reds *** at line: 47 *** *** stack: red/alloc-at-tail 00000062h *** stack: red/alloc-at-tail 0015E84Ch *** stack: red/word/load 001674B8h
>> to integer! c: #{00000080}
== 128
>> to integer! #{80}
== 128
>> while [c/1 = 0][c: next c]
>> c
== #{80}
>> to integer! c
== -2147483648>> to integer! next #{0080}
== 8445114
>> to integer! next #{000080}
== 8436448
>> to integer! next next #{000080}
== -2135236433>> about
REBOL/View 2.7.8.4.3 6-Jan-2011
Copyright 2000-2011 REBOL Technologies. All rights reserved.
REBOL is a trademark of REBOL Technologies. WWW.REBOL.COM
>> to integer! c: #{00000080}
== 128
>> to integer! #{80}
== 128
>> while [c/1 = 0][c: next c]
== #{80}
>> to integer! c
== 128>> about
Red 0.6.4 for Linux built 10-May-2019/16:44:54+01:00
>> to integer! c: #{00000080}
== 128
>> to integer! #{80}
== 128
>> while [c/1 = 0][c: next c]
>> c
== #{80}
>> to integer! c
== -2147483648- bin/head IMOreplace/deep [A] quote A: 1 == [1 A]
/deep?replace/all/deep [A] quote A: 1
math just a prove of concept experiment? If you do source math, you can see it deals only with multiply and divide.math has its place in Red.If someone wants to get better at parse, any improvements are welcome :)math: function [ "Evaluates an expression using math precedence rules" body [block! paren!] "Expression to evaluate" /local match ][ order: ['** * / % // + -] infix: [skip operator [enter | skip]] tally: [any [enter [fail] | recur [fail] | count [fail] | skip]] enter: [ahead paren! into tally] recur: [if (right?) skip operator tally] count: [while ahead change only copy match infix (do match)] do also body: copy/deep body foreach operator order [ right?: lit-word? operator operator: to lit-word! operator parse body tally ] ]
*, /, % and // have equal priority, just as + and -.math) so control over its release announcement, code quality and signal/noise ratio from contributors are expected; development branches are exactly for that — for development. So please refrain from such exaggerated statements in any chat room.>> and << as well as all comparisons here.chit-chat](https://gitter.im/red/chit-chat).>> page: read https://en.wikipedia.org/wiki/List_of_United_States_counties_and_county_equivalents
== {<!DOCTYPE html>^/<html class="client-nojs" lang="en" dir="ltr">^/<head>^/<meta charset="UTF-8"/>^/<title>List of United States counties and county equivalents - Wikipedia</title>^/<script>document.documentElement.classNam...
>> skip page 519200
== {ge-Newton,_MA-NH_Metropolitan_Statistical_Area" class="mw-redirect" title="Boston^@m^@e^@t^@r^@o^@p^@o^@l^@i^@t^@a^@n^@_^@a^@r^@e^@a^@"^@ ^@t^@i^@t^@l^@e^@=^@"^@C^@i^@n^@c^@i^@n^@n^@a^@t^@i^@ ^@m^@e^@t^@r^@o^@p^@o^@l^@i^@t^@a^@n^@ ^@a^@r^@e^@a^@"^@>^@C^@i^@n^@c^@i^@n^@n^@a^@t^@i^@,^@ ...to string! read/binary seems to be finewrite/infoUTF-8 as preferred encoding?User-Agent.User-Agent would affect whole file, not just past ~520000 bytesrecycle/offhead really? We would loose move in a binary series in that case (or have to use copy/part)>> to integer! next #{FF 00 00 80 01 FF}
== 32769>> to integer! copy next #{0001}
== 1
>> to integer! next #{0001}
== 65536>> page: read https://en.wikipedia.org/wiki/List_of_United_States_counties_and_county_equivalents
*** Access Error: invalid UTF-8 encoding: #{A0208CF0}
*** Where: read
*** Stack:
>> page: read https://en.wikipedia.org/wiki/List_of_United_States_counties_and_county_equivalents
== {<!DOCTYPE html>^/<html class="client-nojs" lang="en" dir="ltr">^/<head>^/<meta charset="UTF-8"/>^/<title...
>> skip page 519200
== {ge-Newton,_MA-NH_Metropolitan_Statistical_Area" class="mw-redirect" title="Boston-Cambridge-Newton, ...
...
>> page: read https://en.wikipedia.org/wiki/List_of_United_States_counties_and_county_equivalents
== {<!DOCTYPE html>^/<html class="client-nojs" lang="en" dir="ltr">^/<head>^/<meta charset="UTF-8"/>^/<title>List of United States counties and county equivalents -...
>> skip page 519200
== {^@^@/^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@w^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@i^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@k^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@i^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@/^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@D^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@o^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@t^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@h^@^@^@^@^@^@^@^@^@^@...request-http comes in two versions: for Win and for *nix. Maybe you can spot the culprit by comparing the differences between them.load-utf8-buffer and every call it does. request-http looks incidental to me (it's just a stroke of luck in this case). Your last result looks like it expanded a four-byte-encoded buffer into another 4-byte buffer, treating the source as single-byte. And then did it again, resulting in 15-byte padding of every character. Can't tell exactly what led to that though.load-utf8-buffer and every call it does. request-http looks incidental to me (it's just a stroke of luck in this case). Your last result looks like it expanded a four-byte-encoded buffer into another 4-byte buffer, treating the source as single-byte. And then did it again, resulting in 15-byte padding of every character. Can't tell exactly what led to that though.load-utf8-buffer's problem, why to string! read/binary works fine?bin/header: TYPE_UNSET makes bin recycled by the GC.bin/header: TYPE_UNSET I've seen this pattern in a lot of places. Shouldn't we fix them all then?bin/header: TYPE_UNSET I've seen this pattern in a lot of places. Shouldn't we fix them all then?bin/node is not set during GC run, as load-utf8 did not return yet, so what could it possible deallocate?bin/header: TYPE_UNSET makes bin recycled by the GC.bin is the binary data read from the url. TYPE_UNSET we put to prevent the GC from prematurily collect some series under construction.view [field field font-size 30 field font-size 30 "x"]view [field font-size 30 "x" with [clear text]] each time.view [field font-size 30 "x" with [data: none]]call (whole process tree in fact - child processes of child processes too) (normal quit does not do that)-d flag and observing the stack trace.>> now/date - 18-Jul-2017 / 365.0 == 2.66027397260274
f function, and you should wrap that call in a do expression (or add -e flag to wrap the whole script)fl function it cannot know that f will be passed a function at runtime, and what function that will be. So it will just use it as a value, and do nothing.r: reactor [ x: none f: does [self/x: 123] ] abc: object [ a: is [either none? x: r/x [none] [x]] ] r/f probe abc r/x: 456 probe abc
make object! [a: none], when compiled, and make object! [a: 123] when interpreted?r: make reactor! [
x: none
f: does [r/x: 123]
]
abc: object [
a: is [r/x]
]
r/f
probe abc
r/x: 456
probe abcx from inside funcx: 123 self/x: 123 r/x: 123 put self 'x 123 put r 'x 123
self/x: results in access violation).reactor instead of make reactor! but reactor does not work at all when compiled.view/options [on-time [print 'tick]] [rate: 1]view [rate 1 on-time [print 'tick]] view [on-time [print 'tick] with [rate: 1]]
parent to designate the window face, so that the VID properties could be attached to it like for any other face.>> a: 420 == 420 >> get quote a: == 420 >> get quote system/words/a: *** Script Error: get does not allow set-path! for its word argument *** Where: get *** Stack:
help get: the word argument has typespec [any-word! refinement! path! object!] . For consistency, one should perhaps allow any-path!.>> get /a == 420 >> set /a 999 *** Script Error: set does not allow refinement! for its word argument *** Where: set *** Stack:
get, with set-paths, it's easy enough to work around:>> get in system/words quote a: == 420
get already supports set-path! values internally, and it's only the environment interface for it (%enivronment/natives.red) that prevents it. Same for set.get, since it only talks about words today.any-path! and all-word! types? Now we have consistency, but also support for issue!. It was a string type under R2, but is a word type under Red.'a is a literal word form. In that light, so too are /a and #a. It's just that we think of the latter *only* as literal values (until now :^). get refinement! is supported for us in function contexts. Can't say without more research. If we add set support, and all-word!, the very common case of objects comes up. Are we OK with refinements and issues being coerced, or is the constraint of "true" words helpful there? Refinements are easier to justify, due to path notation, but issues are harder. Remember, too, that once we enable a feature, it's very painful to take it away.default function? I'm using it with set-words as this makes it both properly syntax highlighted and allows function to collect it. But I have use for set-paths just the same. But default is such a minor convenience that for it to be adopted it has to have tiny performance footprint. Lack of set-path support doubles it's size. It's just an example. I've encountered some other examples, both during my current project and back in the CLI lib.set with refinements, so we can remove it. If we later decide to add it back, it won't be a breaking change.s: "money? USD$12.34" do s ;** Script Error: money? is missing its value argumentdo, many other things I tried work either way.round was mentioned in the blogRed [Needs: View] bb: make face! [ type: 'button text: "BYE!" actors: object [ on-down: func [face [object!] event [event!]][ print "clicked" face/byebye ] ] hello: function [par [object!]] [ self/parent: par append par/pane self ] byebye: does [ print "byebye" remove find self/parent/pane self ] ] view [on-created [print "create" bb/hello face]]
prints fire.byebye function is not executed. "clicked" is printed, but not "byebye".create *** Runtime Error 98: assertion failed *** in file: *** Runtime Error 1: access violation *** in file:
create *** Runtime Error 1: access violation *** in file:
create *** Runtime Error 98: assertion failed *** in file: /D/devel/red/red-src/red/datatypes/object.reds *** at line: 384 *** *** stack: red/object/fire-on-set 00000062h 0044C03Fh 00000000h 0018FB08h *** stack: red/object/fire-on-set 02AE3050h 029D7804h 029E0244h 029E0234h *** stack: red/object/fire-on-set* 029DAAD4h 029D7804h *** stack: ctx||477~hello 02151B0Ch *** stack: red/_function/call 029E0214h 02151B0Ch *** stack: red/interpreter/eval-code 029E0214h 02CADCC0h 02CADCC0h false 02CADCA0h 02CADCE8h 02AE4E60h *** stack: red/interpreter/eval-path 02CADCE8h 02CADCB0h 02CADCC0h false false false false *** stack: red/interpreter/eval-expression 02CADCB0h 02CADCC0h false false false *** stack: red/interpreter/eval 02CADC18h true *** stack: red/interpreter/eval-function 029E01E4h 02CADC18h *** stack: red/_function/call 029E01E4h 021934E4h *** stack: red/interpreter/eval-code 029E01E4h 02C1C978h 02C1C978h false 02C1C948h 02C1C9B0h 02CA94B0h *** stack: red/interpreter/eval-path 02C1C9B0h 02C1C958h 02C1C978h false false false false *** stack: red/interpreter/eval-expression 02C1C958h 02C1C978h false false false *** stack: red/interpreter/eval 029E01D4h true *** stack: red/natives/try* true 0 *** stack: do-safe *** stack: show *** stack: view
parent: assignment. When compiled without it (and with offset+size), it appears but does not disappear. When interpreted - disappears. At least 2 bugs here.Red [Needs: View] bb: make face! [ type: 'button offset: 20x20 size: 50x50 text: "BYE!" hello: function [par [object!]] [ print "hello" bb/parent: par append par/pane bb ] byebye: does [ print "byebye" remove find bb/parent/pane bb ] actors: object [ on-down: func [face [object!] event [event!]][ print "sdf" face/byebye ] ] ] view [on-created [print "create" bb/hello face]]
>> head insert "" ["a" n]
== "an"
>> head insert #{} ["a" n]
== #{616E}>> head insert "" ["a" n]
== "an"
>> head insert #{} ["a" n]
*** Script Error: cannot MAKE/TO binary from: n
*** Where: insert
*** Stack:>> head insert #{} ["a" 1]
== #{6131}>> head insert #{} ["a" 1]
== #{6101}>> head insert #{} "a"
== #{61}>> head insert #{} form 'n
== #{6E}>> head insert #{} 'n
*** Script Error: cannot MAKE/TO binary! from: n
*** Where: insert
*** Stack:form in several places is, that PDF format seems not to support UTF-8... if I don't have wrong assumptions. So porting pdf-maker to Red (or Rebol3) would be more difficult than I fought. Because Red and Rebol3 assume UTF-8 when mixing strings and binary and PDF is binary format, although in its simple form looks quite readable. >> what-dir == %/X/GIT/Red/ >> cd %/ == %/ ;<--- should be %/x/ >> what-dir == %/ ;<--- should be %/x/
cd %/ acts like cd %/x/ (when on X drive). It just does not report correct name.%/ isn't the same as %/X/, and on Windows it's only possible to cd into some drive's root, should cd or at least change-dir throw an error when given %/?>> p: 2x3 == 2x3 >> p/x: 1.2 *** Script Error: float! type is not allowed here *** Where: set-path *** Stack:
>> 1.2x3 == 2642x3
to integer! cast for me>> 1.2x3 *** Syntax Error: (line 1) invalid float at 1.2x3 *** Where: transcode *** Stack: load
Red 0.6.4 for Windows built 22-Mar-2020/14:15:20+01:00call that would use some *real* startup directory?)>> cd %/ == %/ >> pwd == %/C/ > read %/ R2== [%c/] R3== [%$Recycle.Bin/ %Boot/ %bootmgr %BOOTNXT ...
lo: copy [across]
foreach box-type ['button 'box 'text 'rich-text][
append lo compose/deep [
return (box-type) 100x100 center middle yellow "Click^/me"
[print ["left " (box-type)]]
on-alt-up [print ["right " (box-type)]]
]
]
unview/all view lobox was extensively tested by me. But rich-text supports everything too, it's just happens that it's default actor is kinda strange: on-change. You can insert on-down before your left code to make it work*** Script Error: reset-buffer does not allow vector! for its <anon> argument *** Where: reset-buffer *** Stack: do-file view do-events do-actor do-safe
in-t: copy "/s" out-t: copy "" err-t: copy ""
unview/all view [
counter: box 100x100
button "run"
on-up [
n: 0
loop 100 [
n: n + 1 counter/text: form n
call/wait/input/output/error "dir" in-t out-t err-t
;;; print [in-t out-t err-t]
]
counter/text: "Done"
]
]if not find out-t "run ok" [code to handle failure]
recycle/offloop 1000 [
n: n + 1 counter/text: form n
out-t: copy ""
call/wait/input/output/error "dir" in-t out-t err-t
out-tc: copy out-t unset 'out-t
print [in-t out-tc err-t]
]recycle/off ;;; makes no difference having this
in-t: copy "/s" out-t: copy "" err-t: copy ""
unview/all view [across
counter: box 100x100
button "run"
on-up [
n: 0
loop 100 [
res/text: "please wait...."
n: n + 1 counter/text: form n
call/wait/input/output/error "dir" in-t out-t err-t
res/text: out-t
]
counter/text: "Done"
]
return
res: text 300x500
]call/wait/input/output/error "dir" clear in-t clear out-t clear err-tres/text: copy out-t thencall does-d) https://github.com/red/red/tree/f4546b96c255d2c8dd200f0d2289a2c7f3bfdb85recycle/off and manually calling recycle at times when you need it (use stats to discover).>> round/floor -5 / 3.0 == -2.0 ; OK >> round/floor -5 / 3 == -1 ; wrong >> round/floor -5:10:12 / 3:05:2 == -2 ; OK >> round/floor -5x2 / 3x4 == -1x0 ; wrong
/ *currently* performs integer division, but that is planned to change.-2? -5 / 3 is -1, which you round to the nearest multiple of 1, towards negative infinity. -1 is already such a multiple, the nearest you can get.datatypes/.reds (integer in this case) and there look for round:nsource can help to fetch actions, idk.ACT_ROUND, it's an action ID used to fetch a function pointer to a datatype-specific round implementation. In this case, the one in integer.reds is used, and it works as expected.-5 / 3 is -1 (an integer division), and that round/floor -1 is -1, while -5 / 3.0 is -1.6..6 and round/floor -1.6 is -2.0.-5 / 3 is -1 (an integer division **by default**) and that explains all./ will do decimal division in the future, and // will be the integer division symbol.// do when not both operands are integers?// ??floor the result? We can refer to it as "floor division", but I don't know if that helps. Maybe more technically accurate, but not more meaningful. to vector! is not allowed. Is there a compelling reason, or just an oversight?to-vector definition is not made by the toolchain.>> charset 1
== make bitset! #{00}
>> charset 1.0
*** Script Error: charset does not allow float! for its spec argument
>> make bitset! 1.0
== make bitset! #{40}charset is short for make bitset! but with a restriction on the argument (float! is forbidden). Is float! useful for make bitset!? And what should it mean? I suppose the #{40} is just an accident./ will be great. I have by chance run across this interesting article by [Guido van Rosum](http://python-history.blogspot.com/2010/08/why-pythons-integer-division-floors.html). make bitset! 1.0 see #4378find is not allowed, but the implementation of find says INHERITED_ACTION and object! is parent type of error!, so this will error out as well. Curiously, find has its own implementation of find but that has not been fleshed out yet. What is the poitn of all this?make or to) some values that would not be regular values if present as literals in a Red program. However, these could be of use in some dialects, so AFAIK they haven't been forbidden.none value, not the path starting with integer.>> to-path [a 2] == a/2 >> to-path [a none] == a/none >> to-path [a #[none]] ** Script error: invalid argument: none
>> collect [loop 3 [keep/only make path! 0]]
== [ ]
>> to path! [[]()#{}]
== []/()/#{}find is deprecated on objects, so what is the point of having error inherit a forbidden action? The code needs to be tidied up, don't you agree?>> type? second to-block to-path [a #[none]] == none!
to may lead to values being created, that would notto-path [1 2 3] gives 1/2/3, and 1/2/3 in a Red programdate! value 1-Feb-2003.Red [Needs: 'View] ccc: draw 20x20 [ fill-pen red box 0x0 20x20 fill-pen green circle 10x10 10 ] styles: [ drawing [ default-actor: on-down template: [ type: 'base size: 100x100 actors: [ on-created: func [face [object!] event [event! none!]] [ face/draw: [ image ccc 10x50 text 10x10 "TEXT" ] ] ] ] ] ] view layout/styles [ panel blue [drawing] at 40x0 panel red [] ] styles
color: white. Interestingly, when it's color: transparent, the error still exists.to-path [1 2 3] should return result in construction syntax -> #[path! [1 2 3]] when it is not backward loadable as path.styles though:Red [Needs: 'View] ccc: draw 20x20 [ fill-pen red box 0x0 20x20 fill-pen green circle 10x10 10 ] view [ panel blue [ base 100x100 on-created [ face/draw: [ image ccc 10x50 text 10x10 "TEXT" ] ] ] at 40x0 panel red [] ]
>> ?? system/view/VID/styles/base
system/view/VID/styles/base:
[
default-actor: on-down
template: [type: 'base size: 80x80 color: 128.128.128]]color: 128.128.128 and you didn't provide it so it assumed color: noneformed, or even molded results with the contents of a value. Can we, and should we, force every possible value to comply with standard lexical forms?head change http:// "not-a-url-anymore?"pick-path: func [blk path][ repeat i length? path [ blk: pick blk path/:i ] ] blk: [ [ [a] [b bb [b1 b2 b3 b4]] [c]] ... ] p: to path! [1 2 3 4] pick-path blk p
keys: reduce ['blk p [x y z]] find keys path!
redbin based, or use custom save/load codecs that *do* force construction syntax. I'm not saying this is a good idea, but Red will let you do something like that, which opens up more areas of research and experimentation.red-05apr20-c0f0fb619.exe and compiled the following program:Red [] write %build.txt mold system/build/git
make object! [
branch: "master"
tag: #v0.6.4
ahead: 987
date: 18-Mar-2020/13:57:39+02:00
commit: #101a64f3ef84f0376431bace08cc4547437d6008
message: {Merge pull request #4320 from 9214/issue-4318^/^/ FIX: issue #4318 ([Parse] SET and COPY work even without a sub-rule)}
]system/build/git shows that the latest is not really the latest ?!? What can I have done wrong?https://www.red-lang.org/p/download.html ?view [rich-text data ["This" font 10 red " is " /font "strange"]]
strange gets highlighted red. Is this a known limitation/bug?view [rich-text data ["This" font 20 red " is " /font "strange"]]
view [rich-text data ["This" font 10 red [" is "] /font "strange"]] this works thoughred is not part of font directive, but standalone, just stating that "start red-colored font from here until it is changed or to the end.">> view [rich-text data ["This" font 20 red " is " /font black "strange"]] >> view [rich-text data ["This" red font 20 " is " /font black "strange"]] >> view [rich-text data ["This" font 20 red " is " black /font "strange"]] >> view [rich-text data ["This" font 20 red [" is "] /font "strange"]]
*** Runtime Error 98: assertion failed *** in file: /home/devel/prj/red/gtk/red-github/runtime/datatypes/common.reds *** at line: 47 *** *** stack: red/alloc-at-tail 00000062h *** stack: red/alloc-at-tail 005FFAB8h *** stack: red/word/load 00608BD8h
*** Runtime Error 98: assertion failed *** in file: /home/devel/prj/red/gtk/red-github/runtime/datatypes/common.reds *** at line: 47 *** *** stack: red/alloc-at-tail 00000062h *** stack: red/alloc-at-tail 00617310h *** stack: red/word/duplicate 00CF55F4h
print somewhere, nothing gets printed, even if it's on first line of main file.-d -r, and not -d -c -u. I cross compile from Linux with -t MSDOS option.master branch.root block? can we do something to bloat it so much that it exceeds reserved size?root block. [This commit](https://github.com/red/red/commit/3178f42b714653c4f478a05f37f7f7f60c6b0279) creates many new words in root block.-r -d.[font bold italic ...] are just that, keywords. They are fixed, and so can have a closing tag that matches. Colors, on the other hand, can either be direct tuples or words, and aren't limited to a fixed set of values (e.g. any word that refers to a tuple works, even those you define at runtime). If you use path notation to combine keywords, e.g. i/b/u/red you need to use a block after it. red ... /255.0.0 or vice versa? And does Red need to support tuples in paths, so you can write i/b/u/255.0.0?rich-text or submit a PR to the docs that note it, along with any other clarifications we come up with here.b: [ (a ) ;space (b) (c ) ;tab (d) (e ) (f) ] probe b
[
(a)
(b) (c)
(d) (e)
(f)
]b: [
("1" )
("2")
("3" )
("4")
("5" )
("6")
]
probe b
b: [
(1 )
(2)
(3 )
(4)
(5 )
(6)
]
probe b("1")
("2")
("3")
("4")
("5")
("6")
]
[
(1)
(2)
(3)
(4)
(5)
(6)
]c: [
(a)
(b)
(c)
(d)
]
== [
(a) (b) (c) (d)
]c: [
(a)
(b )
(c)
(d )
]
== [
(a) (b)
(c) (d)
]c: [
(a )
(b )
(c )
(d )
]
== [
(a)
(b)
(c)
(d)
]do [] block (or add -e flag)area face, the different lines are not guaranteed to be of equal height in pixels, e.g. with the default fontsize, they are randomly 13 or 14 pixels high, with size 14 they are randomly 20 or 21 pixels high etc. Is this serious in your opinion? IF so, has it already been signalled in an issue, as far as you know?
`caret-to-offset and offset-to-caret functions. These two are only implemented for Rich text right now, and will not align with what area displays in any case. I also believe Rich text, using D2D tech, does actually draw lines with subpixel precision, so it is expected to fluctuate a bit.size-text reports unequal width of single characters even with a monospace font, notably for space and soft hyphen. Shouldn't all chars be equally wixe? In the area even the spaces seem equally wide so it is aqyestion of size-text it seems.size-text on an RTD face of 100x100 chars - to get some approximation of a cell size https://gitlab.com/hiiamboris/red-codex/blob/master/redcodex.red#L159>> d: 1-Jan-2000 d/timezone: -24 d == 31-Dec-1999/16:00:00-08:00 >> d: 1-Jan-2000 d/timezone: -100 d == 31-Dec-1999/20:00:00-04:00 >> d: 1-Jan-2000 d/timezone: -1000 d == 31-Dec-1999/16:00:00-08:00
time! issue, Red follows R2 (closely anyway), where R3 does what I imagine you expect.>> make time! [-1 2 3.4] == -1:02:03.4
time! code was so bad and with so many issues, that he rewrite it for R3.>> make time! [-1 2 3.4] == -0:57:57.-399999999
>> make time! [-1 -2 3.4] ** Script error: cannot MAKE/TO time! from: [-1 -2 3.4] ** Where: make ** Near: make time! [-1 -2 3.4]
>> make time! [-1 -2 3.4] == -1:01:56.6
>> usd$ *** Runtime Error 98: assertion failed *** in file: /D/devel/red/red-src/red/runtime/datatypes/money.reds *** at line: 363 *** *** stack: red/money/set-digit 00000062h 4576441 4575362 *** stack: red/money/set-digit 00396F8Dh 17 244 *** stack: red/money/make-at 00396F88h false 0285F308h 0285F30Ah 00000000h 0285F30Ch *** stack: red/lexer/load-money 0018FC08h 0285F308h 0285F30Ch 0 true *** stack: red/lexer/scan-tokens 0018FC08h false false *** stack: red/lexer/scan 0284F884h 0285F308h 5 false true true false 0018FD58h 00000000h 0284F874h *** stack: red/lexer/scan-alt 0284F884h 0284F874h 5 false true true false 0018FD58h 00000000h *** stack: red/natives/transcode* true -1 -1 -1 -1 -1 -1 -1 *** stack: load *** stack: ctx||430~do-command 0036B910h *** stack: ctx||430~eval-command 0036B910h *** stack: ctx||430~run 0036B910h *** stack: ctx||430~launch 0036B910h *** stack: ctx||448~launch 0036B3A4h
>> 1'0000h *** Runtime Error 98: assertion failed *** in file: /D/devel/red/red-src/red/runtime/lexer.reds *** at line: 1953 *** *** stack: red/lexer/load-hex 00000062h 0047E1D4h 000000FFh 40 true *** stack: red/lexer/load-hex 0018FC08h 0285F309h 0285F30Dh 33554432 true *** stack: red/lexer/scan-tokens 0018FC08h false false *** stack: red/lexer/scan 0284F884h 0285F308h 7 false true true false 0018FD58h 00000000h 0284F874h *** stack: red/lexer/scan-alt 0284F884h 0284F874h 7 false true true false 0018FD58h 00000000h *** stack: red/natives/transcode* true -1 -1 -1 -1 -1 -1 -1 *** stack: load *** stack: ctx||430~do-command 002FB910h *** stack: ctx||430~eval-command 002FB910h *** stack: ctx||430~run 002FB910h *** stack: ctx||430~launch 002FB910h *** stack: ctx||448~launch 002FB3A4h >> -10h *** Runtime Error 98: assertion failed *** in file: /D/devel/red/red-src/red/runtime/lexer.reds *** at line: 1953 *** *** stack: red/lexer/load-hex 00000062h 0047E1D4h 000000FFh 46 false *** stack: red/lexer/load-hex 0018FC08h 0287F308h 0287F30Bh 2097152 true *** stack: red/lexer/scan-tokens 0018FC08h false false *** stack: red/lexer/scan 0286F884h 0287F308h 5 false true true false 0018FD58h 00000000h 0286F874h *** stack: red/lexer/scan-alt 0286F884h 0286F874h 5 false true true false 0018FD58h 00000000h *** stack: red/natives/transcode* true -1 -1 -1 -1 -1 -1 -1 *** stack: load *** stack: ctx||430~do-command 01F8B910h *** stack: ctx||430~eval-command 01F8B910h *** stack: ctx||430~run 01F8B910h *** stack: ctx||430~launch 01F8B910h *** stack: ctx||448~launch 01F8B3A4h
>> load "1.#nan" == 1.#NaN >> 1.#nan *** Syntax Error: (line 1) invalid float at 1.#nan *** Where: transcode *** Stack: load
-10hfind on bitset! allow case-insensitive lookup of chars? Now it is:>> find charset [#"A"] #"a" == none >> find/case charset [#"A"] #"a" == none
>> parse "A" reduce [charset "a"] == false >> parse/case "A" reduce [charset "a"] == false
>> parse "A" [#"a"] == true >> parse/case "A" [#"a"] == false
char! - char! comparison is always case-sensitive, but string! - string! comparison is case-insensitive by default. So the parse "A" [#"a"] example points to an internal inconsistency of parse where a rule that is a single character is treated differently from a rule that is a charset. This is still independent, in my mind, from the case-(in)sensitivity of find.>> to-integer #"a"
== 97
>> to-integer #"A"
== 65
>> b: charset [65]
== make bitset! #{000000000000000040}
>> find b 65
== true
>> find b 97
== none
>> b: charset [65 97]
== make bitset! #{00000000000000004000000040}
>> find b 97
== true
>> find b 65
== truepick and find, maybe find could provide other functionality, couldn't it?parse difference in treatment? That could become an issue? Or is it a feature?find (from year 2014):parse difference in treatment? That could become an issue? Or is it a feature?>> reduce [charset "a"]
== [make bitset! #{00000000000000000000000040}]
>> parse "A" reduce [make bitset! #{00000000000000000000000040}]
== false
>> parse "A" [#"a"]
== truecharset "a" is no more than a friendly constructor. We could just restrict bitset values constructions to binary! and integer! values, and it would still work just fine.true if bit 97 is set. ;-)>> rule: reduce [charset "aA"]
== [make bitset! #{00000000000000004000000040}]
>> parse "A" rule
== true
>> parse "a" rule
== truebitset! is always treated like case sensitive, not matter if /case switch is used, right? find/case throw an error when used on a bitset. Except that almost all the other refinements have no meaning there either. find and select. They deserve deep treatment in the doc area.charset to make that clearer, but I don't think that will help. It's also easy to explain, in that using charsets you need to include both cases of a character, if that's what you want. binary!, /case is implied, correct?>> b: to binary! s: "Ab"
== #{4162}
>> parse b ["AB"]
== false
>> parse b ["Ab"]
== trueparse "A" [#"a"] is equivalent to " is there an a or A in "A" ", whereas parse "A" reduce [charset "a"] is equivalent to "is there an a in "A" " -- subtle difference!parse.runtime/case-folding.reds runtime/case-folding-table.reds./. page-cnt should be an integer!.>> probe gui-console-ctx/terminal/page-cnt 30.529411764705884
code-master\Scripts\tiger.red draw code regression? face mangledview/no-wait [base snow draw [translate 40x40 spline -31x6 -17x8 8x-11 27x1 10x3 -10x22 -23x20 -31x5]]tiger.red>> to-path %a/b == %a/b >> mold to-path %a/b == "%a/b"
% decoration in these cases. As it is not there:>> to-string %a/b == "a/b"
>> length? to-path %a/b == 1
path! is just a different variant of block!). I'm just asking if it could not be better.code-master\Scripts\tiger.red draw code regression? face mangledsplit-path:>> split-path %a/b == [%a/ %b]
make and to will always be greater than the number of loadable forms. We need this flexibility for supporting incremental value construction. Though, we need to better define the frontier for some types, to avoid security issues or just too confusing cases.%/a and so there would be empty slot in the path :-/to-* combinations is really a big task :-/>> to percent! 1e+13 == 1e15% >> 1e15% *** Syntax Error: (line 1) invalid float at 1e15% *** Where: transcode *** Stack: load
1eN% form>> -123x456 == -123x56 >> 123x-456 == 23x-456
>> round/to 123.4% 10 == 1
>> round/to (probe to float! 123.4%) 10 1.234 == 0
>> to-percent round/to 123.4% 50% == 123.5% >> to-percent round/to 123.4% 500% == 125% >> to-percent round/to 123.4% 100% == 123% >> to-percent round/to 123.4% 200% == 124% >> to-percent round/to 123.4% 1000% == 120% >> to-percent round/to 123.4% 10000% == 100%
> >> to percent! 1e+13 > == 1e15% > >> 1e15% > *** Syntax Error: (line 1) invalid float at 1e15% > *** Where: transcode > *** Stack: load >
percent!, but it can arise as a result of calculations, because percents use floats as internal representation. So you can still use expanded notation to represent big percent values (if you can find any use-cases for that):>> 10000000000000% == 1e13%
>> round/to 123.4 50 == 100
>> round/to 123.4% 50% == 100% ;<--- not 123.5%
>> to percent! round/to 123.4% 10 == 100% >> to percent! round/to 123.4% 10.0 == 120% >> to percent! round/to 123.4% 1000% == 120%
0, 0.0 and 0% (and then 0% after to)> >> round/to 123.4% 10% > == 1.234 >
120%percent!, but it can arise as a result of calculations, because percents use floats as internal representation. So you can still use expanded notation to represent big percent values (if you can find any use-cases for that):lisp > >> 10000000000000% > == 1e13% >
>> a: context [f: make face! []]
== make object! [
f: make object! [
type: 'face
o...
>> b: copy a
== make object! [
f: make object! [
type: 'face
o...
>> a/f/offset
== none
>> b/f/offset
== none
>> a/f/offset: 119x22
== 119x22
>> b/f/offset
== 119x22>> a: context [f: make face! []]
== make object! [
f: make object! [
type: 'face
o...
>> b: copy/deep a
== make object! [
f: make object! [
type: 'face
o...
>> a/f/offset: 119x22
== 119x22
>> b/f/offset
== 119x22mold/all 1e-500% ??? With 500 digits? ;)object!s are not copied.
copy/deep does what it is meant for. Duplicating graphs of objects is beyond copy's scope.mold/all 1e-500% ??? With 500 digits? ;)>> round/to 1234.56% 100.0 == 12.0 >> round/to 1234.56% 100'00.0% == 12.0 >> round/to 12.3456 1.0 == 12.0 >> round/to 12.3456 100% == 12.0
clone: function [ "Deep make an object" object [object!] /with spec [block!] "Extra spec to apply" ][ cloners!: make typeset! [object! map! bitset!] new: make object any [spec clear []] foreach word words-of new [ val: get in new word if find cloners! type? :val [ new/:word: either object? val [ clone val ][ copy/deep val ] ] ] new ]
>> o: object [sub-o: object [b: "test"]]
== make object! [
sub-o: make object! [
b: "test"
]
]
>> oo: clone o
== make object! [
sub-o: make object! [
b: "test"
]
]
>> same? o/sub-o oo/sub-o
== false
>> same? o/sub-o/b oo/sub-o/b
== falseround, it would be *great* to have a matrix and notes on current behavior. Linear chat is bad for making progress on things like that. @Oldes would you start a wiki page and notes for that?1e-5% and 1e-15% may not jump out at you, but .00001% and .000000000000001% look very different.1e-5% and 1e-15% may not jump out at you, but .00001% and .000000000000001% look very different.1e-9% <= x < 1e10% (personally I'm having troubles counting to more than nine ☻), and exp otherwise, but load any form given.1e-1%, when they meant 1e-15? percent!s mold, which is a thin wrapper on top of float!. The former denotes "10 to the power of", the latter denotes "ratio of 100", so using both at once is superfluous at best, because it means "10 to the power of X, but subtract 2 from X because of 100 in percent". Furthemore, ratios can be expressed in many ways, not just with percents, so that's also a questions of new datatypes and literal formats (e.g. 1/2 or 1:2).0.000000001%, that would mean a precision loss, esp. in all intermediate results, as well as a cascade of unnecessary checks during each operation, if only to worsen the result. I don't know guys, to me the whole idea is self sabotage.form percent stopped after 3 significant digits. I'd rather see 89.2% than 89.2161396515281%. For now I'm forced to apply a custom truncation.1e-6% <= x < 1e15%>> 1.0e-6% == 0.000001% >> 1.5e-6% == 0.0000015000000000000002% >> 1e-7% == 9.999999999999999e-8% >> 1e14% == 100000000000000% >> 1e15% == 1e15%
%, we throw it away again with e notation, because (agreeing with @9214 here) they aren't "compatible". I don't mean numerically compatible, but in how we think about them and use them.money! doesn't use FP.percent! becomes decimal-based, the issue will be gone, and the limit will become totally arbitrary.percent! is decimal-based, we will still face the problem of expressing too small or too big ratios nicely. Forbidding such ratios in the first place (by limiting the range) is a possible solution, but IMO impedes datatype's purposefulness.percent! at all, and wouldn't it be better to have e.g. rational! for accurate and precise ratios?money! goes out to 5 places. We can argue that the world should change it's ways, but that's the world we live in, and will for some time.x as percent, and in your formula maybe it uses x ** 4 then some intermediate calculations, then goes back to result ** 0.25. If you have 10 digits of precision after zero, for x ** 4 it's effectively 2.5. Thus, generality of this type suffers. Everytime you use it you would have to think - will it even work? If you don't clip it, but only prettify the mold output, you can't load the same value because it will not be what you molded/saved. In your vision, percent shifts from generally applicable number type to an output-only type. At least that's my understanding of it.mold/load issue can be solved by giving it a form #[percent! float-number]. But I don't see it any better than just float-number*100%200% and 23.5% happen when you divide the wrong thing; it's supposed to live in a 0-100 range.200% and 23.5% happen when you divide the wrong thing; it's supposed to live in a 0-100 range.a is 10% of b then b is 1000% of a. You can compare the solar mass to that of the Earth and show in it percents (around 33300000%), especially if you are also displaying masses relative to other planets in the same table (or other planet masses relative to Earth's).a:b = 10:100 = 1:10 is already enough, there's no need for 1000%. But yeah, it would be a crime against [memes](https://www.youtube.com/watch?v=SiMHTK15Pik) to forbid things like 9000% or 146%. We can't allow that.e notation, we can relax those rules later. That can create compatibility issues over time, so would be best to avoid it. But, if we don't range limit, and allow e notation, we can never go back. That would be a breaking change rather than an "extension".<") in your spec? is written as one or more characters, not starting with a whitespace character or one of < = > [ ] ( ) { } " and not containing ;, enclosed in < >.120% = 120 parts-per cent? Maybe yes, but for parts less than one.percent! is 0-100, and percentage! has a wider range, but then we need a separate form, and I think that would be more confusion. I think it's better to push the 0-100 rule into the area of dependent (constrained) types, where it can be a foundational example.per-centum!. ;^)>> v: make vector! [1 2 3 4 5 6] == make vector! [1 2 3 4 5 6] >> extract v 2 == make vector! [0 0 0 1 3 5] >> extract v 5 == make vector! [0 1 6] >> extract v 20 == make vector! [1] >> extract v 1 == make vector! [0 0 0 0 0 0 1 2 3 4 5 6]
>> to percent! "100" == 10000% >> to percent! "100%" == 10000%
>> to percent! "100" == 10000% >> to percent! "100%" *** Script Error: cannot MAKE/TO percent from: 100% *** Where: to *** Stack:
to-string! will use UTF-8 decoding, whereby incorrect encodings will lead to an error, but trailing incompleteto-string #{E9} ==> "". Bug or feature?modified? function yet and there is just the query _hack_ returning modification date of file (was it made by me?). I wanted to ask you, if it is good or not good to have the milliseconds there?>> query %/r/x.html == 24-Apr-2020/18:16:01.11
ref! implementation works in console only. Any occurrence in source files leads to:*** Script Error: parse does not allow ref for its input argument *** Where: parse *** Stack: expand-directives expand
>> parse [1 2 3 4][collect [keep integer! collect [some keep integer!] keep integer!]] == [1 [2 3 4]]
[1 [2 3] 4].>> parse [1 2 3 4][collect [keep integer! keep collect [some keep integer!] keep integer!]] == [1 [2 3 4] [2 3 4]]
[1 [2 3] 4]?some eats it all up.>> parse [1 2 3 4][collect [keep integer! collect 2 keep integer! keep integer!]] == [1 [2 3] 4]
ref! problem duped here.take/deep suppose to work? I was checking this @greggirwin 's [CC ticket](https://www.curecode.org/rebol3/ticket.rsp?id=171) . There was no copy in R3... and in Red there is:>> a: [2] b: reduce [1 a 3] probe head insert last probe take/part/deep b 2 'x a [1 [2]] [x 2] == [2] >> a: "2" b: reduce [1 a 3] probe head insert last probe take/part/deep b 2 'x a [1 "2"] "x2" == "2"
map!:>> a: #() b: reduce [1 a 3] probe put last probe take/part/deep b 2 'x 2 a
[1 #()]
2
== #(
x: 2
) /part in above tests:>> a: "2" b: reduce [a] probe head insert probe take/deep b 'x a
"2"
"x2"
== "2"
>> a: #(x: 2) b: reduce [a] c: take/deep b c/x: 3 a
== #(
x: 3
)>> a: [1] b: reduce [a] c: reduce [b] d: take/deep c append d/1 2 ? a ? d A is a block! value. length: 1 [1] D is a block! value. length: 1 [[1 2]]
git blame), I was not aware of a /deep refinement for take.Copy nested values. while in R3 it was: Also copies series values within the block.>> a: object [x: 2] b: reduce [a] c: take/deep b c/x: 3 a
== make object! [
x: 3
]copy/deep does not copy objects as well, so it must be by designcopy/deep.take/deep? Just to replace copy take or copy/deep take? If so, I vote to remove it, because /deep does not affect take, which works against a series index. That is, /deep has no effect on how a value is found, whether nested or not, but that's what it reads like.Take simply takes one or more values. Easy to understand. What happens after that is outside its purview.take/deep is not exactly copy/deep take:take without /part, you have to check if the type you took is a series, then copy/deep it/part, you have already a shallow copy, which you copy again with copy/deep, so that's an extra copy :)take/deep but removed(?) it: http://www.rebol.com/r3/changes-092.htmlcopy/deep/types and didn't wanted to waste time on implementing it with take.take, I want the exact value or range of values, or I'd just use remove.>> complement default! == make typeset! [unset! symbol! context! point! series!]
>> ? symbol! No matching values were found in the global context. >> ? context! No matching values were found in the global context. >> ? point! No point values were found in the global context.
complement on types/typesets is, should it work that way, or should it expand typesets and then flip only type bits.series! [type](https://github.com/red/red/blob/master/runtime/macros.reds#L56) in the Red runtime, that's the one returned by complement (and not the series! typeset...). Maybe we should mask them out...trim trims the head and tail by default?>> trim "^/x^/" == "x^/" >> trim "^/^/^/x^/^/^/" == "x^/" >> trim/head/tail "^/^/^/x^/^/^/" == "x"
>> trim "^-^-^-x^-^-^-" ; == "x"copy is missing somewhere:>> o: context [a: "x x"]
== make object! [
a: "x x"
]
>> to-csv values-of o
== {"x x"^/}
>> to-csv values-of o
== {"""x x"""^/}
>> to-csv values-of o
== {"""""""x x"""""""^/}
>> b: ["x x"]
== ["x x"]
>> to-csv b
== {"x x"^/}
>> to-csv b
== {"""x x"""^/}
>> to-csv b
== {"""""""x x"""""""^/}/header is not implied by /as-records in load-csv. Not sure how we missed that.>> s: "a,b,c^/1,2,3^/11,22,33"
== "a,b,c^/1,2,3^/11,22,33"
>> load-csv s
== [["a" "b" "c"] ["1" "2" "3"] ["11" "22" "33"]]
>> load-csv/as-records s
== [#(
"A" "a"
"B" "b"
"C" "c"
) #(
"A" "1"
"B" "2"
"C" "3"
) #(
"A" "11"
"B" "22"
"C" ...
>> load-csv/as-records/header s
== [#(
"a" "1"
"b" "2"
"c" "3"
) #(
"a" "11"
"b" "22"
"c" "33"
)]to-csv allows objects in the spec, but doesn't internally in the encode-map call.>> oo: object [A: 1 B: 2 C: 3]
== make object! [
A: 1
B: 2
C: 3
]
>> to-csv oo
*** Script Error: encode-map does not allow object for its <anon> argument
*** Where: encode-map
*** Stack: to-csvload-csv never returns them, and since we're talking about data here, I think we can remove object support./header isn't implied, what do you use as field names? What @rebolek did here makes sense in that regard, as you have no other option really, so /header acts like remove on the result./header is much more meaningful./header is not given.O:\>red -t Android-x86 android-test.v1.red
-=== Red Compiler 0.6.4 ===-
Compiling O:\android-test.v1.red ...
...compilation time : 2588 ms
Target: Android-x86
Compiling to native code...
*** Warning: OS_TYPE macro in R/S is redefined
*** Compilation Error: invalid path value: image/extract-data
*** in file: %/O/datatypes/binary.reds
*** in function: red/binary/to
*** at line: 1
*** near: [1030x7
proto: image/extract-data as red-image! spec EXTRACT_ARGB
]/as-records to imply /header originally, hence the doc string, but then how do you turn it off? The vast majority of the time, records means you'll have a header, to be sure, so it's a little extra typing when the intent should be clear. But to work around it, you then need to prepend a header line yourself to set the names. The way it is now is consistent, and also matches how you take/remove a header as the first item in the result, if you don't want it.oo: object [A: 1 B: 2 C: 3] to-csv oo
>> to-csv make map! [a: 1 b: 2 c: 3] *** Script Error: length? does not allow integer! for its series argument *** Where: length? *** Stack: to-csv encode-map
map! (or object!) of *columns*, so every value must be a block. It needs better error message, that's for sure, I'll add a check for it.to-csv [a: 1 b: 2 c: 3]
*** User Error: {All values in map!/object! are expected to be of block! type}
*** Where: ???>> to-csv object [a: [1] b: [2] c: [3]]
[a b c]
make object! [
a: [1]
b: [2]
c: [3]
]
== "a,b,c^/1,2,3^/"to-csv with an object.o: object [a: 1 b: 2 c: 3] to-csv/skip append words-of o values-of o length? words-of o ; == "a,b,c^/1,2,3^/"
equal? to-csv load-csv/as-columns/header t: "a,b,c^/1,2,3^/" t
to-csv values-of object-or-map which is pretty easy./as-columns, as the behavior is the same, right?about in Red console. What output do you get?>> load {"^^/"}
== "^/"
>> load "{^^/}"
== "^/"
>> load {{^^/}} ;) this is the culprit
== "^^/"
>> load load mold mold "^/012345678901234567890123456789012345678901234567"
== "^/012345678901234567890123456789012345678901234567"
>> load load mold mold "^/0123456789012345678901234567890123456789012345678"
== {^^/0123456789012345678901234567890123456789012345678}
>> load load load mold mold mold "^/0123456789012345678901234567890123456789012345678"
== {^^^^/0123456789012345678901234567890123456789012345678}
>> load load load load mold mold mold mold "^/0123456789012345678901234567890123456789012345678"
== {^^^^^^^^/0123456789012345678901234567890123456789012345678}>> load {"^^/"}
== "^/"
>> load "{^^/}"
== "^/"
>> load {"^^/"}
== "^/"{{^^/}}?>> p: 1x2 >> p/x: 1 / 2 *** Script Error: float type is not allowed here *** Where: set-path *** Stack: >> t: black == 0.0.0 >> t/1: 1 / 2 *** Script Error: float type is not allowed here *** Where: set-path *** Stack:
p/x: 0.5 should silently coerce?>> p: 1x2 == 1x2 >> r: p / 2 == 0x1 >> s: p s/x: p/x / 2 *** Script Error: float type is not allowed here *** Where: set-path *** Stack: >> s: p s/y: p/y / 2 == 1 >> as-pair 0.5 1.5 == 0x1 >> 1.2.3 / 2 == 0.1.1 >> t: 1.2.3 == 1.2.3 >> t/3: t/3 / 2 *** Script Error: float type is not allowed here *** Where: set-path *** Stack: >> t/3: t/3 / 3 == 1
x doesn't look as a delimiter in this case?x in pathological cases. 3.141592653589793x2.718281828459045 I think we can live with that, but also have to decide on point! syntax, which exacerbates that, or uses another syntax entirely (Doc has proposed one).100_x_200. Though marginally helpful: 3.141592653589793_x_2.718281828459045. _x_ thingmunge does, which we used as a reference point. Ashley (@dobeash) did a lot of research, and works with various systems, both SS and DB, where he aimed for compatibility.Red 0.6.4 for macOS built 9-May-2020/1:48:06+10:00 commit #5a4401bif (face/type = 'window) and (object? face/extra) and (size <> none) [ mins: to-pair select face/extra/options 'min-size maxs: to-pair select face/extra/options 'max-size ?? maxs ?? mins print [type? maxs]
maxs: 1400x1000 mins: 400x600 pair
print [type? maxs maxs/x maxs/y]
*** Runtime Error 1: access violation *** at: 00038580h
Red 0.6.4 for Linux built 8-May-2020/17:02:59+10:00 commit #2c41bd8maxs: 1400x1000 mins: 400x600 pair 1400 1000
recycle/off?recycle off did the trick.-d and than you would have more informative error info - possibly pointing to place where it should be fixed.>> #{BADFACE}
== #{BADFAC}>> #{BADFACE}
*** Syntax Error: invalid binary! at "#{BADFACE}"
*** Where: do
*** Stack: load>> #{BADFACE}
*** Syntax Error: (line 1) invalid binary at }
*** Where: transcode
*** Stack: loadUnable to init server: Could not connect: Connection refused (view-console:1020): Gtk-WARNING **: 12:13:58.192: cannot open display:
ssh -X ... but then it opens the window on my local machine :-) I need to read about it a bit more.DISPLAY=":0.0" xterminal btw let's move to chit-chat!xterm. Anyway, it's just the command you want to run on your rPi.drop-list? Try view [drop-list data ["1" "2" "3" "4"]] and click on any value: it crashes on my W10 (latest commit).master is a bit old (no crash there), let me refresh09:59:38 ~/Downloads vresko@newhope $ sha256 red-12may20-18ccd9208 838679ab291213f8c51724d1248bfc958a62df9eb8089f6732a3e768e7cee0f0 red-12may20-18ccd9208 09:59:45 ~/Downloads vresko@newhope $ sh red-12may20-18ccd9208 red-12may20-18ccd9208: red-12may20-18ccd9208: cannot execute binary file 09:59:53 ~/Downloads vresko@newhope $ chmod +x red-12may20-18ccd9208 09:59:57 ~/Downloads vresko@newhope $ ./red-12may20-18ccd9208 -bash: ./red-12may20-18ccd9208: Bad CPU type in executable 10:00:00 ~/Downloads vresko@newhope $
$ uname -a Darwin newhope.local 19.4.0 Darwin Kernel Version 19.4.0: Wed Mar 4 22:28:40 PST 2020; root:xnu-6153.101.6~15/RELEASE_X86_64 x86_64
$ brew cask install red ==> Downloading https://static.red-lang.org/dl/mac/red-064 ######################################################################## 100.0% ==> Verifying SHA-256 checksum for Cask 'red'. Error: This cask does not run on macOS versions newer than Mojave.
do/args %red.r "-r environment/console/CLI/view-console.red"-r for release mode, which recompiles the runtime in full every time. -c is dev mode, which builds the runtime once, and keeps it external to your app, so you just compile your code, which only takes a second.v: view/no-wait [] append v/pane layout/only [base] looks like a regression in fast lexer (compared to master)*** Script Error: VIEW - invalid face type: none *** Where: do *** Stack: view layout table on-face-deep-change* cause-error
>> s: [$1 $2] == [$1.00 $2.00] >> s == [1 2] == false >> s == [USD$1] == false >> s == [USD$1 0] *** Script Error: $1.00 not same denomination as USD$1.00 *** Where: == *** Stack: >> s == [...] >> length? s == 2 >> s = copy s == false >> s == copy s == false >> t: copy s == [$1.00 $2.00] >> t = s == true >> t == s == true >> s = t == false >> s == t == false
money! type.>> s == [USD$1] == false >> s == [USD$1 0] *** Script Error: $1.00 not same denomination as USD$1.00 *** Where: == *** Stack:
>> find/case t USD$1 *** Script Error: $1.00 not same denomination as USD$1.00 *** Where: find *** Stack: >> parse/case s [USD$1 skip] *** Script Error: $1.00 not same denomination as USD$1.00 *** Where: parse *** Stack:
>> ? [] [] is a block! value. >> ? #() *** Script Error: get does not allow map! for its word argument *** Where: get *** Stack: ? help-string map?
help looks perfectly OK, it must be in the argument passing of a literal map to a function with a lit-word argument.show-map-help if map? get word [... word [word! path! map!] Help is at fault, because get doesn't support maps. The question now is whether we want to file a bug report against help or a wish for get to support maps. Get just uses thevalues reflector for objects, and maps could work the same. If we change get, we should look at set too, so people can write with consistent patterns. It looks like maps support the set-many approach objects use, but doesn't support all the refinements currently.
Fixing help will be a lot easier right now. Changing get/set` is a lot more work, but if we think supporting maps there is a win overall, it's worth considering.set on maps doesn't make any sense to me, as their key set is mutable (and unordered).get might work, alrighthelp seems best. I'll note this about maps in the wiki, and @meijeru can note it in specs as well. I think maps will be a tricky thing for users to get right with set, and won't lead to cleaner code.>> get quote :system/script *** Script Error: get does not allow get-path! for its word argument *** Where: get *** Stack: >> get quote system/script: *** Script Error: get does not allow set-path! for its word argument *** Where: get *** Stack:
get extension if needed.getwork on objects and maps, as a simple synonym for values-of seems rather superfluous, if you ask me.o: object [long-name: 1 longer-name: 2 really-long-name-like-Java: 3] words: [a b c] set words get o ; <--- ; work with short words e: 2.718281828459045 a: pi * e b: a * c c: random 100 ; <--- set o reduce words ; <---
set already allows object! too, and -- curiously -- map is mentioned in the docstring:ARGUMENTS:
word [any-word! block! object! path!] "Word, object, map path or block of words to set."
value [any-type!] "Value or block of values to assign to words."put mentions that it returns a [series! port! map! object!], so I would assume it returns the series after the modification. Instead, it returns the puted value, e.g. it behaves like set.poke as well then, as it has a similar issue. Take doesn't define a return type at all.system/platform is a function and not just a word?#include and no access to the compilation settings). So I guess now we can replace that function with just a #switch directive.version is, couldn't be?help system as an entry point for deeper examination and so from aesthetic reasons, it should be next to version info.switch system/platform/1 [... does not look good enough... better would be just system/platform.>> view [field "a" with [selected: 1x100000]] ; ok >> view [field "a" with [selected: 1x1000000]] ; closes window immediatly
protect) doesn't make it any moreso.System/build is an object, with a lot of details. While I don't see this as important enough to change right now, relative to other things, it's something we can and should note for the future. Metadata about apps can be valuable, to introspect in deployed systems, so the easier we can make it to do that correctly and consistently the better.system/build is also not much friendly... it is really something which is used quite a lot.about func. A passing idea was to extend it, so it could return info about modules, but could also apply to other values.>> append #{} "^(2190)"
== #{E28690} ;<---- so far it is good... but...
>> append/part #{} "^(2190)" 1
== #{E2} ;<---- I quite not sure if it is useful as it is>> view [text-list 40x100 data ["aaaaaaaaaaaaaaaaae" "b" "c"]]
e on Win10. >> append/part {} 'a/b/c 2
== "a/">> append #{} copy/part "^(2190)XYZ" 1
== #{E28690}>> append/part #{} to binary! "^(2190)xyz" 1
== #{E2}part function would be unambiguous on that it works like copy/part, i.e. part is attributed to the argument, not the result>> append "a" "b"
== "ab"
>> append next "a" "b"
== "ab"
>> append #{00} #{01}
== #{0001}
>> append next #{00} #{01}
== #{01} ;<---- inconsistent with the string cases above!#{01})save data into binary and _chain_ such a saves... Red and R2 does not append a newline while R3 does... I think, that there should be the newline appended, else one can get wrong results, like in this case:Red & Rebol2>> b: #{} save b [1 "a" 3] save b [4 "b" 6] load b
== [1 "a" 34 "b" 6] ;<----- should be [1 "a" 3 4 "b" 6] insteadRebol3>> b: #{} save b [1 "a" 3] save b [4 "b" 6] load b
== [1 "a" 3
4 "b" 6
]>> b: %save-test save b [1 "a" 3] save b [4 "b" 6]
>> read b
== {4 "b" 6}
>> load b
== [4 "b" 6]>> b: {} save b [1 "a" 3] save b [4 "b" 6] b
== "#{31202261222033}#{34202262222036}"Save clearly has some issues. There is heavy redbin work underway, so now is a good time to define the behavior, document it, and make sure we have tests for it.string! _target_ was introduced in R3... because it is not supported in R2.any-string! values should use _string table_, instead adding the data directly into the _value_.save is not for low level API interaction anyway, and where else is it useful?string! is allowed as target in R3 too. Red's save was a direct port of the R3 version.any-string! comment was related to redbin format... and I somehow expected, that redbin format could be used not just for saving/loading data, but also for fast loading of Red code with possibility to handle references.. like in this case: >> str: "aha" blk: reduce [str str]
== ["aha" "aha"]
>> same? blk/1 blk/2
== true
>> blk2: load save #{} blk
== ["aha" "aha"]
>> same? blk2/1 blk2/2
== false ;<--- could be true with proper redbin implementationRed [needs: view] do https://gitlab.com/hiiamboris/red-mezz-warehouse/-/raw/master/clock.red recycle/off b: [[][][][][]] s: reactor [x: 10 y: 2 t: 0 re: [this/t: that/x + that/y + that/t / 10]] repeat i 5 [clock compose/deep [clear pick b (i) loop 1000 [append pick b (i) make s [re: copy/deep re]]]] prev: s repeat i 5 [clock compose [foreach r pick b (i) [react/link/later r/re: func [this that] r/re [r prev] prev: r]]] clock [s/t: 1] repeat i 5 [clock compose [foreach r pick b (i) [react/unlink :r/re 'all]]] clock [recycle]
31.0 ms [clear pick b 1 loop 1000 [append pick b 1 make s [re: copy/deep re]]] 34.0 ms [clear pick b 2 loop 1000 [append pick b 2 make s [re: copy/deep re]]] 49.0 ms [clear pick b 3 loop 1000 [append pick b 3 make s [re: copy/deep re]]] 37.0 ms [clear pick b 4 loop 1000 [append pick b 4 make s [re: copy/deep re]]] 41.0 ms [clear pick b 5 loop 1000 [append pick b 5 make s [re: copy/deep re]]] 188 ms [foreach r pick b 1 [react/link/later r/re: func [this that] r/re [r p 449 ms [foreach r pick b 2 [react/link/later r/re: func [this that] r/re [r p 917 ms [foreach r pick b 3 [react/link/later r/re: func [this that] r/re [r p 841 ms [foreach r pick b 4 [react/link/later r/re: func [this that] r/re [r p 2403 ms [foreach r pick b 5 [react/link/later r/re: func [this that] r/re [r p 558 ms [s/t: 1] 928 ms [foreach r pick b 1 [react/unlink :r/re 'all]] 714 ms [foreach r pick b 2 [react/unlink :r/re 'all]] 519 ms [foreach r pick b 3 [react/unlink :r/re 'all]] 321 ms [foreach r pick b 4 [react/unlink :r/re 'all]] 113 ms [foreach r pick b 5 [react/unlink :r/re 'all]] root: 4720/6799, runs: 0, mem: 49337420 *** Runtime Error 19: stack error or overflow *** in file: /D/devel/red/red-src/red/runtime/collector.reds *** at line: 88 *** *** stack: red/collector/keep 0034AF1Ch *** stack: red/collector/mark-values 04C92AB8h 04C92BA8h *** stack: red/collector/mark-block 04C92A90h *** stack: red/collector/mark-values 04C92A90h 04C92AA0h *** stack: red/collector/mark-block 04C92980h *** stack: red/collector/mark-values 04C92980h 04C92A20h *** stack: red/collector/mark-block 04C928D8h *** stack: red/collector/mark-values 04C928D8h 04C92928h *** stack: red/collector/mark-block-node 04BEDE1Ch (many more lines like that)
clock [recycle], with that it silently dies.using libRedRT built on 27-May-2020/5:04:33
*** Red Compiler Internal Error: Syntax Error : Invalid decimal -- 3e9a77243b6d283ff9e4dc41378833e7d5398ab7
*** Where: none 3e9a77243b6d283ff9e4dc41378833e7d5398ab7 coming from? A binary series?red clear before using the new Red executable?>> preprocessor/fetch-next [object/no-ref] *** Macro Error: unknown refinement *** Where: object/no-ref (halted) >> type? try [preprocessor/fetch-next [object/no-ref]] *** Macro Error: unknown refinement *** Where: object/no-ref (halted) >> type? try/all [preprocessor/fetch-next [object/no-ref]] *** Macro Error: unknown refinement *** Where: object/no-ref == error!
halt error, and there's no way to silence it's output>> make map! reduce [integer! 100] *** Script Error: datatype type is not allowed here *** Where: make *** Stack:
_hashtable supports them, so just that map/preprocess-key doesn't. Although, they hash the same as objects and logics, which also aren't supported. @qtxie?#(<key> <value>...) <key> : hashed key, accepted types are: scalar!, all-word!, any-string! <value> : any-type! value
type?/word, but it would be nice to have raw datatypes as well.Red [] face1: make face! [ type: 'base size: 100x100 offset: 10x10 color: blue ] face2: make face! [ type: 'base size: 100x100 offset: 130x130 color: red ] win: make face! [ type: 'window size: 800x600 pane: reduce [face1] ] view/no-wait win ;append win/pane face2 ; this works insert win/pane face2 ; this crashes show win do-events
*** Runtime Error 98: assertion failed *** in file: /d/devel/red/red-src/red/modules/view/backends/windows/gui.reds *** at line: 232 *** *** stack: gui/get-face-handle 00000062h *** stack: gui/get-face-handle 02A3A024h *** stack: gui/change-parent 02A3A024h 02A39FE4h *** stack: gui/change-faces-parent 02A3A004h 02A39FE4h 02A3A024h 0 1 *** stack: gui/OS-update-facet 02A39FE4h 02A39FF4h 02A3A004h 02A3A014h 02A3A024h 0 1 *** stack: ctx||460~on-change-facet 02A39FE4h 02A39FF4h 02A3A004h 02A3A014h 02A3A024h 0 1 *** stack: on-face-deep-change* *** stack: red/_function/call 02A39EA4h 003C3884h *** stack: red/interpreter/eval-code 02A39EA4h 02E42CC8h 02E42CC8h false 00000000h 00000000h 02B24138h *** stack: red/interpreter/eval-expression 02E42C38h 02E42CC8h false false false *** stack: red/interpreter/eval 02E42BC0h true *** stack: red/interpreter/eval-function 02E3DDE0h 02E42BC0h *** stack: red/_function/call 02E3DDE0h 008C1350h *** stack: red/object/fire-on-deep 02B7BC20h 02B7BC30h 02A39E14h 02A1E0E4h 02A39E24h 0 1 *** stack: red/ownership/check 02A39E14h 02A1E0E4h 02A39E24h 0 1 *** stack: red/block/insert 02A39E14h 02A39E24h 02A39E04h false 02A39E04h false *** stack: red/actions/insert 02A39E14h 02A39E24h 02A39E04h false 02A39E04h false *** stack: red/actions/insert* -1 -1 -1 *** stack: red/interpreter/eval-arguments 02B1FEC8h 02E336A0h 02E336D0h 00000000h 00000000h *** stack: red/interpreter/eval-code 02B1FEC8h 02E33680h 02E336D0h false 00000000h 00000000h 02B1FEC8h *** stack: red/interpreter/eval-expression 02E33680h 02E336D0h false false false *** stack: red/interpreter/eval 02A39DE4h true *** stack: red/natives/catch* true 1 *** stack: ctx||557~try-do 003E1DA4h *** stack: ctx||557~launch 003E1DA4h *** stack: ctx||590~launch 003E14F8h
system/view/auto-sync?: true face1: make face! [ type: 'base size: 100x100 offset: 10x10 color: blue ] win: make face! [ type: 'window size: 800x600 pane: reduce [face1] ] view/no-wait win append win/pane make face1 [offset: 150x150 color: red] show win do-events
view/win instead of view/no-wait show do-events works as expected.show isn't meant for that I think, only for updating facesshow with window face might be necessary. and it was working before, and should not be crashed anyway.#217c43e, but system/build/git/commit, done in that latest version, is #ef39a37.system/build/git/commit is gotten from the wrong source, OR it is random.red-latest-source.tar.gz from red-lang.org about 12h ago, the commit message was from 3 days ago, hash random, date currentRed:>> load "a {^M^/}"
== [a
"^M^/"
]Rebol2 & Rebol3:>> load "a {^M^/}"
== [a "^/"]>> load {"^M^/"}
*** Syntax Error: invalid value at {"^M"}
*** Where: do
*** Stack: load"{^^M^^/}"load mess with line terminators in any way? In practice you shouldn't be loading something like that in the first place, but if you were, wouldn't you expect load to not mess with it?decode-url. It accepts a string! argument according to the spec, but since the implementation applies mold -- for good reasons -- the parsing of that molded string will fail consistently. What can we do about it? Drop the possibility of providing a string?view [s: scroller with [selected: 0.5] button "set" [s/selected: 0.5]]view [
b1: Rich-text 100x100 Red
b2: Box 100x100 Blue
b3: Field 100x100 Forest
b4: Text 100x100 Teal
return
button "Count" [
n: 20
until [
n: n - 1
b1/text: b2/text: b3/text: b4/text: form n
wait 0.1
;; show [b1 b2 b3 b4] <-- makes no difference
;;show b1/parent ;; <-- magic line to update all displayed faces
n = 0
]
]
]Red 0.6.4 for Windows built 28-May-2020/17:51:04+03:00 commit #36857ebread https://qcode.us/codes.html>> s: read https://qcode.us/codes.html
== {<!doctype html>^/<html lang="en">^/ <head>^/ <meta charset="utf-8">^/ <meta http-...
>> find s rejoin [cr lf]
== none{^M^/^M^/ ^M^/ ^M^/ ^M^/read bug thenread http://qcode.us/codes.htmlview [s: scroller with [selected: 0.5] button "set" [s/selected: 0.5]]view [text rate 10 on-time [face/data: stats]]mold when the arg is a url!, but leave it as is if it's a string!.to-url on the argument before calling, I suppose?decode-url being used with strings in the code base. @rebolek or @Oldes, do you know if there's a reason we need to support strings there?decode-url to-url something, but that is one more action to type.binary!... R3 is buggy btw as it has no limit.. R2 handles binary correctly:>> probe decode-url to-binary http://localhost:3/a
make object! [
user: none
pass: none
host: "localhost"
port-id: 3
path: none
target: "a"
]query would be nice feature to have :)Decode-url is a specific name, and the extra calls are not terribly onerous to type. If all it does is add to url!, the added code isn't bad, but then the user is presented with more questions. Do I need to dehex or percent encode strings or binarys before passing them in? If it only takes a URL, that goes away.read/binary them before parsing. It's not binary! technically, but must be in Reddecode-url.decode-ul, supporting binary makes sense also.decode-ul, supporting binary makes sense also.binary! as well. If you are reading a non-UTF-8 page as binary, you will have to decode it to string! before you pass it to decode-url anyway.quantities: ["1" "2" "3" "4" "5" "6" "7" "8" "9"] view [text-list 100x80 data quantities on-select [probe face/selected]]
-1, then I get the correct indexon-changeRed [] Rebol [] run-mode: 'red ; run-mode: 'rebol unview/all panel-contents: layout [button "hi"] main-window: layout [panel-face: panel 300x300 []] either run-mode = 'red [attempt [view/no-wait main-window]][attempt [view/new main-window]] append panel-face/pane panel-contents show panel-face
main-window: layout compose [panel-face: panel 300x300 (copy [])]
layout/only, otherwise you kinda put a window inside another window, which is a hack.append panel-face/pane panel-contents/pane
layout/only it works. Also with panel-contents: make-face/spec 'button ["hi"]do-events there is no error. about
Red 0.6.4 for Windows built 17-Jun-2020/10:34:50+02:00 commit #2ffb932*** Script Error: invalid part argument: none
*** Where: copy
*** Stack: about
--== Red 0.6.4 ==-- Type HELP for starting information. >> probe write http://httpbin.org/put [HEAD] "" == "" >> probe write http://httpbin.org/put [HEAD] *** Runtime Error 1: access violation *** in file: /home/devel/prj/red/gtk/red-github/runtime/datatypes/string.reds *** at line: 932 *** *** stack: red/string/alter 09F72284h F528EE78h -1 0 true 0 *** stack: red/string/concatenate 09F72284h F528EE78h -1 0 true false *** stack: red/simple-io/request-http 125 09F72254h 09F728A4h 00000000h false false false *** stack: red/url/write 09F72254h 00000000h false false false false 09F72244h 09F72244h 09F72244h 09F72244h *** stack: red/actions/write 09F72254h 09F72264h false false false false 09F72244h 09F72244h 09F72244h 09F72244h *** stack: red/actions/write* -1 -1 -1 -1 -1 -1 -1 -1 *** stack: red/interpreter/eval-arguments F54F3D30h F534F8D0h F534F8D0h 00000000h 00000000h *** stack: red/interpreter/eval-code F54F3D30h F534F8B0h F534F8D0h true 00000000h 00000000h F54F3D30h *** stack: red/interpreter/eval-expression F534F8B0h F534F8D0h false true false *** stack: red/interpreter/eval-arguments F54F91F0h F534F8A0h F534F8D0h 00000000h 00000000h *** stack: red/interpreter/eval-code F54F91F0h F534F8A0h F534F8D0h false 00000000h 00000000h F54F91F0h *** stack: red/interpreter/eval-expression F534F8A0h F534F8D0h false false false *** stack: red/interpreter/eval 09F72214h true *** stack: red/natives/catch* true 1 *** stack: ctx||561~try-do F7EFC7CCh *** stack: ctx||561~do-command F7EFC7CCh *** stack: ctx||561~eval-command F7EFC7CCh *** stack: ctx||561~run F7EFC7CCh *** stack: ctx||561~launch F7EFC7CCh *** stack: ctx||579~launch F7EFC310h *** stack: ***_start
write url! [] aren't going to be fixed.main: layout [
h1 "Subpanel Examples"
button "Panel 1" [clear panels/pane append panels/pane panel1 show panels]
return
panels: panel 220x140 []
]
panel1: layout [h2 "Panel 1"]
view mainred
>> to-string #{C2E0}
*** Access Error: invalid UTF-8 encoding: #{C2E00000}
*** Where: to
*** Stack: to-string#{C2E0} in the error message?to-string #{010231}" gives "^A^B1" and to-ref "^A^B1" gives an error message. So your code should also error out.ref! should contain just a subset of chars?to-ref "^A^B1" does not throw an error.@abc^/ or error.ref! a little bit.as may coerce strings around.#[ref! "abc^/"]ref! as a pdf's _name object_, which can be obscure: to-ref "^A^B1" does not give an error but:>> @^A^B1 *** Syntax Error: (line 1) invalid ref at @^A^B1 *** Where: transcode
FROM debian:buster-slim RUN dpkg --add-architecture i386 RUN apt-get update RUN apt-get -y install libc6:i386 libcurl4:i386 WORKDIR /app COPY red-064 ./red RUN /app/red CMD [ "/app/rep" ]
docker build -t red . Sending build context to Docker daemon 11.72MB Step 1/8 : FROM debian:buster-slim ---> 2dae943fc808 Step 2/8 : RUN dpkg --add-architecture i386 ---> Using cache ---> a8c5967ea86a Step 3/8 : RUN apt-get update ---> Using cache ---> 4c1267860895 Step 4/8 : RUN apt-get -y install libc6:i386 libcurl4:i386 ---> Using cache ---> ae232bd20ed0 Step 5/8 : WORKDIR /app ---> Using cache ---> c972fd5f45dd Step 6/8 : COPY red-064 ./red ---> Using cache ---> 7b2ab432d7d4 Step 7/8 : RUN /app/red ---> Running in 21a28f89b4b4 Compiling compression library... Compiling Red console... ^C
red.exe at all.do/args %red.r "-r environment/console/CLI/console.red"console for your platform@ except in emails, and also used percent encoding for files. In Red we now have ref!, and new file! rules that require quoting rather than using percent encoding. There was a lot of design discussion about the pros and cons each way on Rebol's design in that regard.>> foreach val probe reduce [%ab@c %ab %ab@ %"ab@c"][print [type? val tab val]] [«@c %ab «@ %ab@c] email «@c file ab email «@ file ab@c
>> foreach val probe reduce [%ab@c %ab %ab@ %"ab@c"][print [type? val tab val]] [%ab @c %ab %ab @ %ab@c] file ab ref c file ab file ab ref file ab@c
file! values? You can work around it with quoting today, but my gut says it should be supported without quotes. Give it some thought, considering how ref! applies too.%xx@xx would be ambiguous: is it a file or an email?>> a%01@b *** Syntax Error: (line 1) invalid word at a%01@b *** Where: transcode *** Stack: load >> a@b%01 == a@b%2501 >> a@b%2501 == a@b%252501 >> a@b%252501 == a@b%25252501
%ab was unfortunate...>> %31b@c == 1b@c >> to-email " a@b" == %20a@b
% is not always a file?@ should not work as a delimiter in some cases.email/mold used url/mold, which is shouldn't have.system/options/boot is returning string! with local file instead of file!?options/boot consistent with the rest of them, by not changing it. Options/path, OTOH, is changed by change-dir, so it *is* a Red file. system/script/args is just the raw string, which you can load, but the naming doesn't make it clear for a feature that should be used quite heavily. Since they current options don't limit you, the way we'll probably deal with this is to hide them behind a CLI dialect.file! types.sort/compare on vector with floats:>> sort make vector! [1.0 3.0 2.0] == make vector! [1.0 2.0 3.0] ;<--- OK >> sort/compare make vector! [1.0 3.0 2.0] func[a b][a > b] ;<---- CRASHes
sort does not accept all any-string! types? If so, than its specification should not claim that it accepts series!>> sort %cbd *** Script Error: sort does not allow file for its series argument
Red:>> sort reduce [1 1.0 #"c" integer! 1x1 $1 <tag> e@mail "str" %file ()] == [integer! unset "str" %file #"c" 1x1 <tag> e@mail $1.00 1.0 1]
R2:>> sort reduce [1 1.0 #"c" integer! 1x1 $1 <tag> e@mail "str" %file ()] == [unset integer! 1 1.0 $1.00 #"c" 1x1 "str" %file e@mail <tag>]
R3:>> sort reduce [1 1.0 #"c" integer! 1x1 $1 <tag> e@mail "str" %file ()] == [unset! 1.0 1 $1 #"c" 1x1 "str" %file e@mail <tag> integer!]
>> sort reduce [12345678 123456.78901 #"c" integer! 9999x999 $123456 <tag> e@mail "str" %file ()] == [integer! unset "str" %file #"c" 9999x999 <tag> e@mail $123456.00 123456.78901 12345678]
>> v: make vector! [1 0 2 0 3 0 4 0] == make vector! [1 0 2 0 3 0 4 0] >> extract v 2 == make vector! [0 0 0 0 1 2 3 4]
>> v: make vector! [1 444] == make vector! [1 444] >> sort/compare v func [a b][(length? form a) > (length? form b)] == make vector! [1 444] >> sort/compare v func [a b][probe reduce [a b] (length? form a) > (length? form b)] [#"Ƽ" #"^A"] == make vector! [1 444] >> sort/compare v func [a b][(length? form to-integer a) > (length? form to-integer b)] == make vector! [444 1]
text >> a: make vector! [1 0 2 0 3 0 4 0] == make vector! [1 0 2 0 3 0 4 0] >> b: make vector! divide length? a width: 2 == make vector! [0 0 0 0]
vector!'s fault because it's the only series datatype that mixes pre-allocation with initialization.list! type in R2, it was devilish because it was *close* to other series behavior, but not exactly the same. Any benefit you might have gotten from it (linked list vs array) was lost in bugs and extra logic in mezzanines that had to be aware of the differences.>> type? load {'/a}
*** Syntax Error: (line 1) invalid refinement at '/a
*** Where: transcode
*** Stack: load
>> type? load {'//a}
== lit-word! ;<-- I expected invalid refinement! tooCOMPRESS seems to produce a "non-standard" result in Red.Red> compress/deflate "12341234123412341234"
== #{3334323641C700}
R2> head clear at tail remove/part compress "12341234123412341234" 2 -8
== #{333432363144C300}
R3> head clear at tail remove/part compress/gzip "12341234123412341234" 2 -8
== #{333432363144C300}view ... This is an example of the running exe game: foreach-face GameData/CaveFace [
if face <> f [
if overlap? face f [Ret: face exit]
]
]exit while testing, knowing that in addition to exiting the function it breaks the foreach-face loop. I forgot to remove it, strangely in the console it works fine, ignored?>> do %./red/tests/source/units/regression-test-red.red ~~~started test~~~ regression-test *** Script Error: has no value *** Where: do *** Stack: do-file
*** Runtime Error 1: access violation *** in file: .../red/runtime/unicode.reds *** at line: 145 *** *** stack: red/unicode/cp-to-utf8 115 00EFF000h *** stack: red/unicode/to-utf8-buffer 0289A464h 00EFF000h 58781 *** stack: red/lexer/scan-alt 0289A474h 0289A464h 58781 false true true false 0019FAACh 00000000h *** stack: red/natives/transcode* true -1 -1 -1 -1 -1 -1 -1 *** stack: load *** stack: do-file *** stack: red/natives/do* false -1 -1 -1 *** stack: red/interpreter/eval-arguments 0289A274h 030F5630h 030F5630h 00000000h 00000000h 02DE0BA8h *** stack: red/interpreter/eval-code 02DE0BA8h 030F5620h 030F5630h false 00000000h 00000000h 02DE0BA8h *** stack: red/interpreter/eval-expression 030F5620h 030F5630h false false false *** stack: red/interpreter/eval 0289A254h true *** stack: red/natives/catch* true 1 *** stack: ctx||560~try-do 027D1DACh *** stack: ctx||560~do-command 027D1DACh *** stack: ctx||560~eval-command 027D1DACh *** stack: ctx||560~run 027D1DACh *** stack: ctx||560~launch 027D1DACh *** stack: ctx||594~launch 027D1528h
>> do %tests/source/units/regression-test-red.red ~~~started test~~~ regression-test *** Runtime Error 1: access violation *** at: 7750C23Eh
view [box white [request-file] box blue [print "ok"]]
scan fails to infer any literal form from the string you give to it (because there's no valid literal, strictly speaking). What would you expect as a result? comment!?none as for scan "" because (I thought) it strips all the comments and there will be an empty string left.img: load tmp b/image: img prog: copy rejoin ["exiftool " form tmp " > exif.txt"] call/wait/shell prog clear a/text a/text: read %exif.txt
Call has a *lot* of code in it. MacOS uses the POSIX logic, so there may be a difference there from other *nixes.-t macOS packs the binary into macOS bundle, whereas -t Darwin (which I think is also a default target) avoids that and gives just an executable.call when it fails?home: select list-env "HOME" appDir: rejoin [home "/Programmation/Red/Virginia/"] exifFile: to-file rejoin[appDir "exif.txt"] change-dir to-file appDir
prog: copy rejoin ["/usr/local/bin/exiftool " form tmp " > " exifFile]
exiftool should work OK, provided that /user/local/bin is in your $PATH. But relative paths to files will become wrong once binary is packed inside a bundle, that's one extra folder to /../ over./user/local/binsuch as Tesseract, ExifTool ... work. Thanks very much for insight.>> to-pa: to paren! [one 2 "three"] == (one 2 "three") >> type? first to-pa == word! >> li-pa: (one 2 "three" 4:00) *** Script Error: one has no value
paren! is evaluated, and so is one inside it. Use quote to suppress evaluation.>> li-pa: quote (one 2 "three" 4:00) == (one 2 "three" 4:00:00)
res: make hash! 40 loop 40 [insert res "ok"] ; ok up to loop 30, crashes from 40 up
Red 0.6.4 for Windows built 17-Aug-2020/6:17:33+03:00 commit #0084083select instead of as index as it was in Rebol2?R2:>> b: [1 2 1.0 3] b/1.0 == 1 >> b: [1 2 1.0 3] b/2.1 == 2 >> b: [1 2 1.0 3] select b 1.0 == 3
Red:>> b: [1 2 1.0 3] b/1.0 == 3 >> b: [1 2 1.0 3] b/2.1 == none >> b: [1 2 1.0 3] select b 1.0 == 3
vector! type:>> v: make vector! [1 2 3] == make vector! [1 2 3] >> v/1 == 1 >> v/1.0 == none ;<-- if cannot be used as index, than it should throw an error like bellow >> v/a *** Script Error: word type is not allowed here *** Where: catch *** Stack:
system/script/args intended?% ./red sdf *** Access Error: cannot open: sdf *** Where: read *** Stack: --== Red 0.6.4 ==-- Type HELP for starting information. >> probe system/script/args "'sdf'" == "'sdf'" >> probe system/build/date 15-Jul-2020/13:52:00 == 15-Jul-2020/13:52:00
block/(x / y)select, then the result is expected.>> select make vector! [1 2 3] 1 == 2 >> select make vector! [1 2 3] 1.0 == none
select, or do we want to coerce it implicitly and have it pick. Right now I vote for select, so integer! is the only picker.>> save %delme [1] >> a: load %delme == [1]
>> save %delme [1] >> a: load %delme == 1
Note that if the file only contains a single value like an integer or date, the result will be that value. but no explanation why it is like that.>> save %delme [1] read %delme == "[1]" ; <-- shouldn't be "1"? >> save %delme [1 2] read %delme == "1 2"
transcode read %delme ; == [1]write
>> write %delme [1] load %delme == [1] >> write %delme [1 2 "end"] load %delme == [1 2 "end"] >> write %delme 23 load %delme == 23
>> load "1" == 1 >> load "1 2" == [1 2] >> load "[1]" == [1] >> load "[1 2]" == [1 2]
[1] *should* save it as [1] and not 1 - that would be also more natural, don't you think?write treats it. But from the other side, there is logic also in current save behaviour. When saving a block, I am saving data in the block. If there is single element in the block, single element is saved. If I need saving data always as block (not just data in the block) I should either write the block or wrap it into another block. >> save %delme [1] >> print read %delme Rebol== [1] Red== 1
save first block. But I'm not doing that, I am saving block!.loop 5 [prin "x"]
Red [] loop 5 [prin "x"]
red test.red), prints "xxxxxxxxxxxxxxxx" (that is 16 times "x")...-cli--cli .--cli.Red 0.6.4 for Windows built 12-Sep-2020/2:32:50+03:00 commit #0663cfc>> parse "a" [if (true) "a"] == true >> cond: quote (true) parse "a" [if cond "a"] *** Script Error: PARSE - unexpected end of rule after: if *** Where: parse *** Stack:
if cond to work.if (cond) but anywaycond is just a word.f: func[] [
loop 500 [append t/data "aaa"]
]
view [
t: text-list 200x400 data []
button [f]
]*** Runtime Error 1: access violation *** at: 00433735h
system/view/auto-sync?: false and show after append. save/load, feel free to propose a better design. Be sure to include behavior for load + /all /part /length. And if someone can test load/into that would be great. Doesn't work here right now.out is defined [here](https://github.com/red/red/blob/master/environment/functions.red#L418) but then redefined [here](https://github.com/red/red/blob/master/environment/functions.red#L446) so I'm not sure what's the point of /intoout gets set to a new result, rather than using the buffer that may have been passed in. The unless line above it might also be clearer, where it returns a single value, by using system/words/all [all ...save uses mold/only. This is the behavior in question. We don't know Carl's original reasoning either./all is not the same behavior for save and load. That is, we have two formats that can be used when saving, and loading handles both without a refinement.Load is smart enough to not "double block" (by default).>> s == "a: 1 b: 'test" >> load s == [a: 1 b: 'test] >> ss == "[a: 1 b: 'test]" >> load ss == [a: 1 b: 'test] >> load/all ss == [[a: 1 b: 'test]]
Mold/only may be a poor refinement name, because /only normally means "treat as a single value", it does the reverse here, omitting brackets for blocks. That makes it redundant with form, but there is no form/all. mold/all/only = form mold/all. Removing mold/only would be a breaking change, but it's only used a few places in the codebase. Save is 2 of them. However, form and mold are the user and source form serializers, when it comes to intent in reading code. When I see form, I think of human consumption as the goal, and when I see mold I think of load and programmatic consumption.map!, you get a map literal. When you save an object, you get a series of values that you have to reduce to get an object again.save and get a friendly file is a nice feature. Intent plays a part here too. I tend to use save/load for anything Red, and read/write if I'm dealing with non-Red data. For config files, we don't want the extra block characters in there, because lines of key: value pairs is clean and human friendly.save saves a block as a block, what does the (common) case look like to save without brackets?>> save %delete-me form b
>> read %delete-me
== {"a 1 b 2"}save/only to match mold/only, but is backwards from other /only uses? Save/all could do double duty, which makes more work if you want serialized for with no brackets. Then we have /header. Does it change how blocks are saved?>> save/header %delete-me b [header: 'data]
>> read %delete-me
== {Red [^/^-header: 'data^/]^/^/a: 1 b: 2}Red [
header: 'data
]
[a: 1 b: 2]load/all. If you don't use /all you *may* get a single value, and that's also a really handy feature. No, it's a vitally useful feature.save/only, which saves blocks as blocks?**mold/only as backwards in my mind, but I can honestly say it's never bothered me. One of those things that isn't quite right if you think about it, but works fine in use. The alternative is to find a new refinement name, which is probably why Carl chose it. :^)save uses mold/only. This is the behavior in question. We don't know Carl's original reasoning either.[] when saving a block with length greater than one is because it is not really desirable to force programmers to put [] around their scripts. So, if you load a script and then save it you don't get extra [] around it.save and load are doing. In principle, none of this is necessary, things just get a little uglier.save/only. I can't see any benefit at all from save %file [1] writing "1" instead of "[1]".>> print [1] 1 >> a: [a b c] insert a [1] == [a b c] >> a == [1 a b c]
save writing "1" only creates more confusion and more work for the programmer.Red [] print "sdf" using latest master sources with -r, -e and plain compilation, I get an error:REBOL/Core 2.7.8.4.3 (6-Jan-2011) Copyright 2011 REBOL Technologies REBOL is a Trademark of REBOL Technologies All rights reserved. Finger protocol loaded Whois protocol loaded Daytime protocol loaded SMTP protocol loaded ESMTP protocol loaded POP protocol loaded IMAP protocol loaded HTTP protocol loaded FTP protocol loaded NNTP protocol loaded Script: "Red command-line front-end" (none) Script: "Encap virtual filesystem" (21-Sep-2009) ** Syntax Error: Missing ] at end-of-script ** Near: (line 1703) ][
]disappeared during conflict resolution. case misses ] and belongs to the case further down below.draw block placed after a keyword are not parsed as expected:>> about Red 0.6.4 for Windows built 3-Oct-2020/14:36:02+02:00 commit #0879e83 >> view [box white draw [pen red line 0x0 end: 20x20]] *** Script Error: invalid Draw dialect input at: [0x0 end: 20x20] *** Where: ???
draw dialect. view [box white draw [pen red a: line 0x0 20x20]] would work, and you can access as a/3.; this works as expected: >> take/part back tail block: [a b c d] find block 'c == [c] ; I expect to get [c d] here, not NONE >> take/part tail block: [a b c d] find block 'c == none
write %halt-test.red "Red []^/halt"
do %halt-test.red
*** Throw Error: no catch for throw: halt-request
*** Where: do
*** Stack: do-filewrite %halt-test.red "Red []^/halt" attempt [do %halt-test.red]
link-text: function [ text-tgt text-src ] [ text-tgt/text: text-src/text ]
== func [text-tgt text-src][text-tgt/text: text-src/text]
>> F1: make reactor! [ text: "F1" ]
== make object! [
text: "F1"
]
>> F2: make reactor! [ text: "F2" ]
== make object! [
text: "F2"
]
>> G1: make reactor! [ text: "G1" ]
== make object! [
text: "G1"
]
>> G2: make reactor! [ text: "G2" ]
== make object! [
text: "G2"
]
>> probe re-res: react/link :link-text [ F1 F2 ]
func [text-tgt text-src][text-tgt/text: text-src/text]
== func [text-tgt text-src][text-tgt/text: text-src/text]
>> probe re-res: react/link :link-text [ G1 G2 ]
func [text-tgt text-src][text-tgt/text: text-src/text]
== func [text-tgt text-src][text-tgt/text: text-src/text]
>> probe re-res: react/unlink :link-text [ G1 G2 ]
none
== none>> save %/r/test.txt new-line/all [1 "a"] true
>> to-string read %/r/test.txt
== {^/ 1 ^/ "a"^/}{1^/"a"} (without indentation and new lines at head and tail)... what about others?CRLF on Windows.write/lines to have what I want, but still don't know, if there should be the indentation when save is used.molding values (and can be disabled with mold/flat). Since save works on the level of textual data format, it makes sense for it to apply indentation and preserve new-line markers. I would personally prefer tabs instead of spaces though, because that would be consistent with the official style guidelines, but that's a nitpicking.new-line is used. Anyway.. write/lines is good enough. It came to my attention because the LF vs CRLF.write/lines/binary could always use LF and write/lines system dependent newlines (CRLF on Windows).save) into *.txt file, should use host's line endings. >> quit *** Access Error: cannot open: %/Users/sony/.red/.Red-Console/console-cfg.red *** Where: write *** Stack: quit _save-cfg save >> ls *** Access Error: cannot open: %/Users/sony/Code/csa-scrapers/ *** Where: read *** Stack: ls list-dir
read-thru or some other operations with cache.repeat i 1000 [link: probe rejoin [http://duckduckgo.com?q= i] read-thru link query path-thru link]
i = 249:(...) http://duckduckgo.com?q=249 *** Access Error: cannot connect: http://duckduckgo.com?q=249 reason: timeout *** Where: read *** Stack: read-thru
>> repeat i 1000 [link: probe rejoin [http://duckduckgo.com?q= i] read-thru link query path-thru link] http://duckduckgo.com?q=1 http://duckduckgo.com?q=2 http://duckduckgo.com?q=3 http://duckduckgo.com?q=4 *** Access Error: cannot open: %/Users/sony/.red/cache/19/1936D57409D65FDF0B03BB7EF5EC641F *** Where: read *** Stack: read-thru
i = 21. When trying it again, it fails with timeout on first read (remember this is reading from cache, so timeout error makes no sense). However, unlike on macOS, it's possible to read from local filesystem.quit, ls etc work fine after that.react is that it's implementation is small, and all mezzanine level. Makes finding bugs much easier.>> find [100% 1 1.0] 1.0 == [1.0]
find/same maybe pure find could be more forgiving, couldn't be?100%. If so, what about this?>> find ["a" %b @c] @c == [@c]
/same isn't a great fit, though the best of the current refinements, as scalars don't have an identity.find ["a" %b @c] @c argument. How it is related?/strict refinement as a way to force type checking, but find already has a lot of refinements. Without a use case, I vote to keep it as it is. /same?Use "same?" as comparator. but as @Oldes proved, that's not true, as simple find uses same-like comparison. What is in code is not a proof IMO, you could dismiss any bug with such reasoning.same just like strict-equal. This is a convenience, but also...hmmm. Scalars have no identity, which is what same? is all about. So there's overlap here./same is for identity comparisons on series and objects. e.g.>> a: b: "123" c: copy a == "123" >> same? a b == true >> same? a c == false
/strict but also mentioned that find already has a lot of refinements. Which brings me to a design problem that refinements aren't good fit for flexible functions like find. Maybe, after having two or three refinements, we just should stop, look at we are doing and rethink the function design and probably switching to some find dialect instead of a function with 10 refinements./compare for sort strikes a nice balance, which could also work for find. You'll take a performance hit, but then you have total control.fin very often. It's shallow, I would need /deep refinement most of the time, so I usually switch to parse instead giving me more control and having more readable code than find with its 10 refinements. For strings find is great though.>> find ["c" %c @c] @c == [@c] >> "c" = @c == true >> %c = @c == true
find ["c" %c @c] @c should match "c", correct?same?. That solves the problem too, yes?/case overlap with /same for matching specific word types./case and use /strict as its new name, which is more accurate for general use.find/select, so we can look at everything in one place?find-related issues on the bug tracker, that's all I know. Both searching and sorting need to be thoughtfully reviewed and axiomatized at some point.find/compare not too bad performance-wise would be to accept a word! (in addition to function!) and select one of the fast internal comparators (eg. equal?, strict-equal?, and so on...).find the spec document saysNote that the function find uses an equality test which differs from strict-equal? in that it ignores case differences in values of types in any-word! and any-string!
$ cat 1.red
Red []
print "hell-o"
$ red
--== Red 0.6.4 ==--
Type HELP for starting information.
>> ls
>> read %1.red
== {Red []^/print "hell-o"^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@...
>> do %1.red
*** Syntax Error: script is missing a Red header: 1.red
*** Where: do
*** Stack: do-file cause-error>> ? system/words *** Runtime Error 1: access violation *** at: 0809BD98h
>> to float! %1 == 1.0
0.01?>> %0 < %100 == true >> %1 < %100 == true >> %2 < %100 == false >> %99 < %100 == false >> %101 < %105 == true >> %99 < %105 == false >> %104 < %105 == true >> %104 < %190 == true >> %5 < %190 == false
to float! %1 is 1.0 and not 0.01?file!.>> load "a b/c d://e/f 6" == [a b/c d://e/f >> load "a d://e(x)f g" == [a d://e
load problem, there's some weirdness in url handling, I've reported an URL-related problem https://github.com/red/red/issues/4687 and obviosly there are others also..bat batch file with full path of Red and put that file in your PATH.rc.bat I put that in my PATH:@echo off c: cd C:\Users\endo\Documents\Red\red\build\bin red --cli --catch user.red
user.red file which I have a bunch of helper functions I use regularly. C:\ProgramData\Red, copy the latest console executable AND crush DLL into your PATH. Then you can start it from any path. But remember, it is not the Red compiler, it is the Red console itself.>> type? first [/a:] *** Syntax Error: (line 1) invalid refinement at /a:]
>> type? first [/a:] *** Syntax Error: (line 1) invalid refinement at /a:] >> about Red 0.6.4 for Windows built 23-Oct-2020/20:58:48+03:00 commit #d95df53
>> o: object [a: 1]
== make object! [
a: 1
]
>> make o #(b: 2)
*** Syntax Error: b: 2 invalid construction spec at none
*** Where: make
*** Stack:map! would be supported in above objects construction. The same way like if manually converted to block:
`>> make object! #() *** Syntax Error: invalid construction spec at none *** Where: make *** Stack:
>> make object! [1 2 b: 3]
== make object! [
b: 3
]alert "hello". One must quit it. >> make date! ["a"] *** Script Error: cannot MAKE/TO date! from: ["a"] *** Where: make *** Stack:
>> make object! #()
== make object! [
]
>> make object! #(a: 1)
== make object! [
a: 1
]
>> make object! #(1 2 a: 1)
== make object! [
a: 1
]cannot MAKE/TO object! from: #() looks good to me.>> alert "hello" *** Script Error: img needs a value *** Where: set *** Stack: alert
alert at work.to map! to block! obj?construct to block! map? ;)>> m: #(a: 'a b: b: c: :c)
== #(
a: 'a
b: b:
c: :c
)
>> construct to block! m
== make object! [
a: 'a
b: :c
c: :c
]construct try to be smart here? I think that the whole point of construct is not to do things like that.o: object [ parent: self number: 1 c: object [ number: parent/number name: "Apple" ] ] to-json o
>> to-json o *** Internal Error: stack overflow *** Where: = *** Stack: to-json
construct should not try to be smart. construct should be dumber. make, so you wouldn't then be able to easily mix, or change, safe and unsafe object construction, as the results would be very different. Whereas, if you need that (much rarer) behavior, you can wrap this logic to achieve it.object [
a: quote 'a
b: quote b:
c: quote :c
]construct. The other use case for construct [a: b: c: none] doesn't seem that likely, since if you're doing that then object works just fine.object [a: 1 print "Hello!" ]. To me, object specs are not strictly key value pairs, but a dialect. Do we want to change that?construct's default behavior is also a compatibility point. construct is a different thing and can have different behavior, I'm not aginst change there.make object!... construct was added to R2 exactly because of that... (in particular, R2 already had the code for it for loading the REBOL header, it was just made available as a native).to object! for map would solve this problem a different way (and wouldn't break anything)make object! should be changed :)drop-down widget shouldn't instead of resizing to fit any data, instead have at least an ability to have a fixed size and instead have horizontal scrolling (without scrollbar, but by using left/right arrows and holding and dragging pressed mouse button to the right).field already works like that (horizontal scrolling without scrollbar) so I think drop-down should behave the same?view [drop-down 100 "long long long long long loooooong text"]field once when I specified wrap flag for it, so this must be another face flag got wrong. I think drop-down should allow both entering text longer than it's size and allow you to navigate this long text.view [drop-down 100 data ["long long long long long loooooong text"] wrap select 1] won't let me scroll the "long long" string or enter more characters than fit 100 pixels. It allows editing it but shows the caret in the wrong place (before the last visible char regardless if it's further away)drop-down and looks like what's missing compared to field is ES_AUTOHSCROLL. I dunno though how the behavior on other view backends behaves.CBS_AUTOHSCROLL, but thanks for looking into it. to object! for map would solve this problem a different way (and wouldn't break anything)>> do/args %red.r "-o redpi -t rpi environment/console/CLI/console.red" Script: "Red command-line front-end" (none) Script: "Encap virtual filesystem" (21-Sep-2009) -=== Red Compiler 0.6.4 ===- Compiling /home/sony/code/red/environment/console/CLI/console.red ... Compiling libRedRT... ...compilation time : 1536 ms Compiling to native code... *** Driver Internal Error: Math Error : Math or number overflow *** Where: emit-prolog *** Near: [emit-i32 to char! shift/left 1]
b: #{} save b 1 save b 2, but in Rebol the result is #{310A320A} while in Red just: #{3132} (no LF). I wonder what is more useful?>> b: #{} save b 1 save b 2 save b #{03} print to-string b
1
2
#{03}>> b: #{} save b 1 save b 2 save b #{03} print to-string b
12#{03}>> s: "" save s 1 save s 2
== "#{31}#{32}"write/info under Linux, using latest build (~/prj/red/red-02nov20-3147cac13 -c -d write_test.red, compilation with -r always gives same results). When I compile this:probe 7 write/info https://google.pl/ [GET]
./write_test 7 *** Runtime Error 1: access violation *** at: F7E537D1h
write/info https://google.pl/ [GET]
./write_test
*** Access Error: invalid UTF-8 encoding: #{EA706E61}
*** Where: write
*** Stack:write/info https://quitter.pl/ [GET]
./write_test
> >> s: "" save s 1 save s 2
> == "#{31}#{32}"
>>> s: "" save s 1 save s 2
== "1 2"
>> s: "" save s to binary! "1" save s to binary! "2"
== "#{31}#{32}">> s: "" save s "5"
== "#{223522}"save is the oposite of load. So, after loading saved data we should get same data. When we save integer to a string, then after loading that string we should get an integer, not a binary data containing string representation of that integer right?>> s: "" save s 1
== "#{31}"
>> load s
== #{31}
>> type? load s
== binary!>> save s: #{} 1
== #{31}
>> load s
== 1
>> save s: "" 1
== "#{31}"
>> load load s
== 1
>> save s: {} to-binary "abracadabra"
== {#{237B363136323732363136333631363436313632373236317D}}
>> load load load s
== abracadabras: "" save s 1 save s 2 could result in: 1^/2^/ (I'm not sure, if it should not also use os line breaks, so it could be 1^M^/2^M^/ on Windows)> $ file `which red` [±dev ✓]
/Users/bkeller/.local/bin/red: Mach-O executable i386
bkeller@bkeller-mac19 ~/src/plfa [9:51:25]
> $ file /usr/bin/grep [±dev ✓]
/usr/bin/grep: Mach-O 64-bit executable x86_64>> obj: make object! [a: none b: none]
== make object! [
a: none
b: none
]
>> obj2: make obj [b: 22 set 'a 'x]
== make object! [
a: 'x
b: 22
]a shoud be x and not 'xmold object>> obj2: make obj [b: 22 set 'a 'x]
== make object! [
a: 'x
b: 22
]
>> obj2/a
== x
>> obj2: make obj [b: 22 set 'a quote 'x] ;<---- NOTE, it is quoted, so it is a LIT-WORD!
== make object! [
a: 'x
b: 22
]
>> obj2/a
== 'x[make object![....]] inside a block and I have thought for a lot of time that the make object! instruction was inside that block. Instead it was Rebol object. The confusions happened because the instruction to make it and the molded object visually identical. The same has happened for functions. mold/all... and because Red wants to be compatible and it doesn't have mold/all itself...mold would be useless for objects (which are often saved and loaded back).mold/all at all, it should be the default behavior. But now we have Redbin which would be more useful for saving objects, so meh.mold is the final formatting for console output, having mold/all as a default would be very frustrating in situations like:>> mold/all tail "very long series"
== {#[string! "very long series" 17]}make object!. Was this the original purpose?... load mold (aside from the extra steps needed as mold doesn't give you just the object spec), it should round-trip cleanly unless you have cycles.mold/all yet, and serialized syntax is not frozen, now is a good time to think about this.; R2 >> make string! none == "" ; R3 >> make string! none ** Script error: cannot MAKE/TO string! from: none ** Where: make ** Near: make string! none ; Red >> make string! none *** Script Error: cannot MAKE/TO string! from: none *** Where: make *** Stack:
form or to.copy ""?make string! was meant mainly for series preallocation with integer value and so when there is none, it should warn you, that there is probably some problem with your code.delta-profile:>> dp [make string! ""]
== make object! [
timer: 0:00:00.000002
evals: 2
eval-natives: 1
eval-functions: 0
series-made: 1
series-freed: 0
series-expanded: 0
series-bytes: 8
series-recycled: 0
made-blocks: 0
made-objects: 0
recycles: 0
]
>> dp [copy ""]
== make object! [
timer: 0:00:00.000002
evals: 1
eval-natives: 1
eval-functions: 0
series-made: 1
series-freed: 0
series-expanded: 0
series-bytes: 8
series-recycled: 0
made-blocks: 0
made-objects: 0
recycles: 0
]>> select dp [make string! 100] 'series-bytes == 128 ;<-- resulted series with space for 127 bytes (the last one is internally used for null byte)
>> select dp [""] 'series-made == 0 >> select dp [copy ""] 'series-made == 1 >> select dp [make string! 1] 'series-made == 1
make string! none does not give you any advantage.. and I believe that is the reason, why it's not supported in R3 even when it was in R2.make string! none does not give you any advantage.. and I believe that is the reason, why it's not supported in R3 even when it was in R2.>> #a/b *** Syntax Error: (line 1) invalid issue at #a/b *** Where: case *** Stack: load >> #@ *** Syntax Error: (line 1) invalid issue at #@ *** Where: case *** Stack: load >> #a@b == @b ;<------- there should be error like above
#foo@somewhere.com may be valid email :-/#, that's an issue! in our world. @b is a valid ref!, so that's not a bug.>> [#a@b] == [#a @b] >> type? second [#a@b] == ref!
@ should be a delimiter?[#a /b].@ delimiter?ref! type.>> 1:0[] == [] >> 1:0@a *** Syntax Error: (line 1) invalid time at 1:0@a *** Where: case *** Stack: load
>> type? load {/<}
== refinement!
>> type? load {/>}
== refinement!
>> type? load {>:}
== set-word!
>> type? load {<:}
*** Syntax Error: (line 1) invalid word at <:
*** Where: transcode
*** Stack: load< op, but that should be protected using protect once available.>> type? load {/2nd}
== refinement!
>> type? load {'2nd}
*** Syntax Error: (line 1) invalid word at '2nd
*** Where: transcode
*** Stack: load/2nd should not be allowed... as is not allowed:>> type? to refinement! {2nd}
*** Syntax Error: (line 1) invalid integer at 2nd>> /1 == /1 >> about Red 0.6.4 for Windows built 18-Nov-2020/3:13:59+01:00 commit #8ee5a9f
To on refinement is simply because it inherits it from word, while issue overrides it. @Oldes please open a ticket for that. If something loads, to should work as well.#123-456 should be disallowed and @Oldes' ordinal example is a really nice one. /2nd vs #2nd looks and reads better to me. Nice to have for dialect use? Absolutely. Causes issues if wanting to convert to any-word! types? Same as issue!.any-refinement! typeset, with alpha-refinement!, numeric-refinement!, alphanum-refinement!, and can-start-with-num-refinement! types in it. But what we also have to keep in mind is...the human mind. How we group, store, and process information. >> to-word "a b" == a >> to-string to-word "a b" == "a"
>> to-word "a b"
== a b
>> to-word "a{b}"
== a{b}to word! should throw an error in such case IMO.to there is a bug, and an error is probably best. That doesn't mean we'll be able to plug every hole for creating non-lexable values through type coercion.Compiling compression library... Compiling Red console... *** Compilation Error: incompatible operand types in math or bitwise operation *** in file: %/Users/francoisjouen/modules/view/backends/macOS/delegates.reds *** in function: exec/gui/render-text *** at line: 1205 *** near: [temp 2]
Compiling to native code...
*** Compilation Error: incompatible operand types in math or bitwise operation
*** in file: %/Users/fjouen/Programmation/Red/Virginia/libs/core/rcvCore.red
*** in function: exec/rcvConvert
*** at line: 2514
*** near: [
g: as integer! ((gf / sf) * 255)
b: as integer! ((bf / sf) * 255)
]255 to float.>> g: func [ctx] [probe ctx] f: func [/local a b c] [g context? 'a] == func [/local a b c][g context? 'a] >> f
context not available outside function type error, instead stack overflowed and console printed the following data:*** Internal Error: stack overflow *** Where: ctx *** Stack: f g probe g probe g probe g probe g probe g probe g probe g probe g probe g probe g p robe g probe g probe g probe g probe g probe g probe g probe g probe g probe g probe g probe g p robe g probe g probe g probe g probe g probe g probe g probe g probe g probe g probe g probe g p robe g probe g probe g probe g probe g probe g probe g probe g probe g probe g probe g probe g p robe g probe g probe g probe g probe g probe g probe g probe g probe g probe g probe g probe g p robe g probe g probe g probe g probe g probe g probe g probe g probe g probe g probe g probe g p ...
g.>> g: func [ctx] [probe :ctx] f: func [/local a b c] [g context? 'a] == func [/local a b c][g context? 'a] >> f func [/local a b c][g context? 'a] == func [/local a b c][g context? 'a]
g in it.context? does it?boundRed [file: %pwd.red] probe to file! get-env "PWD" probe what-dir
red scripts/pwd.red, I get two different results:%/home/red/ %/home/red/scripts
what-dir returns curremt directory, not script's directory. Or is there any other way to check current dir?>> to date! to string! now *** Script Error: cannot MAKE/TO date! from: "27-Nov-2020/1:58:08+01:00" *** Where: to *** Stack:
do a script in directory scripts/ than what-dir must return this directory (as it does), so any do in this script is relative to this location.system/script fields when do %some/script.red is called.%/r/dir1.reb:Red [title: "dir1"] Rebol [title: "dir1"] print "==[1]==" current-dir: what-dir ? current-dir ? system/options/path ? system/script/path print "" do %subdir/dir2.reb print ""
%/r/subdir/dir2.rebRed [title: "dir2"] Rebol [title: "dir2"] print "==[2]==" current-dir: what-dir ? current-dir ? system/options/path ? system/script/path
>> what-dir == %/C/Users/Oldes/Downloads/ >> do %/r/dir1.reb Script: "dir1" Version: none Date: none ==[1]== CURRENT-DIR is a file of value: %/r/ SYSTEM/OPTIONS/PATH is a file of value: %/C/Users/Oldes/Downloads/ SYSTEM/SCRIPT/PATH is a file of value: %/r/ Script: "dir2" Version: none Date: none ==[2]== CURRENT-DIR is a file of value: %/r/subdir/ SYSTEM/OPTIONS/PATH is a file of value: %/C/Users/Oldes/Downloads/ SYSTEM/SCRIPT/PATH is a file of value: %/r/subdir/
>> what-dir == %/C/Users/Oldes/Downloads/ >> do %/r/dir1.reb ==[1]== CURRENT-DIR is a file! value: %/r/ SYSTEM/OPTIONS/PATH is a file! value: %/r/ SYSTEM/SCRIPT/PATH is a none! value: none ==[2]== CURRENT-DIR is a file! value: %/r/subdir/ SYSTEM/OPTIONS/PATH is a file! value: %/r/subdir/ SYSTEM/SCRIPT/PATH is a none! value: none
? output (at least for value info)ls for example. I like the Rebol way of dealing with this.mc for example does modify *PWD* variable when switching folders, although when exiting mc, user is back where she started, also *PWD* is back to state before mc launch. I think Red console should work the same way. Although, with vim . when browsing directories, executing :!echo $PWD or :!touch abc.txt acts, as if we were still in the directory, where Vim was started.? output, sorry ;)call/wait/output "echo $pwd" s: ""Red [file: %pwd.red] probe to file! get-env "PWD" probe what-dir probe (call/wait/output "pwd" s: "" to-red-file trim/lines s) probe (call/wait/output "echo $PWD" s: "" to-red-file trim/lines s)
test@AURA:/home$ red ./test/pwd.red %/home %/home/test/ %/home/test %/home
>> what-dir == %/home/red/ >> get-env "PWD" == "/home/red" >> call/wait/output "echo $PWD" s: "" s == "/home/red^/" >> cd prj == %/home/red/prj/ >> what-dir == %/home/red/prj/ >> get-env "PWD" == "/home/red" >> call/wait/output "echo $PWD" s: "" s == "/home/red^/"
what-dir, call/wait/output "cd" s: "" and call/wait/output "echo %cd%" s: "" give the same output - and it *does* change with cd and do from Red. pwd and echo $PWD is really strange. Google tells that they should be equal (except for symlink handling). Can anyone explain it?calls inherit the wrong $PWD. It makes sense for Red to update PWD then to minimize the number of surprises.request-dir changing the working dir, which it shouldn't. This is an important topic, as I know @toomasv had to deal with it in DiaGrammar, and we all will at some point. Modules, include systems, dynamic systems, all need to have clear docs and predictable behavior when it comes to directory changes and references.Red [file: %pwd.red] probe to file! get-env "PWD" probe what-dir
$ scripts/pwd %/home/red %/home/red/ $ red scripts/pwd.red %/home/red %/home/red/scripts/
>> parse ["abc"] [set s string!] s == "abc"
set-word! for the set and copy parse commands. That is common source of variable leaks when used in function definition, which is not able to find these words in parse rules... like:>> s: 1 f: function[][parse ["abc"][set s string!]] f == true >> s == "abc" ;<--- s was redefined!
s as local in function definition:>> s: 1 f: function[/local s][parse ["abc"][set s string!]] f == true >> s == 1
set-word! after set and copy (so it would be collected by function scanner)?parse ["abc"][set s: string!]
>> s: 1 f: function[][parse ["abc"][s: set s string!]] f == true >> s == 1
set-word! values are used to extract data rather than the set keyword; also copy returns the copy rather than setting a word; note that this solves the problem of automatic locals when using function](https://github.com/giesse/red-topaz-parse)keep copy _ rule? (where rule matching a single char otherwise makes a char! result, matching more chars - string! result)topaz-parse, but it's quite overkill (in many cases) if you need to convert it first into old parse format.parse compatible. Compatibility is an issue, a big one. If Red's parse isn't Rebol compatible, all code that uses it has be reviewed and updated. With fast lexer out now, it's less of an impact but still not free. I don't see that happening in the near future.set supports set-word!, but inside parse, by adding *only* set-word support it's still a bit of a mismatch with set in Red itself. Of course parse is a dialect so that's technically fine. But you use set set-word! very rarely in Red, and not inline, where this pattern would see heavy use in parse' s context. The great and terrible thing about these choices is that you don't know if they're a net win until it's too late.parse. The "great power" thing. However, they *can* simplify some patterns for power users. A less powerful (e.g. things Gabriele left out of his version) but more accessible dialect is a good thing IMO. /local words in function definitions... these are mostly there just because of set and copy words from parse rules.. and as @hiiamboris noted in his request... it is really hard labour work to maintain these in more complex situations.set/get-word! values and instantly trust that they are doing just one thing. So the change may be easy in the code, but have an effect on all users and readers of parse code.set-word! in parse rules solves anything. It's fine, ok, if your parse rules are simple enough to be kept inside a function. But if your rules are bigger, it's better to move them outside of the function and keep them in a context and now you need to manage locals manually, be it words or set-words.x: y: integer!, first being a position marker, second one a set-word! and readability being an issue. I just pointed out, that R2 compatibility is imo not an issue. Well, of course, there is already existing Red code, and here compatibility might surely matter .... parse syntax. So we can test that too.set-word! in parse rules solves anything. It's fine, ok, if your parse rules are simple enough to be kept inside a function. But if your rules are bigger, it's better to move them outside of the function and keep them in a context and now you need to manage locals manually, be it words or set-words.topaz-parse does, it can build objects (well, maps, because of current object limitations) for you, so you don't need any of the words used to be made local externally. Ie. you don't really need to manage locals manually ever. (Unless you specifically choose to do so for some other reason.)topaz-parse, but it's quite overkill (in many cases) if you need to convert it first into old parse format.topaz-parse over parse (otherwise, it was much slower... but you could roll back to the previous interpreted version if needed). that being said, I don't consider topaz-parse to be production ready, so i'm not saying "just use this", i'm saying, i've been trying to raise awareness about these issues you mention for a long time (i designed topaz-parse in 2011).keep copy _ rule? (where rule matching a single char otherwise makes a char! result, matching more chars - string! result)keep will keep whatever is the result of the following rule; so if you use copy, it's a string, because copy always returns a string when parsing a string. if the next rule is one that returns a char, then you get a char. IMHO it's so much easier to model and predict what's going to happen instead of having a huge list of exceptions and special cases.topaz-parse yet, but if it builds objects (maps) wit locals, I'm sold :)>> do %topaz-parse.red
== func [
{Parse BLOCK according to RULES; return last result from RULES if it matches, NONE otherwise}
block [binary...
>> topaz-parse [1 2 3] [object [a: integer! b: integer! c: integer!]]
== #(
a: 1
b: 2
c: 3
)
>> a
*** Script Error: a has no value
*** Where: catch
*** Stack:>> parse [1 2 3][p: 1 skip set x 1 skip to end] == true ;<--- OK >> x == 2 ;<--- OK ;-- using :p in the middle of set rule: >> parse [1 2 3][p: 1 skip set x :p 1 skip to end] == true ;<--- I believe there should be error instead! >> x == none ;<--- ?
topaz-parse is not written directly in Red/System. keep copy _ rule? (where rule matching a single char otherwise makes a char! result, matching more chars - string! result)keep will keep whatever is the result of the following rule; so if you use copy, it's a string, because copy always returns a string when parsing a string. if the next rule is one that returns a char, then you get a char. IMHO it's so much easier to model and predict what's going to happen instead of having a huge list of exceptions and special cases.keep rule / keep pick rule / keep copy _ rule, just without the underscore?set set-word! very rarely in Redset 'word in my code as set [word:] and it certainly helps simplify the code and it's maintaining. Should I mention that I found some leaked words in the process or this is *too* obvious? :Dset [x:] block unrolls the block. So, very limited.topaz-parse is not written directly in Red/System. set/only.remove/key? In the doc-string there is _Removes a key in map._, but it works with any series... and I'm not sure that this was expected result for me:>> remove/key "abcd" #"b" == "ad"
map! series... now it is:>> remove/key [a b b c] 'b == [a c]
== [a b]?>> if pos: find/skip blk: [a b b c] 'b 2 [ remove/part pos 2 ] blk == [a b]
skip 2 on blocks while removing with /key. (Compare e.g. to select)/skiprefinement, where you would be able to skip by the record length. Why do we expect the key-value being only option as pairs?remove/key only on map! and block! (where with block! it would work like if mentioned find/skip lookup)... Maybe also paren! could be allowed as it does not hurt so much as using remove/key on string! or path!matrix [...] from Draw block. Draw block is not key-value pairs, but may contain some. Manipulating it (or some different dialect) surely doesn't *need* remove/key but might use it.remove/key will be ever used (and is not used) in such a situation, because it is case sensitive and so it's not good to be used with dialects, which are supposed to be user friendly and so case insensitive.remove/key [a 1 b 2] 'b
head remove/part find/skip/case [a 1 b 2] 'b 2 2
head remove/part find [a 1 b 2] 'b 2
remove/key behavior is subjectively more useful than what we have. However I find the whole remove/key thing inelegant, and though I don't see a better design for maps, promoting remove/key use on series is not something I would like to see. Just as the whole /skip thing is not a design, it's a horrible crutch, that should be forgotten and replaced with human-friendly table API./skip, unless it is replaced by something bettter! :-)/key is the key-value pair scenario (i.e. /skip 2)? I'll guess *by far* the most common. I think it's also the least surprising, and lets you safely change from maps to blocks without needing to know if values might also be keys.remove/key, but it was the best we could come up with./skip as I do a number of things. It's a low level design feature that lets you build things on top of it. It's better than nothing, but we clearly have some consistency issues with find/select. table/tree work to continue, which ties also to HOF and markup codec. Then we can tie it all together and make HOSS, the Higher Order SpreadSheet. :^)Change doesn't work for maps today. Let's get this one out of the way first. I've pinged Nenad on it.map! and not a block!./part 2 is implied, but it's a closer match to how put/select work. /key. He said it wasn't there, but someone requested it. By design it's a shortcut for the remove/part find 2 idiom. table design...skip (row length) into the block itself. And allow pair addressing for blocks as we have for images. It's not a table replacement, just a saner block/hash interface that is still low-level.head remove/part find/case 2 block! doc page?skip? as part of the R/S cell. The most annoying thing about it is that it is a part of the block (logically), but you have to carry it around manually as if it was a part of operation you perform on data. Imagine if Red values didn't carry their type, and you had to write the type every time you access a value? It's the same kind of nonsense that's happening here.extra field, which is reserved for different uses in other block types?cell! itself, but in the series! buffer, together with block's length. So there should be enough space and also applicable to hash and vector.0 is the sanest reserved value on R/S level. What it would translate to in Red is a matter of convenience (and none seems also sane).1. Could prototype it as a block clone of the current code, but I'd still start at the mezz level to see how the interface works out. But we also need to consider that there is another approach now, which is to use nested blocks for each record. This is where the design part comes in, and where a dialect may still win. With nested blocks you don't have keys at all, they can vary in length, and can be arbitrarily nested. A table model also doesn't think in terms of keys, but indexes, so the find /skip 2, assuming a key for n-sized records is something to play with. Yet another model is column store. This gives you both keys and efficiency for a large number of records, but needs an API for dealing with entire records rather than fields. load-csv has a refinement for that format.>> load-csv "name,rank,id^/1,2,3"
== [["name" "rank" "id"] ["1" "2" "3"]]
>> load-csv/as-columns "name,rank,id^/1,2,3"
== #(
"A" ["name" "1"]
"B" ["rank" "2"]
"C" ["id" "3"]
)
>> load-csv/as-columns/header "name,rank,id^/1,2,3"
== #(
"name" ["1"]
"rank" ["2"]
"id" ["3"]
)>> load {[#{00^/01}]} ;<-- this is ok
== [
#{0001}
]
>> [#{00^/01}] ;<-- this will enter into multi-line input!
{
(escape)
>> [#{00^-01}] ;<-- this will enter into multi-line input!
{
(escape)>> [#{00^/01}]
{ }
{ }
{ }
{ }
{ }>> make "" 1.1 * 100 == "" >> make "" 110% * 100 == "11000%" >> make "" 100 * 110% == ""
>> to integer! #0F == 15 >> to integer! #F == 0 ;<--- ???? >> to integer! #XX *** Script Error: data not in correct format: #XX
16777215 = to integer! #FFF4095 how it is in Rebol2&30 is really strange.4095 is ok, error is ok too, but less ok (because FFF is a valid base 16 number if we abstract from byte thinking);current behaviour:
>> to block! "abc: def"
== [abc: def] ;<---- I think this should be ["abc: def"]
>> to block! #{00}
== [#{00}] ;<--- this is OK1234 you don't think "how many bytes is this?". Why should you think about that when you change the radix from 10 to 16?to is used both ways. That's something to create a matrix for, and see what other holes there are.>> to string! to block! "abc: def" == "abcdef" >> form to block! "abc: def" == "abc def"
0 as a special case. My guess is that the number is vanishingly low. Given that, it's more likely that an odd number of hex digits is a mistake.Ah is not allowed. But you *can* use an odd number of digits there. >> FFFh == 4095.>> to integer! #12345678 == 305419896 >> to integer! #123456789 == 305419896
To only honors 8 chars max, silently truncating. That's bad. I'll say that clearly lies behind the use case of hex colors, but that should throw an error too if the issue is too long. If someone would ticket that, I'd appreciate it.binary/decode-16, so what do binaries do?>> to integer! #{FF}
== 255
>> to integer! #{FFF}
*** Syntax Error: (line 1) invalid binary at }
*** Where: case
*** Stack: load
>> to integer! #{FFFF}
== 65535integer/from-binary also silently truncates at 4 bytes.>> 1000000000 == 1000000000 >> 2000000000 == 2000000000 >> 3000000000 == 3000000000.0 >> 4000000000 == 4000000000.0 >> 5000000000 == 705032704 >> 6000000000 == 1705032704 >> 7000000000 == 7000000000.0 >> 8000000000 == 8000000000.0 >> 9000000000 == 410065408 >> 5000000000 = 705032704 == true >> 6000000000 = 1705032704 == true
>> %%%{...}%%%1
{ }
{ }%%%
{
(escape)
>> load "%%%{...}%%%"
== "..."
>> load "%%%{...}%%%1"
*** Syntax Error: (line 1) invalid string at %%%{...}%%%1>> load "{...}1"
== ["..." 1]; making a series with position past tail... >> a: [1 2 3 4] == [1 2 3 4] >> b: skip a 3 == [4] >> remove/part a 3 == [4] >> b == [] ;<--- looks empty >> empty? b == false ;<--- but its not? >> [] = b == false ;<--- b is past tail, so it's false, but should it be?
[] = b from my code truthy?[] =? b is not truthy (IIRC :D year is a long period)%%%{...}%%%%file is pretty ugly, and hard to see as an error if you're one sigil short at the end. So, worst case, the current behavior is just a bit strict. Something good to note, but probably fine as is.load issue.escape. :^)view [
b: button "The Button" [ halt ]
]*** Throw Error: no catch for throw: halt-request *** Where: = *** Stack: view do-events do-actor do-safe halt
In Rebol 2 :
view layout [
b: button "The Button" [ halt ]
]view [
b: button "The Button" [ 1 / 0 ]
]*** Math Error: attempt to divide by zero *** Where: = *** Stack: view do-events do-actor do-safe
view layout [
b: button "The Button" [ 1 / 0 ]
]** Math Error: Attempt to divide by zero ** Where: func [face value][1 / 0] ** Near: 1 / 0
t: 10:05:12.8 print t print [t/hour t/minute t/second] ; (1)
10 5 12.8
halt - it's a bug right, and I don't believe it was reported, so feel free to do sot is time and is formatted accordingly, but t/second is a float, so mold output with maximum precision is expected for itt: 10:05:12.8 print 12.8 ; no weird decimals print to-float t ; no weird decimals either
The documentation needs reviewing as it indicates that time! holds milliseconds (0.001), see
[https://github.com/red/docs/blob/master/en/datatypes.adoc], though this is not further mentioned in [https://github.com/red/docs/blob/master/en/datatypes/time.adoc] where only decimals of seconds are mentioned.
When testing however, it appears decimals of seconds are rounded to a precision of fraction of a millisecond (0.0001)
I would assume that this the max precision intended. If so, when requesting the seconds, I would expect to get the same. Be aware however that Rebol2 has a bigger precision of max 9 decimals. I don't know why this value was retained, but in any case, it always shows that number of precision if needed and no more.
Still in Rebol2, things do not get messy either when performing an addition.
Final point worth mentioning, though unrelated, I noticed a weird problem in the following case, where mold and form display slightly differently the float value.
`mold outputs with better precision than form. It was done to get rid of "weird decimals" as you call them ;)>> t: 10:05:12.8 == 10:05:12.8 >> to-float t == 36312.8 >> to-float 10:05:00 == 36300.0 >> 36312.8 - 36300.0 == 12.80000000000291
t1: 10:05:12.8 t2: 10:05:00 d1: to-float t1 d2: to-float t2 d1 - d2 t: t1 - t2 t/second
>> t1: 10:05:12.8 == 10:05:12.8 >> t2: 10:05:00 == 10:05:00 >> d1: to-float t1 == 36312.8 >> d2: to-float t2 == 36300.0 >> d1 - d2 == 12.80000000000291 >> t: t1 - t2 == 0:00:12.8 >> t/second == 12.80000000000291
t1: 10:05:12.8 t2: 10:05:00 d1: to-decimal t1 d2: to-decimal t2 d1 - d2 t: t1 - t2 t/second
>> t1: 10:05:12.8 == 10:05:12.8 >> t2: 10:05:00 == 10:05 >> d1: to-decimal t1 == 36312.8 >> d2: to-decimal t2 == 36300.0 >> d1 - d2 == 12.8000000000029 >> t1 - t2 == 0:00:12.8 >> t/second == 12.8
time! does internally when you ask for t/second. When taken as an entire time! value, different formatting rules apply. Once you ask for just seconds, it becomes a float (currently). If you need to display seconds separately, you can use round to control the precision.>> century: 100 * 365.25 * 24:0:0 == 876600:00:00 >> to-float century - (century - 0:0:0.000001) == 9.5367431640625e-7 >> to-float century - (century - 0:0:0.000000001) == 0.0
>> manvantara: 3067200 * century == -2147483648:00:00 >> to float! manvantara - (manvantara - 0:0:5) == 4.0 >> to float! manvantara - (manvantara - 0:0:1) == 0.0
>> append [] 'a/b == [a b]
== [a/b][1 bla 2] into [1 bla/result 2]. Using collect/keep is the sameappend [] [a/b]append works as it does is so you can do this:>> append [John Paul] [George Ring] == [John Paul George Ringo]
[John Paul [George Ringo]] is certainly not something you wanted.path!, but path is series! also so you need to use append/only as @hiiamboris pointed out.append needs to append os to words. @rebolek, may be you should rise an issue :stuck_out_tongue_winking_eye:01-jan-2020 to 01-feb-2020 / 9:00 to 17:00. I ended up using tuple! values to represent each time segment. e.g. CC.YY.MM.DD.HH.MM.SS.XX. A bit wasteful in some ways, but worked well.>> .5 == 0.5 >> .5 ;4 == 0.5 >> .5;4 *** Syntax Error: (line 1) invalid float at .5;4 *** Where: case *** Stack: load
; when merging objects, the second object takes precedence in case of conflicts a: object [ val: 1 ] b: object [ val: 2 wal: 3 ] c: make a b ; works also with functions a: object [ show: does [print "hello"] ] b: object [ show: does [print "chau"] ] c: make a b a/show b/show c/show ; but not when mixed... a: object [ val: 1 show: does [print val] ] b: object [ val: 2 wal: 3 show: does [print [val wal]] ] c: make a b a/show b/show c/show
>> a: make object! [ val: 1 show: does [print val] ] >> b: make object! [ val: 2 wal: 3 show: does [print [val wal]] ] >> c: make a b >> a/show 1 >> b/show 2 3 >> c/show ** Internal Error: Stack overflow ** Where: wal ** Near: wal
a: object [ val: 1 show: does [print val] ] b: object [ val: 2 show: does [print [val wal]] wal: 3] c: make a b c/show ;>> 2 3
.5;4 looks like a regression. Used to work, so likely something in fast lexer.x: 0 a: make object! [ f: does [print x] ] a/f ; >> 0 - a/x is global b: make a [ x: 1 ] b/f ; >> 0 - no rebound of f because f/x is meant global c: do mold b ; create a new object from b spec c/f ; >> 1 - though c/x is set after c/f, x in f and c/x now refer to the same context
unset [a b x c d e f g h i] a: context [x: 1] b: context [f: does [print x]] x: 0 c: make a b d: make b a e: make b [x: 2] f: copy d ; R2 error no copy of object g: copy e ; R2 error no copy object h: make d [] i: make e [] b/f ; 0 == OK c/f ; 0 == NOK - expecting 1 d/f ; 0 == NOK - expecting 1 e/f ; 0 == NOK - expecting 2 f/f ; Red 1 - R2 error - R3 - 0 == OK 1 g/f ; Red 2 - R2 error - R3 - 0 == OK 2 h/f ; Red 1 - R2 1 - R3 - 0 == OK 1 i/f ; Red 2 - R2 2 - R3 - 0 == OK 2
make specifically in that ticket. I'm pushing for copy.view [button "cancel" button "show another"] buttons overlap in Windows 10 and in Wine. Can anybody confirm?"show another" button.>> body-of :is *** Internal Error: reserved for future use (or not yet implemented) *** Where: reflect *** Stack: body-of >> about Red 0.6.4 for Windows built 5-Mar-2019/0:09:36+03:00 commit #53b5b37
request-dir today and I believe it does not work as it should.... now it is (in fresh console):request-dir ; starts in default directory (%/C/Users/[name]) ;== %/C/Users/Oldes/ request-dir/keep/dir %/c/ ; this starts again in default dir but I think it should be in %/C/ ; when I select some folder in above requestor... like %/C/Dev than... ;== %/C/Dev/ ; and I use again: request-dir/keep/dir %/c/ ; than is starts in %/C/Dev but /dir should be used and so it should be in %/C/
/keep is used with /dir than /dir should be used as a start and /keep should just store the result./keep than it should start in the last stored location./keep/dir should:/dir than the dir should be used and not some previous one, which may be unrelated. request-dir so far. That is the reason why I try to discuss it here ;-)/keep/dir logic in your program likely, by using /dir for the first request and then with no refinements after that.>> 3:3:3.3 == 3:03:03.3 >> 3:3:3,3 *** Syntax Error: (line 1) invalid time at 3:3:3,3 *** Where: case *** Stack: load >> about Red 0.6.4 for Linux built 25-Dec-2020/1:08:25+02:00 commit #98f31b5
>> to-date [2020 12 26] == 26-Dec-2020 >> to-date "2020-12-26" *** Script Error: cannot MAKE/TO date! from: "2020-12-26" *** Where: to *** Stack: to-date >> about Red 0.6.4 for Linux built 25-Dec-2020/1:08:25+02:00 commit #98f31b5
to normalizing and that you can use epoch time conversions between integers and dates.load the string internally, and dates could do the same. Does anyone know if we have a ticket for this already?load for such conversions as load is very high level function. If needed, it's better to use low-level transcode.>> transcode/one "2020-12-26" == 26-Dec-2020
offset-to-char. If you click on the area in this example the window closes. view [
a1: area on-down [ x: offset-to-char face 0x0 ]
]load", and that's still fine for 99% of cases I imagine, where you're loading a single value, or just a few. e.g. in a GUI data exchange scenario. But for large data transformation uses, where you may be doing it millions of times, it will make a huge difference. Memory pressure increases with load, but not transcode.Count: 10000 Time | Time (Per) | Memory | Code 0:00:00.004 | 0:00:00 | 484 | [transcode/one "2020-12-26"] 0:00:00.005 | 0:00:00 | 484 | [transcode/one "12:34:56"] 0:00:00.007 | 0:00:00 | 440284 | [to time! "12:34:56"] 0:00:00.015 | 0:00:00 | 2320440 | [load "2020-12-26"] 0:00:00.021 | 0:00:00 | 2320284 | [load "12:34:56"]
Time!'s to action uses load-value internally, which maps to load-single-value, which then uses lexer/scan-alt. Transcode also boils down to lexer/scan-alt.load-value is used today, it would be a win to use transcode internally...I think. Those copy the cells today, with a comment that load-value changes the spec. If that copy is safely avoided, it's a lighter hit. In the meantime, people who benefit can use transcode/one or wrap it with a more human friendly name.to date! "2020-12-26" as it is in Rebol.? system/view/fonts ?probe system works in both consoles on Win10. I don't know of anybody else on XP at this point, so may be hard to debug. Fortunately, probing the system isn't a critical path issue. Would be nice if it just said "out of memory" though.ﺠ^R鐰粀~ looks like garbage to me--encap command line switch for the compiler causes the code to be embedded basically as-is, and interpreted at runtime. This allows you to distribute a single EXE that contains code which is too dynamic for the compiler to handle, or to work around compiler limitations. You can see all the compiler options in the readme of the main Red github repo.