World: r3wp
[Core] Discuss core issues
older newer | first last |
Geomol 26-Apr-2011 [1270x3] | Is there a point in allowing refinements like this? /1a |
REBOL also allow decimal! refinements like: /1.2 but treat it like an integer refinement. Some further thoughts: Can refinements be categorized in two groups, integer refinements and word refinements? If yes, then the refinement datatype maybe should be two different datatypes? | |
Hm, maybe what I call integer refinements shouldn't be allowed at all, as I see no point in them. I can't get the desired path using integer refinements as in: >> to-path [blk /2] == blk//2 The correct way is: >> to-path [blk 2] == blk/2 So if integer refinements are useless, what's the point? | |
Rebolek 26-Apr-2011 [1273] | John, I'm not sure I understand. Aren't you confusing path with refinement? |
Geomol 26-Apr-2011 [1274x3] | No, they're different. I know. You can use refinements to build paths, else refinements are used in functions. REBOL allow what I call integer refinements, as the scanner doesn't give error. I ask why is that? |
Or, maybe we can't actually use refinements to build paths, now I think of it. :-) | |
I can cook it down to: Why would REBOL allow refinements like: /1 /1a /1.2 My guess is, it's a side effect of how the scanner handle paths with integers, like: blk/1 So shouldn't refinements have the same rules as words, like the core manual suggest? | |
Rebolek 26-Apr-2011 [1277] | Ah, now I understand. It's probably a "bug" in scanner. |
Geomol 26-Apr-2011 [1278x3] | Because those refinements are allowed, you can write: f: func [/2] [ ... ] But that kinda makes no sense. |
No kidden, people get confused: >> f: func [/2] [if 2 [print "It's 2!"]] >> f It's 2! >> f/2 It's 2! I can even write >> f/3 It's 2! | |
In R3, at least we get: >> f: func [/2] [if 2 [print "It's 2!"]] >> f It's 2! >> f/2 ** Script error: incompatible refinement: 2 But the refinement is still valid. | |
Ladislav 26-Apr-2011 [1281] | Graham, see: http://www.fm.tul.cz/~ladislav/rebol/library-utils.r |
Henrik 26-Apr-2011 [1282] | I'm having problems renaming a file on a USB stick with R2 under Windows. It reports "cannot access". R3 does not have this problem. Can anyone reproduce this? |
Geomol 26-Apr-2011 [1283x2] | I did this under OS X with R2: >> write %/Volumes/NICOM/test.txt "Testing..." (and the files was produced, then) >> rename %/Volumes/NICOM/test.txt %/Volumes/NICOM/test2.txt ** Access Error: Cannot rename test.txt So an error. |
With R3, it works here. | |
Henrik 26-Apr-2011 [1285] | ok, that is interesting. possibly file system related? |
Geomol 26-Apr-2011 [1286] | Possibly, as rename works on HD in R2. |
Henrik 26-Apr-2011 [1287] | the mezz source says that if the file is not found, then it can't be accessed. |
Cyphre 26-Apr-2011 [1288] | Henrik, I have no problem with renaming a file on USB stick...tested under WindowsXP SP3 |
Geomol 26-Apr-2011 [1289] | Henrik, I can read the file with REBOL command READ in R2. |
Henrik 26-Apr-2011 [1290x2] | perhaps it's a timing issue? |
it works, if I open the port and find the file by hand | |
Cyphre 26-Apr-2011 [1292] | >> read %/f/ == [%data %KeePass/ %TrueCrypt/ %autorun.inf %test.r] >> rename %/f/test.r %test2.r >> read %/f/ == [%data %KeePass/ %TrueCrypt/ %autorun.inf %test2.r] >> |
Henrik 26-Apr-2011 [1293] | RENAME uses OPEN, not READ. |
Geomol 26-Apr-2011 [1294x2] | Seems like, it's the CHANGE command, that rename it. |
Reading the source for RENAME, it rename the file by changing its name in the directory file. And this doesn't work for some reason with USB sticks under OS X using R2. | |
Henrik 26-Apr-2011 [1296] | it does not work for me under Windows either. seems like a port bug. |
Geomol 26-Apr-2011 [1297] | Cyphre, did you test with R2 or R3? |
Henrik 26-Apr-2011 [1298] | and yes, it is at the CHANGE on the port, that fails. |
Cyphre 26-Apr-2011 [1299] | I tested with R2...no problems here. Henrik, maybe it has something to do with the fact you are emulating the Windows under OSX? |
Henrik 26-Apr-2011 [1300x2] | the CHANGE works, if I do it by hand. Then I can rename the file. |
Cyphre, Robert reported this from a customer, who I assume is running Windows natively. | |
Cyphre 26-Apr-2011 [1302] | hmm, hard to say then. |
Henrik 26-Apr-2011 [1303x2] | testing one more timing issue... |
does not help with timing, but I can still perform CHANGE outside the rename function | |
Geomol 26-Apr-2011 [1305] | It works, if you don't give NEW as full path. |
Henrik 26-Apr-2011 [1306] | I see... testing that |
Cyphre 26-Apr-2011 [1307x2] | that's how the HELP is telling you ;) |
new -- new name (not a path) | |
Geomol 26-Apr-2011 [1309x2] | :) funny it works on HD though. |
Are you suggesting "RTFM!" ? ;) | |
Henrik 26-Apr-2011 [1311] | ok, thanks... testing fix. |
Cyphre 26-Apr-2011 [1312] | LOL, well, I remember I have been bitten by this many years ago so from that time I'm using it according to the help ;) |
Henrik 26-Apr-2011 [1313] | my excuse is that I could not probe the input values for RENAME :-) but true, this should not be standard behavior. |
Geomol 26-Apr-2011 [1314] | Best solution is probably, that it should just work with both ways. |
Maxim 26-Apr-2011 [1315] | rename capabilities in file handling do not normally allow paths to be used (in the OS itself). otherwise these are a called 'move file operations. e.g. if you try using paths with rename in the DOS shell, you get errors. |
BrianH 26-Apr-2011 [1316x3] | John, refinements that can't be translated to path use can be used for other reasons in other dialects. REBOL isn't just DO. |
When using refinements in dialect contexts where they will be translated from paths, it makes no sense to use them, but that is no reason to exclude them from the datatype. (That was the official decision for R3 when meijeru asked this question in CureCode here in mid-2009: http://issue.cc/r3/743) | |
Sorry, the actual decision was in a different ticket, but the discussion was in #743. Sometimes it can be a problem to make multiple tickets for the same problem, as opposed to different parts of the same problem; it can get a little confusing. Stuff like this is why we rearrange tickets more now. | |
Geomol 26-Apr-2011 [1319] | It seems to me to be a sought for explanation of some inconsistency in the language. Also from the discussion in that ticket. |
older newer | first last |