Issue 6243 in pharo: ZnUrl: Convenience method to add to path

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue 6243 in pharo: ZnUrl: Convenience method to add to path

pharo
Status: FixReviewNeeded
Owner: [hidden email]
Labels: Type-Enh Milestone-2.0 Difficulty-Easy Zinc

New issue 6243 by [hidden email]: 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):

/ aString

        ^ self copy addPathSegment: aString.

Attachments:
        ZnUrl-#.st  217 bytes


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 6243 in pharo: ZnUrl: Convenience method to add to path

pharo
Updates:
        Status: MonkeyIsChecking

Comment #1 on issue 6243 by [hidden email]: ZnUrl: Convenience  
method to add to path
http://code.google.com/p/pharo/issues/detail?id=6243#c1

The Monkey is currently checking this issue. Please don't change it!


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 6243 in pharo: ZnUrl: Convenience method to add to path

pharo
Updates:
        Status: WorkNeeded

Comment #2 on issue 6243 by [hidden email]: ZnUrl: Convenience  
method to add to path
http://code.google.com/p/pharo/issues/detail?id=6243#c2

Monkey went bananas:
--------------------
Error while loading "ZnUrl-%23.st" from Comment #0:
        MessageNotUnderstood: ReadStream>>fileIn
  1: ReadStream(Object)>>doesNotUnderstand: #fileIn
  2: [attachment contents asString readStream fileIn] in [:attachment |  
[attachment contents asString readStream fileIn]
                        on: Error
                        do: [:e | self addError: e forFile: attachment description]] in  
UlysseTheMonkey>>loadChangeSet
  3: BlockClosure>>on:do:
  4: [:attachment | [attachment contents asString readStream fileIn]
                        on: Error
                        do: [:e | self addError: e forFile: attachment description]] in  
UlysseTheMonkey>>loadChangeSet
  5: Array(SequenceableCollection)>>do:
  6: UlysseTheMonkey>>loadChangeSet
  7: [self loadChangeSet] in UlysseTheMonkey>>loadAndTestChangeSet
  8: [loadStopwatch reset activate.
                aBlock value.
                loadStopwatch suspend.
                testResult := self runTests.
                self removeFalseErrors] in UlysseTheMonkey>>testChangeImpact:
  9: BlockClosure>>on:do:
10: UlysseTheMonkey>>testChangeImpact:
        ...
----------------------------------------------------------
Loaded Source: "ZnUrl-%23.st" from Comment #0
Tested using Pharo-2.0-20178-a on CoInterpreter  
VMMaker-oscog-EstebanLorenzano.160 uuid:  
bec8cdf0-4e06-4975-8c02-e882fadf4df3 Jul  3 2012,  
StackToRegisterMappingCogit VMMaker-oscog-EstebanLorenzano.160 uuid:  
bec8cdf0-4e06-4975-8c02-e882fadf4df3 Jul  3 2012,  
https://git.gitorious.org/cogvm/blessed.git Commit:  
744bfe905c78a1a5d408680a8780367ea77e0549 Date: Fri Jun 1 15:17:41 2012  
+0200 By: Esteban Lorenzano <[hidden email]>


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 6243 in pharo: ZnUrl: Convenience method to add to path

pharo

Comment #3 on issue 6243 by [hidden email]: ZnUrl: Convenience  
method to add to path
http://code.google.com/p/pharo/issues/detail?id=6243

Good suggestion, Sean.
I will integrate it directly with the upstream code.
I'll add a test too ;-)

I am almost ready with changing Zn to get over pre/post FS.

Now, why do you want to do a #copy ?
ZnUrl is not a immutable object, #addPathSegment: is like a builder message.
Do you agree ?



_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 6243 in pharo: ZnUrl: Convenience method to add to path

pharo

Comment #4 on issue 6243 by [hidden email]: ZnUrl: Convenience  
method to add to path
http://code.google.com/p/pharo/issues/detail?id=6243

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!


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 6243 in pharo: ZnUrl: Convenience method to add to path

pharo
Updates:
        Cc: [hidden email]

Comment #5 on issue 6243 by [hidden email]: ZnUrl: Convenience  
method to add to path
http://code.google.com/p/pharo/issues/detail?id=6243

(No comment was entered for this change.)


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 6243 in pharo: ZnUrl: Convenience method to add to path

pharo

Comment #6 on issue 6243 by [hidden email]: ZnUrl: Convenience  
method to add to path
http://code.google.com/p/pharo/issues/detail?id=6243

I like the change :)

And for the copy I am not so sure either. But I think it's nice to be more  
consistent with the rest of the system.

