World: r3wp
[Core] Discuss core issues
older newer | first last |
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 :-) |
Ammon 14-Mar-2005 [732] | so when you 'make 'test-result you are making a function not the object that you thought that you were making... |
BrianW 14-Mar-2005 [733x2] | Is there a flag I can set to warn when something is being redefined? |
I changed function 'test-result to function 'test-result-summary and everything is golden again. | |
Ammon 14-Mar-2005 [735x2] | You can keep your current set up with the redefined 'test-result but you will need to run 'compose on the spec block being passed to 'test-case-test and enclose 'test-result in a paren |
Not for something like this, particularly since you aren't actually redefining anything! ;~> | |
older newer | first last |