Wireworld animated GIF renderer - also questions on style and distribution

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Wireworld animated GIF renderer - also questions on style and distribution

John Morrice
Hi list!

Recently I found a Rosetta code task which asked readers to submit
implementations of the Wireworld cellular automaton in various
languages.  See:

http://rosettacode.org/wiki/Wireworld

I noticed that Smalltalk was not on the list, so I decided to try
learning it and completing the task.  My efforts can be found here:

https://github.com/elginer/jwgif

You can have a peek at the animated output here:

https://github.com/elginer/jwgif/blob/master/3cycle.gif

What it does:

* Reads wireworld programs in the format described on the Rosetta
  Code page.
* Produces animated (pseudo) GIFs of the simulation, using libplot from
  GNU Plotutils.
* Crashes with uninformative error messages on incorrect input because
  it does no error handling whatsoever.

This is my first Smalltalk program.  I really enjoyed writing it - but I
am yet a complete newbie!  I've only read the GNU Smalltalk tutorial and
parts of the user guide at
http://www.gnu.org/software/smalltalk/manual/gst.html

Inevitably I have questions:

* I have not parcelled my program as a package. I've read about
  Smalltalk packages though, and I see that a package can depend on a
  shared object being installed.
  However, my program contains C code which is compiled to a shared
  library and then loaded dynamically in Smalltalk.  I couldn't see
  anything in the user manual which would suggest that C source can be
  distributed as part of a package, and compiled on the user's machine.
  Am I right or are there Smalltalk tools that help with this?
  More broadly: am I doing it wrong?
  What is the convention for dealing with this?

* I'm used to choosing method and function names in Ruby,
  Haskell and C that describe the intent of the function.  In
  Smalltalk I'm finding this difficult because I need multiple
  selector names, one: for each: parameter, so I have to choose multiple
  selector names which together describe the intent.  I'm not sure
  why, but I find this very difficult.  Any advice?

Cheers guys,

Johnny

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Wireworld animated GIF renderer - also questions on style and distribution

Paolo Bonzini-2
On 12/06/2010 11:07 PM, John Morrice wrote:
> * Reads wireworld programs in the format described on the Rosetta
>    Code page.
> * Produces animated (pseudo) GIFs of the simulation, using libplot from
>    GNU Plotutils.

Nice!

> Inevitably I have questions:

That's good.

> * I have not parcelled my program as a package. I've read about
>    Smalltalk packages though, and I see that a package can depend on a
>    shared object being installed.
>    However, my program contains C code which is compiled to a shared
>    library and then loaded dynamically in Smalltalk.  I couldn't see
>    anything in the user manual which would suggest that C source can be
>    distributed as part of a package, and compiled on the user's machine.
>    Am I right or are there Smalltalk tools that help with this?
>    More broadly: am I doing it wrong?
>    What is the convention for dealing with this?

http://smalltalk.gnu.org/wiki/creating-and-distributing-packages

:)

Paolo

> * I'm used to choosing method and function names in Ruby,
>    Haskell and C that describe the intent of the function.  In
>    Smalltalk I'm finding this difficult because I need multiple
>    selector names, one: for each: parameter, so I have to choose multiple
>    selector names which together describe the intent.  I'm not sure
>    why, but I find this very difficult.  Any advice?

A common idea is to compose: verbs with: prepositions and: conjunctions.

Paolo

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk