Re: Scoping in Io

Jeremy Tregunna <[email protected]> Wed, 06 Jun 2012 10:30:53 -0600
Newsgroups gmane.comp.lang.io
Message-ID <[email protected]>
Yes.

Haml doFile("Compressor.io")

Importer really needs a filePathFor(…) method which takes a string, and returns you the path that Importer's FileImporter would use when import is called on it. Then, you could simply write an import function like this (and I think it's something we'd add to the repo):

import := method(str,
    self doFile(Importer filePathFor(str))
    self
)


Regards,

Jeremy Tregunna


On Wednesday, 6 June, 2012 at 10:00 AM, Kurtis Rainbolt-Greene wrote:

>    
> Alright, so I've got a particularly interesting problem to solve. Lets
> say I have 3 files:
>  
> ``` io
> # haml.io (http://haml.io)
> Haml := clone
> ```
>  
> ``` io
> # sass.io (http://sass.io)
> Sass := clone
> ```
>  
> ``` io
> # coffee.io (http://coffee.io)
> Coffee := clone
> ```
>  
> Now I create a 4th file:
>  
> ``` io
> Compressor := clone
> ```
>  
> Now, with this new file I want to run it under the scope of each of
> the other 3 files. Basically it would end up with:
>  
> ``` io
> Haml Compressor
> Sass Compressor
> Coffee Compressor
> ```
>  
> and be 3 distinct prototypes. Anyway to do this?
>  
> --  
> Kurtis Rainbolt-Greene, Hacker
> Difference Engineers, LLC
> 643 Magazine St. #102
> New Orleans, LA 70130
>