[Pharo-users] Tonel Fileout
tim at testit.works
Sat Jun 16 20:41:59 EDT 2018
Not quite the same usecase . But on github it’s a brilliant format for a side project - I can hack code on the tube on my phone with a build ci server to report the results when I surface (very lazy programming, but with a family and limited time - needs must) .
Sent from my iPhone
> On 16 Jun 2018, at 22:10, Esteban Lorenzano <estebanlm at gmail.com> wrote:
>> On 16 Jun 2018, at 16:38, Ben Coman <btc at openinworld.com> wrote:
>> Le 16/06/2018 à 10:43, Ben Coman a écrit :
>>> How can a fileout/filein be done using Tonel format?
>>> In the first case as a script?
>>> and secondly as a possible menu option for Pharo?
>>> This is to facilitate transfer of student coding exercises for Exercism.
>>> Could Tonel handle a full package export in one file?
>>> On 16 June 2018 at 17:13, Hilaire <hilaire at drgeo.eu> wrote:
>>> Hi Ben,
>>> I am not sure, but the purpose of Tonel is to propose a file representation of "one class=one file".
>> Sure thats how Tonel came about, and its how we mostly use it, but is this an inherent limitation?
> in fact, Martin McClure is working to make tonel available to work on file-per-package and even file-per-method again. In general, we do not want one or the other, but there are certain contexts where those can be useful.
>> Each method is prefixed with its class, so from my 100ft viewpoint it seems feasible to transport a whole package in one Tonel file.
>>> Why not using Fileout st files to transfer the code?
>> The same question might be asked why Iceberg didn't just use a Fileout at class level
> well, while file-out is good, we want to use Tonel format also to file-out and file-in. Not a replacement but an addition. Because the format is more readable, is sometimes more suitable for exchange too.
>> The Tonel format is more readable, especially minus the scattering of exclamation marks.
>> I also meant to ask, what methods are used to file-in a Tonel file ?
>> Or more the point, what method process a string in Tonel format that has been downloaded from a website?
>> Actually, hunting around a bit I found....
>> TonelParserTest >> testMethodDefList
>> shows that... ((TonelParser on: tonelString readStream) perform: #methodDefList)
>> returns an array of MCMethodDefinitions that respond to #load
>> MCMethodDefinition >> load
>> self actualClass
>> compile: source
>> classified: category
>> withStamp: timeStamp
>> notifying: nil
>> TonelParserTest >> testTypeDef
>> shows that ((TonelParser on: tonelString readStream) perform: #typeDef)
>> returns a MCClassDefinition that also responds to #load
>> MCClassDefinition >> load
>> self createClass
>> So as an experiment I deleted MCMockClassD,
>> then in playground evaluated...
>> tonelString := (ZnEasy get: 'https://raw.githubusercontent.com/pharo-project/pharo/development/src/MonticelloMocks/MCMockClassD.class.st') contents.
>> parser := (TonelParser on: tonelString readStream).
>> classDef := parser perform: #typeDef.
>> methodDefs := parser perform: #methodDefList.
>> classDef load.
>> methodDefs do: [ :md | md load ].
>> and super cool... MCMockClassD>>one was restored.
>> So is that the correct way to use it?
>> cheers -ben
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Pharo-users