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

World: r3wp

[Core] Discuss core issues

Ladislav
8-Jun-2011
[1644x2]
Regarding the "meaning" of ordering. If we examine some of the orderings 
you eventually might find "meaningful" we can come to the conclusion 
that they are not the only alternatives possible, and thus are actually 
"meaningless" as well in that respect. To support the "most meaningful" 
ordering for the specific data SORT supports the /COMPARE refinement, 
which proves the point, that even the ordering one user finds "meaningful" 
may lack "meaning" for another.
For example, I bet that the order REBOL uses for strings currently 
is "meaningless" for Pekr, who would prefer something more "meaningful".
james_nak
8-Jun-2011
[1646]
Is there a way to retrieve the name of an object that is referenced 
by another word?
layout  [ a_field: field [ ]  ]
b:  a_field
....
What I want is to somehow get "a_field" given b.
Ladislav
8-Jun-2011
[1647]
Is there a way to retrieve the name of an object that is referenced 
by another word?

 - only if you provide some (keep track of such things in your program)
james_nak
8-Jun-2011
[1648]
Is that right. I would think that it is stored somewhere in the system.
Ladislav
8-Jun-2011
[1649x2]
for example, it is quite common to do something like:

a: make object! [name: 'a]
You can even define a function doing that for you.
james_nak
8-Jun-2011
[1651]
Yes, I see that. I'll just go that route then. Thanks Ladislav.
Cyphre
8-Jun-2011
[1652]
James, in th case of LAYOUT dialect you can get the name this way:

>> b/var
== a_field
>> type? get b/var
== object!

etc.
james_nak
8-Jun-2011
[1653]
Cyphre, thanks a milion!
Gregg
8-Jun-2011
[1654x4]
This is about the HTTP scheme, but I can't find a group for R2 schemes.


Does anyone have a patch for the HTTP scheme that handles 204 (No 
Content) responses where no headers are returned? The standard scheme 
throws an error as there are no headers to parse. Here is the 'success 
case handler:

        success: [
            headers: make string! 500

            while [(line: pick port/sub-port 1) <> ""] [append headers join line 
            "^/"]

            port/locals/headers: headers: Parse-Header HTTP-Header headers
            port/size: 0

            if querying [if headers/Content-Length [port/size: load headers/Content-Length]]

            if error? try [port/date: parse-header-date headers/Last-Modified] 
            [port/date: none]

            port/status: 'file
    ]


For anyone familiar with the scheme, would the proper behavior be 
to set all related 'port fields to zero or none? e.g.

            port/locals/headers: headers: none
            port/size: 0
            port/date: none
            port/status: none
And should it only do that in case of a 204? It's not clear if a 
304 response may also be affected.
RFC2616 says 304 MUST inlcude a date field.
If it's just 204, it looks like the cleanest solution would be to 
add a success-204 response action block.
Oldes
9-Jun-2011
[1658x4]
The main problem with R2's HTTP scheme is, that it does not provide 
response-code even in cases where it should, like:

port: open/direct some-url


Without available response-code you have no chance to differentiate 
responses like 204 or 205 which has special meaning =

http://benramsey.com/archives/http-status-204-no-content-and-205-reset-content/
I think the most practical solution is to provide response-code in 
port/locals and return none for 204 and 205.
I suppose that server should provide date on 304 response, not client.
Also when you are using just:

new-content: read url-with-no-content-response


using error chatching and parsing the error message should be enough.
Gregg
9-Jun-2011
[1662]
Thanks Oldes. I can handle it simply for now, and maybe this can 
be addressed more thoroughly in R3.
Geomol
9-Jun-2011
[1663]
Tonight's Moment of REBOL Zen:

>> same? :empty? :tail?
== true

Wouldn't it be better to define EMPTY? as:

	empty?: func [
		series
	][
		tail? head series
	]
Endo
10-Jun-2011
[1664]
They are different and not backward compatible.
>> b: [1 2 3]
== [1 2 3]
>> c: skip b 3
== []
>> empty? b
== false
>> empty? c
== true
; c references to b, b is not empty, but c is.
Oldes
13-Jun-2011
[1665x2]
in R3:
>> same? :empty? :tail?
== false
but the result is same.. for me it's fine as it is.
BrianH
14-Jun-2011
[1667]
On R3, TAIL? is a redefinition of EMPTY? with fewer supported types. 
Internally they are the same function code. This was done in order 
to have one version that is more flexible, and another that triggers 
useful errors.
amacleod
15-Jun-2011
[1668x2]
Getting an error when sending bulk email: 

** User Error: Server error: tcp 501 <>: missing or malformed local 
part
** Near: insert smtp-port reduce [from address message]

The number of email addresses is 52. 

I can send using the same settings one at a time and I have succeeded 
sending  8 addresses at one time. But it bombs on my whole list.
Found a bad address thats probably the problem....
Endo
15-Jun-2011
[1670]
Did you try send/only ?
Henrik
8-Jul-2011
[1671x2]
Has anybody built a binary diff/patch function set?
If I want to store some fairly big data as undo information, it seems 
to make sense to store it as a diff, and load the data that I want 
to undo/redo to. Then it would also be possible to store the entire 
changes sequence to disk.
Gabriele
8-Jul-2011
[1673x2]
binary diff can be expensive - if you control the application that 
modifies the data, can you log the changes instead?
if not, you probably want something like this: http://publications.cse.iitm.ac.in/734/
Gregg
8-Jul-2011
[1675x3]
I did some a long time ago Henrik. It isn't fast enough to work on 
data of any size though. I can dig it out if you're interested. Can't 
remember what state of completion it's in.
Any *significant* size that is.
It's also high space complexity.
Henrik
8-Jul-2011
[1678]
The biggest object here is around 4 MB or 550 kb compressed. I expect 
that binary diff would only be used during load and save, and then 
keep full objects in memory.
Gregg
8-Jul-2011
[1679x2]
Mine will be way too slow for that.
My original goal was not binary diffs, but diffing blocks.
Henrik
9-Jul-2011
[1681]
you are right. I looked into it and it looks to be way too slow, 
so I'm trying another approach.
Geomol
11-Jul-2011
[1682x3]
>> negate 2 + - 2
== 0
>> - 2 + - 2
== -4

Bug?
Isn't unary minus introducing a third semantic rule? Functions are 
prefix, operators are infix with precedence over functions. And then 
unary minus is prefix with precedence similar to operators?
w> - (2 + (- 2))
== 0
w> (- 2) + (- 2)
== -4

Question is, how would we read
- 2 + - 2
Endo
11-Jul-2011
[1685]
It does correctly I think, here is the trace log:
>> - 2 + - 2
Trace:  - (word)
Trace:  2 (integer)
Infix:  op (add)
Trace:  - (word)
Trace:  2 (integer)
Geomol
11-Jul-2011
[1686]
I'm asking, if unary minus should work as if being defined like this:

>> set '- :negate
Maxim
11-Jul-2011
[1687]
no,  AFAICT the unary minus is applied exactly like all operator 
precedence (from left to right).


negate and  "-"  do not have the same precedence, as you noted, so 
its normal for:
    >> negate 2 + - 2    
and
    >> - 2 + - 2
to give different results.
Geomol
11-Jul-2011
[1688]
Ok, intensional then. I'm surprised.
Steeve
11-Jul-2011
[1689]
You shouldn't old pal :-)
Geomol
11-Jul-2011
[1690x2]
Is unary minus the only prefix thing, that has same precedence as 
operators?
:) Sometimes I feel, I have no clue about this language. ;)
Steeve
11-Jul-2011
[1692]
actually, unary minus has an higher precedence than other ops
Geomol
11-Jul-2011
[1693]
Functions with literal arguments works about the same.

>> f: func ['a] [probe a]
>> f 2 + 2
2
== 4

So f gets the value 2 in this example.