[Newbies] Re: FileDirectory

Ron Teitelbaum ron at usmedrec.com
Tue May 31 21:05:29 UTC 2016

Hi Joe,


There are a number of different types of resource names.  One of them is a
URI the other is URL (I=Indenter L=Locator).  They are ways for locating and
identifying resources so that computers can find and work with them.  I
would recommend googling a bit about URI and URL to understand better what
they are used for.  The section I pointed out was a method that gave you the
protocol (scheme) for the URL.  


URL class >> urlClassForScheme: scheme

               (scheme isNil or: [scheme = 'http']) ifTrue: [^HttpUrl].

               scheme = 'https' ifTrue: [^HttpUrl].

               scheme = 'ftp' ifTrue: [^FtpUrl].

               scheme = 'file' ifTrue: [^FileUrl].

               scheme = 'mailto' ifTrue: [^MailtoUrl].

               scheme = 'browser' ifTrue: [^BrowserUrl].



This is a class side method that returns the class you should use to work
with the resource.  You asked why there were url methods on FileDirectory.
The answer is that a url instead of starting with http  as in
http://mydomain.com/somefilename  can start with file:// as in
file://somefilename and this is how we get to FileDirectory (well eventually
through FileUrl), that's what I was trying to point out.


All the best,






From: beginners-bounces at lists.squeakfoundation.org
[mailto:beginners-bounces at lists.squeakfoundation.org] On Behalf Of Joseph
Sent: Tuesday, May 31, 2016 2:16 PM
To: beginners at lists.squeakfoundation.org
Subject: [Newbies] Re: FileDirectory


> On May 26, 2016, at 5:50 PM, Ron Teitelbaum [via Smalltalk] <[hidden
email]> wrote: 
> Have a look at the Hierarchy for the class Url 
> Notice the class method: #urlClassForScheme: 
> That should give you a better understanding of why url methods are in
> For browser like methods see HTTPClient. 

Sorry, Ron, all I got from this email after a day of trying to understand
it, is that I do not have the background to grasp what you are trying to
tell me.  It seems you need to know all of this already before you know how
to use it. 

I thought the purpose of encapsulation is that you do not need to know the
inner workings of an object to use it. 

Is there something more basic about urls and httpclients that I can start




View this message in context: Re: FileDirectory
Sent from the Squeak - Beginners mailing list archive
<http://forum.world.st/Squeak-Beginners-f107673.html>  at Nabble.com.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20160531/efdc4065/attachment.htm

More information about the Beginners mailing list