r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!REBOL3-OLD1]

Claude
6-Oct-2009
[18770]
demo gui not working any more in the new R3-a86.exe !!!!!
Henrik
6-Oct-2009
[18771]
that would be due to the new PARSE.
Pekr
6-Oct-2009
[18772]
** Script error: make-text-style does not allow block! for its font-parent 
argument

** Where: parse fontize do do either load-gui catch either either 
applier do try demo
** Near: parse spec [
    some [
        spot:
        set name set-w...


This error message is kinda weird. What is the content of "where" 
section? "parse spec" can be found in text-fonts.r source ...
Henrik
6-Oct-2009
[18773x3]
submitted to curecode.
Pekr, the Where part is stack backtrace to help you find where the 
make-text-style function failed. This is a very nice feature. :-)
shadwolf, I'm no good at protocols either, so the only way is to 
study for example how HTTP was done in R3.
Pekr
6-Oct-2009
[18776]
it is confusing and absolutly nothing telling to the end user
Henrik
6-Oct-2009
[18777]
Actually this is way, way better than the output that R2 gave, but 
I wouldn't mind if "Where" was renamed "Stack" or something.
Pekr
6-Oct-2009
[18778x2]
I just run trace/back on, demo, trace/back 20 ... I can't understand 
the output, yet, but interesting :-) But really - Windows console 
just sucks and downgrading my REBOL experience by tens of percents 
in comparison to R2.
sorry for alignment, but here it is:

Parse input: |
Parse match: block!
Parse input: |

