World: r3wp
[Core] Discuss core issues
older newer | first last |
Maxim 19-Jun-2007 [8342] | so its a bit like the pre-reduce on apply debate... it can't be undone (unless a switch exists, then its ok) in this case, that is what /only usually stands for. |
Terry 22-Jun-2007 [8343] | I would call some person's submitted password with inadvertant whitespace as 'destructive' .. besides, there would be no 'data destruction' if you used no-trim, would there? As Gregg put it, everyone has different needs. If you measured the trimming of strings vs not, I would imagine more are trimmed. |
Gabriele 22-Jun-2007 [8344] | terry, it's not possible to implement a no-trim function. |
ICarii 23-Jun-2007 [8345] | what is the difference between copy and copy/deep? I cannot seem to find any simple examples... |
Henrik 23-Jun-2007 [8346] | icarii, copy/deep copies series inside blocks, where copy only copies the blocks and series inside are referenced, like in the original block. |
ICarii 23-Jun-2007 [8347x3] | example? |
a: [a b c [d e f]] - in this is [d e f] referenced? | |
when copy rather than copy/deep? | |
Henrik 23-Jun-2007 [8350x2] | >> a: ["string"] == ["string"] >> append a/1 "2" == "string2" >> a == ["string2"] >> b: copy a == ["string2"] >> append a/1 "3" == "string23" >> b == ["string23"] >> c: copy/deep a == ["string23"] >> append a/1 "4" == "string234" >> c == ["string23"] >> a == ["string234"] >> b == ["string234"] |
not copying deep is a common mistake, when series inside blocks or objects don't behave or suddenly change contents where they shouldn't. | |
ICarii 23-Jun-2007 [8352] | the lack of examples on rebol.com doesnt help either :( |
Henrik 23-Jun-2007 [8353] | is the above not clear enough? I'm not sure how else to explain it. If you want to copy everything inside a block, just go for copy/deep. |
ICarii 23-Jun-2007 [8354] | it is clear - i was just noting that there is nothing in the rebol docs at the moment - nor in wikibooks |
Henrik 23-Jun-2007 [8355] | I think deep is in fact default behaviour in R3, because plain copy introduces many mistakes for beginners. |
ICarii 23-Jun-2007 [8356x4] | a: [a b c [d e f]] b: copy a append a/4 'g ;b now has g c: copy a append a/4 'h ;c does not have h but b does. |
tested and working fine here now :) i generally use copy/deep with complex series but never stopped to wonder why.. | |
something like the following would be useful for new people: ;given the following series a: [a b c [d e f]] ;perform copy b: copy a probe b >> [a b c [d e f]] ;b contains [a b c [{and references a/4}]] ;this can be seen by appending to a/4 and checking b again append a/4 'g probe b >> [a b c [d e f g]] ;now on copy/deep an exact copy with no referencing of internal series is made c: copy/deep a append a/4 'h probe c >> [a b c [d e f g]] ;c does not have h but b does. probe b >> [a b c [d e f g h]] append a 'i ;and neither b nor c will contain 'i as it is in the outer series probe c >> [a b c [d e f g]] probe b >> [a b c [d e f g h]] | |
wikibooks entry updated: http://en.wikibooks.org/wiki/REBOL_Programming/Programming_in_REBOL#Copy_vs_Copy.2Fdeep | |
Geomol 23-Jun-2007 [8360] | Should we prepare for a revision of the REBOL wikibook, when R3 is out? Either change directly or make a now book copying over, what is ok and adding new? |
BrianH 23-Jun-2007 [8361] | Copy/deep is not the default in R3. Nor would I want it to be - I almost never use copy/deep, but use copy quite often, intentionally. |
Henrik 24-Jun-2007 [8362] | brianH, sorry, I just seemed to remember Carl talking about inverting the behaviour so you'd need a refinement to avoid copying deep. |
BrianH 25-Jun-2007 [8363] | Well, he hasn't done it yet. If he did I'd use that refinement all of the time - I almost never use /deep. |
Pekr 26-Jun-2007 [8364] | Brian - was there already any talk about rebcode on extended R3 testing team? |
BrianH 29-Jun-2007 [8365] | Yeah. It's not there yet, but its primary implementation technique has been generalized for wider use. Several of the dialects that have been implemented so far operate in the same way that rebcode did, including DRAW. |
TimW 30-Jun-2007 [8366x2] | How do you set or reset objects within other prototype objects. i.e. prot: make object![ num: none names: make object![ a: copy "A" b: copy "B" ] ] x: make prot[ foo: 56 ;how do I set a to be different ;how do I add a 'c here to set ] |
okay. I got it working. | |
Anton 1-Jul-2007 [8368] | x: make prot [ foo: 56 names: make names [ a: copy "Different" c: copy "Added" ] ] |
Henrik 2-Jul-2007 [8369] | Geomol, the book probably needs a good rewrite or rethinking. Only a few sections are still usable. |
Sunanda 5-Jul-2007 [8370] | I'm trying to get a list of all the arguments to get-modes. But, right now, the online dictionary is broken for that function: http://www.rebol.com/docs/words/wget-modes.html Can anyone help? (Meanwhile, I'll rambo the problem) |
btiffin 5-Jul-2007 [8371] | Math question. Aside from a routine! or Rebcode is there existing code to do 32bit by 32bit multiply in REBOL which evaluates to be equivalent to C code a * b; with no overflow throw? |
Ladislav 5-Jul-2007 [8372] | c-multiply: func [a [integer!] b [integer!]] [first (1x0 * a) * (1x0 * b)] |
Gregg 5-Jul-2007 [8373] | I thought I had a list somewhere, but can't find it. You probably already have all these. files: file-modes copy-modes net ports: network-modes interfaces ports: port-modes |
btiffin 5-Jul-2007 [8374] | Ladislav; Thank you sir. |
Sunanda 5-Jul-2007 [8375] | Thanks Gregg -- I was looking for the definite list of file modes: world-write etc. A bit of extra Googling got me to here: http://www.rebol.com/docs/core25.html#sect1.1. It would have been easier with some SEO on the .com and .net sites. |
Izkata 5-Jul-2007 [8376] | Like this? >> print mold get-modes %Fonts.r 'file-modes [status-change-date modification-date access-date owner-name group-name owner-id group-id owner-read owner-write owner-execute group-read group-write group-execute world-read world-write world-execute set-user-id set-group-id full-path] >> print mold get-modes %Fonts.r 'world-write false |
Sunanda 6-Jul-2007 [8377] | Thanks Izkata. The difficulty there is that it returns only the modes availlable on your platform. I needed all the possible modes for cross-platform coding/ |
Pekr 7-Jul-2007 [8378] | guys, do you have recursive directory read function? Simply put - what I need for our kiosk is: - script running in the background, window-less - script checks for new drive to appear periodically - then it reads specific directory, e.g. %/e/kiosk-update - then it reads files, and stores them to target dir, not carring about adding new dir/file, simply overwriting it It is kind of one-sided sync :-) I can't find anything usefull on rebol.org .... |
Sunanda 7-Jul-2007 [8379] | Here's some code that traverses an entire dircetory tree: http://www.rebol.org/cgi-bin/cgiwrap/rebol/ml-display-message.r?m=rmlTQBC |
ICarii 7-Jul-2007 [8380x4] | what in the following code would cause cannot insert on port error? |
updatedir: func [current-dir basedir /local contents base-contents item base-item item-info base-item-info][ unless exists? current-dir [return] ;returns if source is not present - eg someone removes a cd contents: read current-dir unless exists? basedir [make-dir basedir while [not exists? basedir][wait 0]] base-contents: read basedir foreach item contents [ base-item: find base-contents item either dir? item [ updatedir join current-dir item join basedir item ][ either none? base-item [ write/binary join basedir item read/binary join current-dir item ][ item-info: info? join current-dir item base-item-info: info? join basedir base-item if item-info/date > base-item-info/date [ write/binary join basedir item read/binary join current-dir item ] ] ] ] ] updatedir %sourcedir/ %destdir/ | |
when run repeatedly (if i trap the error) it completes successfully.. is there a 1 write at a time rule in rebol? | |
but apart from the error - is that the sort of thing you were looking for Petr? | |
Pekr 7-Jul-2007 [8384x3] | Icarii - yes, that might help .... |
oh my, how usefull is read %/, if you can't use it further dynamically? == [%c/ %d/ %e/ %g/] it is missing one backslash. You simply can't do thing like foreach drive drives [print exists? join drive "kiosk/"] | |
it has to be a bug, because it is not logical - it is a result of 'read operation, yet if you query the result, e.g. exists? %c/ you get 'false result. That is not imo correct. | |
ICarii 7-Jul-2007 [8387] | that only probably happens under windows where the filesystem is so screwy |
Pekr 7-Jul-2007 [8388] | :-) |
Gabriele 7-Jul-2007 [8389x3] | petr, no, that is not a bug. |
>> read %public/www.rebol.com/ == [%index.r %docs/ %bay.jpg %view/ %downloads/] | |
do you see %public/www.rebol.com/ in the block? | |
older newer | first last |