Re: Scoping in Io
Steve Dekorte <[email protected]> Wed, 6 Jun 2012 12:01:02 -0700
| Newsgroups | gmane.comp.lang.io |
|---|---|
| Message-ID | <[email protected]> |
Kurtis,
I'm guessing Jer's answer is what you're after but just to be clear, unlike C or some other languages, Io doesn't have any notion of a file context other than the one you specify - doFile() simply runs in the context of the receiver, which is why Jer's example works.
Cheers,
Stee
On 2012-06-06 Wed, at 09:30 AM, Jeremy Tregunna wrote:
>
>
> 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
>> Haml := clone
>> ```
>>
>> ``` io
>> # sass.io
>> Sass := clone
>> ```
>>
>> ``` io
>> # 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
>>
>
>
>
>