World: r3wp
[!REBOL3-OLD1]
older newer | first last |
Oldes 7-Feb-2009 [10628] | and ANY is faster! |
BrianH 7-Feb-2009 [10629] | Well, we really need the information returned by the EXISTS? function above, and my last attempt to get that information out in a R2-R3 compatible way (the above *-EXISTS? functions) got a lot of complaints (mostly from Gregg, as I recall). This is hopefully a less annoying change, and is compatible now even without the 'dir tweak if you check against 'file instead. My opinion of the *? functions that are meant to be predicates is that they should be usable as predicates, but don't necessarily need to be simple predicates. As long as you can use them in IF statements, they're fine. We have methods to convert from REBOL truth values to logic! if we need to. |
[unknown: 5] 7-Feb-2009 [10630] | I don't understand the problem with the functions we have regarding this in 2.7.6. Can someone summarize the issue? |
BrianH 7-Feb-2009 [10631x2] | Sure. In REBOL 2 there are 2 functions, EXISTS? and DIR?, that check for whether a file! refers to an existing file and whether the existing file is a directory, respectively. Both of these functions wrap around QUERY, a low-level native that works very differently between R2 and R3, mostly because of the port model change. In addition, DIR? has a design shortcoming in R2 (mentioned in CureCode ticket #602) and both DIR? and EXISTS? share the same bug in QUERY in R3 (#606, affects #602 and #604). All of these combine into a few problems: - People who want to write file and directory management code that is portable between R2 and R3 have trouble doing so. - Bugs of the kind mentioned in #602 are not likely to be fixed in R2, so we have to consider DIR? broken for non-existing directories. - Using both DIR? and EXISTS? means two QUERY calls, which has overhead, particularly for networked files. - Attempts to get around this using QUERY require completely different code in R2 and R3, so wrappers would be nice. As it specifically relates to 2.7.6, for people who don't care about forwards compatibility, there is only one problem: >> DIR? %nonexistingdirectory/ == false ; Should be true, unlikely to change |
Also, R2 and R3 could use a standard function that does the opposite of DIRIZE. Current proposed names are UNDIRIZE or FILEIZE. | |
[unknown: 5] 7-Feb-2009 [10633x2] | Why do we need an undirize when it is already so simply to do such? |
>> a: %directory/ == %directory/ >> trim/with a "/" == %directory | |
BrianH 7-Feb-2009 [10635] | It is simple, as is DIRIZE (look at the source), but we still need it. |
[unknown: 5] 7-Feb-2009 [10636] | Sounds like bloat to me. |
BrianH 7-Feb-2009 [10637] | No bloat in R3. Modules get rid of the bloat. If you don't want it, don't include it. |
[unknown: 5] 7-Feb-2009 [10638x2] | Just seems there is better to focus on than that. |
How about working on fixing it so we can modifiy the dates on directories. That would be way more important. | |
BrianH 7-Feb-2009 [10640] | Who says I'm focusing on it? It was less than 5 minutes of work. |
[unknown: 5] 7-Feb-2009 [10641] | Yeah but doesn't sound like your done to me. |
BrianH 7-Feb-2009 [10642x2] | With undirize? I am done. |
I can't fix problems like modifying the date on directories - that is native code, and I just work on mezzanines. | |
[unknown: 5] 7-Feb-2009 [10644x2] | I sure hope all these mezzanines don't get distributed with REBOL. Because even if they are still distributed as a package with the main bin then it is still bloat. |
Rather, there be a separate distribution for just the main bin and then the mezzaines. | |
BrianH 7-Feb-2009 [10646] | When native code is released, I can work on it. The people who currently work on native code don't work on what I work on - that is why I work on it, so they can focus on what they need to. Division of labor. |
[unknown: 5] 7-Feb-2009 [10647x2] | Seems were getting to many mezzaines for simply tasks. Were gonna be a laughing stock. LOL. |
don't take that seriously - after all I run a mezzanine thread on my site. | |
BrianH 7-Feb-2009 [10649] | We only include the mezzanines we use, and I wouldn't suggest something unless there is already a need for it. Your TRIM/with code is wrong, btw, we only trim the last / and from a copy at that. |
[unknown: 5] 7-Feb-2009 [10650] | My trim was only an example of the ease at which we can perform tasks related to this. |
BrianH 7-Feb-2009 [10651] | R3 will be less bloated than R2, but you are still missing something: you say "the main bin" which assumes that R3 will be distributed in a single monolithic binary like it is in R2. Not doing that is the reason for the split of the host code. Build your own monolith if you like, including whatever functions you need. |
[unknown: 5] 7-Feb-2009 [10652] | Well that would be nice. We shall wait and see. |
BrianH 7-Feb-2009 [10653x2] | The point to making these mezzanines is to make them *well*. The fileize code above is the least you can write that does what the function is supposed to do. If this is not the case, improve it. We are improving REBOL by writing these functions, as they give us insight into how the system can be improved - look at the difference between the two EXISTS? functions above for an example of this. Simple code that you could inline if you need to is what we want. |
Think of these as a standard library of helper functions that you don't have to use if you don't need to. If you do use them, you can count on them working as correctly as the REBOL experts can make them work, and as efficiently. Either way REBOL is better. | |
[unknown: 5] 7-Feb-2009 [10655x3] | Yes Brian, but the two exists functions above are necessary because a change has been made to the operation of query. In those cases it is necessary to modify mezzanines. |
Yeah, I understand the point behind mezzanines which is why I maintain a good quantity of them outside of the REBOL distribution. | |
To me, Parse is the greatest strength of REBOL. | |
BrianH 7-Feb-2009 [10658] | Re 3 mgs back, I don't get your point. The new QUERY is better. The mezzanines work the same on the outside (in theory). So? |
[unknown: 5] 7-Feb-2009 [10659x2] | Yes, I don't dispute that the new query is better at all. |
what is your undirize function? | |
BrianH 7-Feb-2009 [10661x2] | So mezzanines are different on the inside. As long as they work the same on the outside, your code doesn't need to change. That is why the mezzanines are there. And code that is not part or the REBOL distribution is not mezzanine code, just REBOL code. If you want it to be mezzanine code (with all of the optimization benefits mezzanine code gets), submit it :) |
I posted it above as FILEIZE, but here: undirize: func [ {Returns a copy of the path with any trailing "/" removed.} path [file! string! url!] ][ path: copy path if #"/" = last path [clear back tail path] path ] | |
[unknown: 5] 7-Feb-2009 [10663x2] | undirize: func [file [file! sring! url!]][if #"/" = last file [reverse remove reverse file]] |
typo | |
BrianH 7-Feb-2009 [10665] | Ouch, two reverses :( |
[unknown: 5] 7-Feb-2009 [10666x2] | yeah |
Works well. | |
BrianH 7-Feb-2009 [10668] | I don't doubt it. It is modifying rather than copying, but it looks like it works. |
[unknown: 5] 7-Feb-2009 [10669] | Yeah and at less evals then yours. |
BrianH 7-Feb-2009 [10670] | head clear back tail is much faster than reverse remove reverse. All of that reversing is series copying, as is remove from the head of a series. If you don't need your function to copy, change reverse remove reverse to clear back tail. |
[unknown: 5] 7-Feb-2009 [10671] | See already hammering out better code by talking about it. |
BrianH 7-Feb-2009 [10672] | Yup :). Also, the return value of mine matters, as it does with DIRIZE, while yours is tossed. You wouldn't be able to use yours as a swap-in replacement for DIRIZE for non-dirs. Mine is a function, while yours is more of a procedure (making the Pascal distinction). |
[unknown: 5] 7-Feb-2009 [10673x3] | I wouldn't use mine at all for myself ;-) |
I'm getting to where I use less and less mezzanines. | |
At least for the more simply things. | |
BrianH 7-Feb-2009 [10676x2] | If you add a file on the end of the function you would have a useful return value. Then the only difference would be the copying. |
My approach is to improve the mezzanines to the point where it actually makes sense to use them instead of optimizing them away, or at least to the point where their code is good enough to inline. If I don't use it in highly optimized code, it doesn't go in. | |
older newer | first last |