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

World: r3wp

[Core] Discuss core issues

Gabriele
12-Mar-2005
[682x2]
generate-messageid: does [

    rejoin ["<" enbase checksum/secure random/secure mold system/error 
    "@" server-name ">"]
]
you could randomize the message itself and then checksum it, too
Graham
12-Mar-2005
[684]
what's the mold system/error for ?
Gabriele
12-Mar-2005
[685x2]
get some (long) text to randomize and then checksum
any random data would do
Graham
12-Mar-2005
[687x2]
generate-messageid: func [eml [string!] [

    rejoin ["<" enbase checksum/secure random/secure eml "@" server-name 
    ">"]
]
sort of ..
Gabriele
12-Mar-2005
[689]
i think that's good for your purposes.
Graham
12-Mar-2005
[690]
ok, thanks Gabriele
Gabriele
12-Mar-2005
[691]
not sure if any char in base 64 could be a problem as a message id 
char, but i think MTAs do use base64 for message ids so probably 
it's fine.
Graham
12-Mar-2005
[692]
might be better to restrict myself to the first 1000 chars or so 
in case the eml is megabytes long ..
Micha
14-Mar-2005
[693x2]
a: make object! [
    b: 4
    c: 6
]
how to remove element b ?
Chris
14-Mar-2005
[695x2]
It's not possible to add or remove values within an object.
You can create a new object based on your object that adds or omits 
values, the latter being trickier.
Pekr
14-Mar-2005
[697]
or you can set b to none ....
Chris
14-Mar-2005
[698]
construct head remove remove find third a to-set-word 'b
Pekr
14-Mar-2005
[699]
:-)
Chris
14-Mar-2005
[700x2]
That would fail under the following circumstance:
a: context [c: to-set-word 'b b: 123]
Pekr
14-Mar-2005
[702]
strange result, I would expect obtaining error here?
>> unset in a 'b
>> probe a

make object! [
    b: unset
    c: 6
]
>> a/b
>>
Micha
14-Mar-2005
[703]
how to add object e: 7 to a ?
Graham
14-Mar-2005
[704]
you have to clone the object with the new instance variable
Ammon
14-Mar-2005
[705]
a: make a [ e: 7 ]
Micha
14-Mar-2005
[706x2]
ok
how to [ d: 5]
word: "d"
integer : "5"
Ammon
14-Mar-2005
[708]
Lookup 'parse for that one..
Pekr
14-Mar-2005
[709]
parse? why parse? What do you mean, Micha?
Graham
14-Mar-2005
[710x3]
what do you want to do?
do [ d: 5 ]
>> d
== 5
Pekr
14-Mar-2005
[713]
>> word: "d"
== "d"
>> integer: 5
== 5
>> set to-set-word word integer
== 5
>> d
== 5
Ammon
14-Mar-2005
[714]
Or did you mean something more like...

foreach [word integer] [a 1 b 2 c 3] [
    print ["Word: " to string! word newline "Integer: " integer]
]
BrianW
14-Mar-2005
[715x2]
I'm getting a confusing error about using paths on a logic! object 
when trying to use the methods of a created object. I figure I'm 
missing something obvious, but I can't figure out what it is:

test-result: make object! [
    run-count: 0
    error-count: 0

    test-started: does [
        run-count: run-count + 1
    ]

    test-failed: does [
        error-count: error-count + 1
    ]

    summary: does [
        return join  run-count [ " run, " error-count " failed" ]
    ]
]


; ...


            ed: make test-result [ ]
            ed/test-started
            ed/test-failed
            assert [ ed/summary == "1 run, 1 failed" ]

; output of code:

[[wisti-:-us1-dhcp-227-65] xUnit]$ rebol xunit.r
** Script Error: Cannot use path on logic! value
** Where: test-failed-result-formatting
** Near: ed/test-started
ed/test-failed
assert [ed/summary == "1 run, 1 failed"]
The code is just me working my way through the book "Test-Driven 
Development" by Kent Beck. I like applying educational exercises 
to new languages as I find them :-)
Ammon
14-Mar-2005
[717]
Where is 'ed defined?
BrianW
14-Mar-2005
[718x2]
ed: make test-result [ ]
beginning of the second block
Ammon
14-Mar-2005
[720x3]
Ah, so it is. ;~>
Hm...  I end up with...

** Script Error: assert has no value
** Near: assert [ed/summary == "1 run, 1 failed"]
So 'ed must be defined somewhere else as well?  Have you tried using 
another word?
BrianW
14-Mar-2005
[723x3]
Let me make the whole script available. I was hoping it was a very 
simple logic error in those lines.
http://coolnamehere.com/rebol/xunit.r
The "probe result" line at the end is usually "print probe disarm 
result", but I set it back while trying to poke at this issue.
Ammon
14-Mar-2005
[726]
Ahah!
BrianW
14-Mar-2005
[727]
aha? Yes, yes?
Ammon
14-Mar-2005
[728]
A favorite subject of mine. ;-)
BrianW
14-Mar-2005
[729]
heh.
Ammon
14-Mar-2005
[730]
in 'test-case-test, you are redefining 'test-result as a function, 
not globaly so you aren't actually changing the definition but adding 
a new one to the current context.
BrianW
14-Mar-2005
[731]
oh jeez. Thanks :-)