Coder Social home page Coder Social logo

Comments (7)

Ducasse avatar Ducasse commented on June 24, 2024

I should be super stupid.... I cannot make this reader working.
The API is plain bad.
Why I cannot simply say

TonelReader loadFileName: 'Comix/SeriePrinter.class.st'

I have a folder with my files and none of the expressions below work.

TonelReader
on: (FileSystem workingDirectory / 'Comix') asFileReference
fileName: 'SeriePrinter.class.st'

TonelReader
on: 'Comix' asFileReference
fileName: 'SeriePrinter.class.st'

from tonel.

Ducasse avatar Ducasse commented on June 24, 2024

This also raises uncomprehensible errors:

(TonelReader
on: 'Comix' asFileReference
fileName: 'SeriePrinter.class.st') loadDefinitions

Telling that the directory does not exist! Of course this is a file that I pass.
So to me this API REALLY sucks.

At the end I will have lost 3 hours and feel like shit and forced to do everything by hand.
Or hack the reader which I do not want to do.

from tonel.

estebanlm avatar estebanlm commented on June 24, 2024

This is because you are trying to use it in a different way as it was meant for. TonelReader is a special kind of Monticello reader, hence it was meant to read packages, not classes.
And the API is inherited from Monticello.

In your case, if you do:

(TonelReader
    on: '.' asFileReference
    fileName: 'Comix') 
    loadDefinitions

it will work as expected (loading the definitions of the full "Comix" package).

This does not means we should not expand the API to allow simple file-in/file-out of classes (and even methods), but well... we need to implement it, since the original purpose of Tonel was not exactly that.

from tonel.

Ducasse avatar Ducasse commented on June 24, 2024

Ok I understand now.
You should think that Tonel will be in the future the default format for Pharo source
so it should be really easy to use. And you should add this to the class comment.

Tonel is realllllly important. I was waiting for it since 2002.

from tonel.

Ducasse avatar Ducasse commented on June 24, 2024

Esteban if fileName: was packageName: then it would be a lot clearer.

(TonelReader
onFolder: '.' asFileReference
package: 'Comix')
loadDefinitions

from tonel.

estebanlm avatar estebanlm commented on June 24, 2024

yes, we should add that api (but not rename the other, since is needed for compatibility with monticello)

from tonel.

Ducasse avatar Ducasse commented on June 24, 2024

Ok even better. This MC API sucks :)

from tonel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.