1: make-text-style : function! [font-name font-parent spec /local 
proto style nam
2: to-word : function! [value]
3: name : base:
--> to-word
    1: to : action! [type spec]
    2: word! : word!
    3: :value : base:
    --> to
    <-- to == base
    <-- to-word == base

    4: parent : [      font: [          color: black          size
     **: error : Script expect-arg
     **: error : Script expect-arg
     **: error : Script expect-arg
 1: trace/back
 2: 10
    --> trace
Henrik
6-Oct-2009
[18780]
just read the output from left to right. it shows that PARSE called 
MAKE-TEXT-STYLE, that FONTIZE called PARSE, that DO called FONTIZE, 
etc.


R2 would only point to the source location of MAKE-TEXT-STYLE, and 
then you would just have to hope that the place was unique enough 
to find it with a text editor's search function. That would be hard 
if MAKE-TEXT-STYLE existed in 20 different places in the code, and 
so you would have to proceed with several minutes of probing. No 
need for that anymore.

Here, I can immediately tell the path to the problem.
Pekr
6-Oct-2009
[18781]
Henrik - as for protocols, dunno who, but someone here said, that 
the http protocol is done in an old-school way, and that it deserves 
new aproach. I will gladly wait for BrianH to take over this area 
...
Henrik
6-Oct-2009
[18782x2]
I didn't study the trace function yet, so no comment on that one.
it's possible that HTTP needs to be rewritten. there are also still 
bugs in it.
Pekr
6-Oct-2009
[18784x2]
Henrik - you should, it is a big helper, although one has to lear 
how to interpret the result. But by parsing output, I cam imagine 
visual tool being done :-) More here - http://www.rebol.com/r3/docs/functions/trace.html
Here's the fontize:

fontize: funct [
	"Define text styles (from dialect)."
	spec [block!]
][
	assert-gui parse spec [
		some [
			spot:
			set name set-word!
			set parent opt word!
			set spec block!
			(make-text-style to-word name parent spec)
		]
	]["Invalid font syntax:" spot]
]
Henrik
6-Oct-2009
[18786]
I wonder why trace shows 3 errors instead of 1?
Pekr
6-Oct-2009
[18787x2]
Dunno. The errors don't correspond to what seems to be a reason why 
script crashes. It imo crashes, because the header of make-text-style, 
actually font-parent, expects word! or none! types, whereas it seems 
to get block! (at least that is what the error message says ...)

make-text-style: funct [
	"Define a new font style (used for text face styles)."
	font-name [word!]
	font-parent [word! none!]
	spec [block! none!]
][
so fontize gets spec block, which does not parse as needed anymore.
Henrik
6-Oct-2009
[18789]
it would seem that PARENT is a block, but I can't duplicate this 
in the test parser, I'm building here.
Pekr
6-Oct-2009
[18790]
how can I replace inbuilt fontize by my own? Will it be rewritten(redefined) 
by the demo call?
Henrik
6-Oct-2009
[18791x4]
I think I know what it is.
For BASE font style there is no parent, and we have a new rule that 
says that SET does not set a new value, if the  value shouldn't be 
set.
This could be solved with

parent: none

prior to the parse.
Previously, this would be done automatically by PARSE. It would set 
PARENT to none if there was no parent.
Pekr
6-Oct-2009
[18795x2]
ah, so what is 'parent set to, then?
so 'parent is not set at all? That is bad then. So you have to preset 
your parse level words to some defaults, if you can't be sure, if 
they will be set?
Henrik
6-Oct-2009
[18797]
Maybe it's not entirely that. Because parent is a block, and it's 
set to the next value, so it borrows the next value after opt, where 
it shouldn't. That could be a parse bug.
Pekr
6-Oct-2009
[18798]
Henrik - I think that you should post your finding, along with fontize 
short source to the CC, in order for Carl to identify the problem 
more easily ...
Henrik
6-Oct-2009
[18799x5]
So the bug would be that SET uses the next value instead of doing 
nothing.
already posted in #1253, but now to formulate the cause.
>> parse [base: [specs]] [set-word! set c opt word! block!]
== true

>> c
== [specs]
That would be a bug :-)
description changed accordingly.
Pekr
6-Oct-2009
[18804]
good catch, Henrik! :-)
Henrik
6-Oct-2009
[18805x2]
Thanks. Still doesn't explain 3 errors shown in the stack trace, 
though.
>> secure [debug]
** Script error: datatype assertion failed for: pol
** Where: assert foreach secure

** Near: assert/type [target [word! file! url!] pol [block! word! 
int...

Hmm?
Pekr
6-Oct-2009
[18807]
I did secure none, in order to be able to debug. This seems like 
a bug too.
Henrik
6-Oct-2009
[18808x4]
Ah, it's just an unclear explanation. I needed secure [debug allow].
submitted as bug#1255.
Pekr, if I say secure [debug none], I get a security violation?
oops, not that but: invalid security policy
Pekr
6-Oct-2009
[18812]
it throws invalid security policy here. I think none is not allowed 
secure dialect keyword, or is it? I know setting all security to 
none, but not particular section ...
Henrik
6-Oct-2009
[18813x3]
but does it still allow you to debug with [debug none]? If that's 
the case, there is another bug.
ah, none simply doesn't change the secure status for debug. I guess 
that's not a bug.
Bug #1254 is a direct result of the A85 changes to the INSERT, CHANGE 
and APPEND functions, so we should probably test all functions that 
use those.
Geomol
6-Oct-2009
[18816]
Does function! and closure! work backwards when dealing with indirect 
values (block!, string!, ...)?

>> f: func [/local b s] [b: [] s: "" insert b 1 insert s 1]
>> f
== ""
>> f
== "1"
>> source f

f: make function! [[/local b s][b: [1 1] s: "11" insert b 1 insert 
s 1]]

>> g: closure [/local b s] [b: [] s: "" insert b 1 insert s 1]
>> g
== ""
>> g
== ""
>> source g

g: make closure! [[/local b s][b: [] s: "" insert b 1 insert s 1]]

Souldn't the functionality be the other way around?
Henrik
6-Oct-2009
[18817]
looks correct to me
Geomol
6-Oct-2009
[18818]
I got the feeling, closures should work as R2 functions, that would 
remember local variables, after the function returned. And functions 
in R3 are implemented using stack-frames.
Henrik
6-Oct-2009
[18819]
ok, I'm under the impression that closures are supposed to do the 
opposite thing.