BTW: We could go even a bit further and add url parameters and fragments  
that way :P

    baseUrl / aString / 'lastSuccessfulBuild' ? ('q' -> 'foo) & ('lang'  
-> 'en-us')


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 6243 in pharo: ZnUrl: Convenience method to add to path

pharo

Comment #7 on issue 6243 by [hidden email]: ZnUrl: Convenience  
method to add to path
http://code.google.com/p/pharo/issues/detail?id=6243

Ha ha, cami. You read my mind... I implemented that too, but I thought it  
might be too far out, so I put my toe in the water with #/ first! I'll  
attach it...


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 6243 in pharo: ZnUrl: Convenience method to add to path

pharo

Comment #8 on issue 6243 by [hidden email]: ZnUrl: Convenience  
method to add to path
http://code.google.com/p/pharo/issues/detail?id=6243

"add url parameters and fragments that way :P

    baseUrl / aString / 'lastSuccessfulBuild' ? ('q' -> 'foo) & ('lang'  
-> 'en-us')"

Changeset attached

Attachments:
        ZnUrl-?.st  252 bytes
        ZnUrl-&.st  251 bytes


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 6243 in pharo: ZnUrl: Convenience method to add to path

pharo
Updates:
        Cc: [hidden email]

Comment #9 on issue 6243 by [hidden email]: ZnUrl: Convenience  
method to add to path
http://code.google.com/p/pharo/issues/detail?id=6243

(No comment was entered for this change.)


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 6243 in pharo: ZnUrl: Convenience method to add to path

pharo

Comment #10 on issue 6243 by [hidden email]: ZnUrl: Convenience  
method to add to path
http://code.google.com/p/pharo/issues/detail?id=6243

Selector names should have some polymorphic universal meaning.

Not that the selector should do exactly the same everywhere, but the  
meaning should be more or less, no ?

#/ stands for concatenation, but so does #,
#? has no meaning yet, but #& is used as a logical/mathematical operation

Also, #? and #& do the same, you could just reverse them in your example,  
hence why do we need both ?

I am just thinking out loud.


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 6243 in pharo: ZnUrl: Convenience method to add to path

pharo

Comment #11 on issue 6243 by [hidden email]: ZnUrl: Convenience  
method to add to path
http://code.google.com/p/pharo/issues/detail?id=6243

I knew this one would be tougher ;-)

"Selector names should have some polymorphic universal meaning."
I don't know, should they? I think in general that's a good guideline, but  
for really generic ones, like #name, #value, #&, etc., it seems that is not  
followed... and maybe that's a problem - I know many of us have been burned  
by Object>>name or #at: being called by default when we hadn't yet  
implemented it in our subclass.

The #& is just so that the DSL looks more like a real URL, although my  
copy-paste should be replaced by delegation... #& is really just an alias  
to #? for readability...


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 6243 in pharo: ZnUrl: Convenience method to add to path

pharo

Comment #12 on issue 6243 by [hidden email]: ZnUrl: Convenience  
method to add to path
http://code.google.com/p/pharo/issues/detail?id=6243

Sven Van Caekenberghe uploaded a new version of Zinc-HTTP to project Zinc  
HTTP Components:
http://www.squeaksource.com/ZincHTTPComponents/Zinc-HTTP-SvenVanCaekenberghe.283.mcz

==================== Summary ====================

Name: Zinc-HTTP-SvenVanCaekenberghe.283
Author: SvenVanCaekenberghe
Time: 9 July 2012, 4:38:29 am
UUID: 51351ae8-99a9-44cc-856a-976fcd55e2cf
Ancestors: Zinc-HTTP-MarcusDenker.282

added an efficiency improvement to  
ZnMultiPartFormDataEntity>>#parse:boundary:
added convenience protocol to ZnUrl:
- #withPathSegment[s]: #/
- #withQuery: #? #&



_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 6243 in pharo: ZnUrl: Convenience method to add to path

pharo

Comment #13 on issue 6243 by [hidden email]: ZnUrl: Convenience  
method to add to path
http://code.google.com/p/pharo/issues/detail?id=6243

To be included in a later update of Zn


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 6243 in pharo: ZnUrl: Convenience method to add to path

pharo

Comment #14 on issue 6243 by [hidden email]: ZnUrl: Convenience  
method to add to path
http://code.google.com/p/pharo/issues/detail?id=6243

So we close this?


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 6243 in pharo: ZnUrl: Convenience method to add to path

pharo
Updates:
        Status: Closed

Comment #15 on issue 6243 by [hidden email]: ZnUrl: Convenience  
method to add to path
http://code.google.com/p/pharo/issues/detail?id=6243

Yes


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker