[Pharo-project] ZnUrl: Convenience method to add to path
Issue 6243: ZnUrl: Convenience method to add to path http://code.google.com/p/pharo/issues/detail?id=6243 How about #/ like FileReference. Then the following: baseUrl := 'https://ci.lille.inria.fr/pharo/job' asZnUrl. lastSuccessfulBuildUrl := baseUrl addPathSegment: aString; addPathSegment: 'lastSuccessfulBuild'. could become... lastSuccessfulBuildUrl := baseUrl / aString / 'lastSuccessfulBuild'. Here's the code (also attached to the issue): / aString ^ self copy addPathSegment: aString. -- View this message in context: http://forum.world.st/ZnUrl-Convenience-method-to-add-to-path-tp4637920.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
On Tue, Jul 3, 2012 at 4:06 PM, Sean P. DeNigris <sean@clipperadams.com> wrote:
/ aString
^ self copy addPathSegment: aString.
why do you copy here and not in the previous example? I guess you should return #yourself, just to be sure in case #addPathSegment: changes -- Damien Cassou http://damiencassou.seasidehosting.st "Lambdas are relegated to relative obscurity until Java makes them popular by not having them." James Iry
Damien Cassou wrote
why do you copy here and not in the previous example?
From the discussion in the issue comments (http://code.google.com/p/pharo/issues/detail?id=6243#c4) I did it without the copy first, but then as I've been using it in real code, I've found that I often build on top of a base url that I don't want modified. Also, FileReference does not change the original reference, so it's more consistent with the rest of our system. In fact, I'm so used to the FS flow that it took me a while to realize what was happening when my baseUrl was getting modified!
Damien Cassou wrote
I guess you should return #yourself, just to be sure in case #addPathSegment: changes
Not sure... I'll leave that up to Sven... -- View this message in context: http://forum.world.st/ZnUrl-Convenience-method-to-add-to-path-tp4637920p4637... Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
participants (2)
-
Damien Cassou -
Sean P. DeNigris