Planet Smalltalk

April 29, 2016

Torsten Bergmann - ESUG 2016 Registration

The Weekly Squeak - ESUG’16 Registration

ESUG

Dear Smalltalkers,

ESUG’16 registration is open!

http://www.esug.org/wiki/pier/Conferences/2016/Conference-Registration

We also provide you a selected list of hotels here:

http://www.esug.org/wiki/pier/Conferences/2016/Hotels

See you @ Prague,

Luc


Dr. Luc Fabresse
Associate-Professor in Computer Science
Mines Douai, Institut Mines-Telecom, France
http://car.mines-douai.fr/luc/


Torsten Bergmann - Aqueducts

Nice quote on Twitter:

"Every time I look at Smalltalk, I feel I know how Dark Age engineers must have felt looking at the Roman Aqueducts."

Torsten Bergmann - FullBlockClosureInstaller

In Pharo installing Kernel classes is far from trivial (the SlotClassBuilder raise error and one cannot modify the Kernel classes using the IDE).

This package from Clement allows to install the correct classes for the FullBlockClosure, and update everything so all the state is correct. Nice.

Torsten Bergmann - Smalltalk VM History

Did you notice that the commits from Eliot Miranda to the Squeak/Pharo/Cuis/Newspeak VMMaker packages follow a year pattern (1850, 1851, ...) and include not only a description of the changes but also what happened in the year corresponding to the commit number.

Wonder what happens when he reaches 2016 and following commits...

April 28, 2016

Pharo Weekly - Happy with Pharo 50 release!

Hi guys,

This is just to let you know I am very happy with Pharo 5.0 upcoming release. I was already used quite a lot for other projects (OSSubprocess etc), but a couple of days ago, I started to develop my client’s app (Quuve) and so far so great. It only took me an hour or so to update all my dependencies in my Metacello conf (I have a lot of dependencies). So..thanks for all those who have been updating their confs!
I was already familiar with all the GT tools so I was happy with that. I really notice a speed up (I guess in big part thanks to Spur) and so far it was quite robust. I also noticed some memory leak fixing…as previously in 4.0 I was re-building images all the time because I get to 500MB in no time. Right now I keep using the same image as for several days and so far no problem with memory.
Finally…let me say…. if for Pharo 6.0 we finally get Git support directly integrated into the image and we get expected Sista speedup, I think it will be the best release ever hahahahha.
Thanks for all your efforts and congratulations for the upcoming release. I am already enjoying it since several weeks already.

Pharo News - Pharo MOOC starts May 2nd

<p>The Pharo MOOC start next Monday, May 2nd.</p> <p>It is still possible to subscribe <a href="https://www.fun-mooc.fr/courses/inria/41010/session01/about?platform=hootsuite">here</a>. (Videos are in French with english subtitles, all course material is available in english).</p>

April 27, 2016

Pharo Weekly - A nano tuto on Command Line …

pharo Pharo.image  --list 

will give you the command lines available, then 

pharo Pharo.image  aCommand --help 

will give you the subcommands possible

in your case, you want something like this: 

pharo Pharo.image eval “99 factorial”

cheers, 
Esteban

Pharo Weekly - Pharo Monthly Newsletter April 2016

Pharo Monthly Newsletter April 2016

The Pharo Community is busy preparing the release of Pharo5 for May. We got so busy that we forgot to send out a newsletter for March…

For this April Newsletter, we have three topics:

  1. The Pharo MOOC
  2.  Pharo Consortium: Membership Matching Campaign
  3. Pharo Days Report

To get Pharo related news every day, follow us on twitter @pharoproject.

Pharo MOOC
The Pharo MOOC is a new online course about Live Object Programming in Pharo.

The MOOC starts with over 2000 registrations on May 2nd. Register today!

Membership Matching Campaign
The Pharo Board is proud to announce a special campaign for attracting new Consortium Members during 2016.
A new fund has been created from which the Consortium will receive the equivalent of one yearly membership fee for every new member, and the increment in yearly fees for every upgrading member. For example, if a new company joins the Consortium as a Silver member (2000 EUR / year), the fund will contribute a one-time amount of 2000 EUR to the Consortium. Similarly, if a company upgrades from Bronze (1000 EUR / year) to Gold (4000 EUR / year), the fund will contribute a one-time amount of 3000 EUR.

This campaign will take place until the end of 2016, or until the fund is depleted. Currently, the fund totals 21000 EUR, a sum which is graciously supported by three companies: LabWare, Object Profile and Fenk.
http://pharo.org/news/membership-matching-campaign

Pharo Days
Pharo days were organised on Thursday March 31 & Friday April 1 in Namur (Belgium). It was a great moment to encounter other Pharo programmers, to feel community spirit, to discuss about the Pharo ecosystem and the improvment of the language, listen many interesting talks about various themas.

The schedule was interesting: We were lucky to listen talks about Seaside 3.2, data formats and protocols, Unified FFI, Bloc, Spur, etc. If you didn’t go to Namur, all the slides will be available on this website soon.

Many photographies and a video are already available on the web:

Thanks to the event organizers for their incredible work. The Pharo Days took place in a beautiful place (Le cercle de Wallonie).


Pharo Weekly - Arff Generator for Pharo

Hello everyone,

For a university project in ”Datamining and Datawarehousing”, I have to convert data stored as text files in different formats to the Weka[1] ARFF format[2].

I did it with Pharo of course!:)

So, I wrote this little project [3] to share what I have done with you, just in case someone else needs to export data from Pharo objects to an ARFF string for further analysis with Weka.

Cheers,

Julien

Links:

[1] Weka’s website: http://www.cs.waikato.ac.nz/ml/weka/

[2] ARFF format spec: https://weka.wikispaces.com/ARFF

[3] Arff generator for Pharo: https://github.com/juliendelplanque/Arff


Torsten Bergmann - Genetic Algorithm for Pharo

A genetic algorithm implementation is available from the Pharo Catalog provided by Alexandre Bergel.

I helped Alexandre in providing the config for this. I like the package. His genetic algorithm code is nice and interesting - it allows to play with Genetic algorithms in the regular Smalltalk tools (workspace, inspectors, ...) and the package also provides Roassal visualizations for them.
You definitely should check this package out. Code is on STHub.

April 26, 2016

Noury Bouraqadi - Open positions for Permanent Assistant Professors in Computer Science and Robotics

The Ecole des Mines de Douai has open positions for Permanent Assistant Professors. Candidats must be from EU. The application dead-line is the 15th of may! Below a description of the position. We expect candidates to join the CAR team and work on software engineering and coordination of mobile autonomous multi-robot systems. Our recent projects… Continue reading

April 25, 2016

Torsten Bergmann - Arff Generator in Pharo

Weka is a collection of machine learning algorithms for data mining tasks. Weka defines a format called "Arff" to be used for data importation. On GitHub you will now find an Arff generator written in Pharo.

Torsten Bergmann - Changing Pharo background picture

Want to style your Pharo image with a wallpaper image? Peter describes the possible options in detail.

Pharo Weekly - Soup1.8 [ANN] Introspect web content

Hi,

I added a few GT inspector extensions to Soup and cleaned up a little bit. Released as a new version 1.8 of Soup - you will find easily in Catalog 
for Pharo 5 or by opening Spotter and entering "Soup" to load.

As the attached screenshots shows you now have a nice way to introspect 
the structure of a web page as a tree in the inspector or see the 
attributes of tags/nodes in a table.

Thx
T.

soup.png

April 24, 2016

Pierce Ng - SQLite and JSON

SQLite 3.9.0, released in Oct 2015, introduced the json1 extension that provides functions to manage JSON content stored in an SQLite database. The extension source code is included in the SQLite source amalgamation and is enabled by the -DSQLITE_ENABLE_JSON1 option.

The following assumes that the json1 functionality is available. As sample data, I use the stocks data set from jsonstudio.com. Here’s what the wrapped first line of the JSON data file looks like partially:

{ "_id" : { "$oid" : "52853800bb1177ca391c17ff" }, "Ticker" : "A", "Profit
Margin" : 0.137, "Institutional Ownership" : 0.847, "EPS growth past 5
years" : 0.158, "Total Debt/Equity" : 0.5600000000000001, "Current Ratio" :
3, "Return on Assets" : 0.089, "Sector" : "Healthcare", "P/S" : 2.54,
"Change from Open" : -0.0148, "Performance (YTD)" : 0.2605, "Performance
(Week)" : 0.0031, "Quick Ratio" : 2.3, "Insider Transactions" : -0.1352,

To load the file into an SQLite database using NBSQLite3:

| jr db |
jr := (FileSystem / 'tmp' / 'stocks.json') asFileReference readStream.
jr ascii.
db := NBSQLite3Connection openOn: '/tmp/s.db'.
[   db execute: 'create table s (d json)'.
    db execute: 'begin'.
    [ jr atEnd ] whileFalse: [ 
        db execute: 'insert into s values (json(?))' "<== Note."
            with: (Array with: jr nextLine) ] 
    db execute: 'commit'.
] ensure: [ db close ]
jr close.

Note the invocation of the json() SQL function, which verifies that its argument is a valid JSON string and returns a minified version of that JSON string.

Let’s inspect the created database with the sqlite3 shell tool:

$ wc -l stocks.json
6756 stocks.json

$ sqlite3 s.db
SQLite version 3.9.2 2015-11-02 18:31:45
Enter ".help" for usage hints.
sqlite> select count(*) from s;
6756
sqlite> .schema
CREATE TABLE s (d json);
sqlite> 

The json_extract(X, P1, P2, …) function extracts and returns one or more values from the JSON structure X:

sqlite> select json_extract(d, '$.Sector', '$.Company') 
   ...> from s 
   ...> where json_extract(d, '$.Ticker') = 'AAPL';
["Consumer Goods","Apple Inc."]
sqlite> 

The json_each() table-valued function walks the JSON value provided as its argument and returns one row for each element. The schema for the table returned by json_each() is as follows:

CREATE TABLE json_tree(
    key ANY,             -- key for current element relative to its parent
    value ANY,           -- value for the current element
    type TEXT,           -- 'object','array','string','integer', etc.
    atom ANY,            -- value for primitive types, null for array & object
    id INTEGER           -- integer ID for this element
    parent INTEGER,      -- integer ID for the parent of this element
    fullkey TEXT,        -- full path describing the current element
    path TEXT,           -- path to the container of the current row
    json JSON HIDDEN,    -- 1st input parameter: the raw JSON
    root TEXT HIDDEN     -- 2nd input parameter: the PATH at which to start
);

Here’s json_each() in action:

sqlite> select key, value 
   ...> from s, json_each(s.d) 
   ...> where json_extract(d, '$.Ticker') = 'AAPL'
   ...> limit 10;
_id|{"$oid":"52853800bb1177ca391c1809"}
Ticker|AAPL
Profit Margin|0.217
Institutional Ownership|0.621
EPS growth past 5 years|0.424
Total Debt/Equity|0.14
Current Ratio|1.7
Return on Assets|0.186
Sector|Consumer Goods
P/S|2.75
sqlite> 

Let’s run the same query in Pharo:

| q db v |
q := 'select key, value from s, json_each(s.d) where json_extract(d, "$.Ticker") = "AAPL" limit 10'.
db := NBSQLite3Connection openOn: '/tmp/s.db'.
[   (db execute: q) rows do: [ :r |
        Transcript show: (r at: 'key') asString, ' = '.
        v := r at: 'value'.
        Transcript show: v asString, ' (', v class asString, ')'; cr ]
] ensure: [ db close ]

Transcript displays thusly. As we can see, SQLite and NBSQLite3 handle numerical values in the JSON data properly.

_id = {"$oid":"52853800bb1177ca391c1809"} (ByteString)
Ticker = AAPL (ByteString)
Profit Margin = 0.217 (Float)
Institutional Ownership = 0.621 (Float)
EPS growth past 5 years = 0.424 (Float)
Total Debt/Equity = 0.14 (Float)
Current Ratio = 1.7 (Float)
Return on Assets = 0.186 (Float)
Sector = Consumer Goods (ByteString)
P/S = 2.75 (Float)

Notice that the first row is well-formed JSON. If we use json_tree() instead of json_row(), that JSON structure will be returned as a key/value row as well.

Finally, let’s read the first JSON record using NeoJSON:

| q db  |
q := 'select json_extract(d, "$") as data from s limit 1'.
db := NBSQLite3Connection openOn: '/tmp/s.db'.
[   (NeoJSONReader on: ((db execute: q) rows first at: 'data') readStream)
        next explore
] ensure: [ db close ].

This is powerful stuff. Well worth a look.

April 23, 2016

Torsten Bergmann - Scratch performance

Tim optimized Scratch for the Raspberry Pi ... now it runs much faster. Read more.

April 21, 2016

Torsten Bergmann - Minimal tODE API

The GemStone/S GCI code was ported to UFFI and now allows to have a minimal tODE API for accessing the object database from Pharo 5.0. Read more.

April 20, 2016

Torsten Bergmann - Mocketry 3.0

New version of Mocketry 3.0 for Pharo is available. Read more.

Smalltalk Jobs - Smalltalk Jobs – 4/20/16

Smalltalk job in Berlin.  German is nice to have, but English is required.  They want someone with lots of experience who can start now, and, the contract looks to be 6 months and ending in November 2016.  It could be extended.


Filed under: Employment

Torsten Bergmann - PolyMath-Extensions

Newton's method for vector problems (experimental) is in ‪#‎PolyMath‬ Extensions. Read more

Pharo Weekly - Pillar 3.0.0 release

Hi everybody,

I’m happy to announce the latest release of Pillar.

This release has been possible because of the hard work of Damien Cassou, Cyril Ferlicot, Damien Pollet, Stephan Eggermont, Yann Dubois, Thibault Arloing and Lukas Komarek.

What did it bring and what are the largest changes ?

  • Addition of an AsciiDoc Exporter
  • LaTeX exporter:
    • external links now produce footnotes
    • replace \begin{code}{} with \begin{listing}[language=XXXX]
    • replace \ct with \code
    • use \textasciitilde instead of \texttildelow to represent a ~ character in Pillar
    • SBALaTeX writer for sba book (by Damien Pollet) https://github.com/cdlm/sbabook
  • HTML exporter:
    • default template charset is UTF-8
  • Features: For more  you can see Pillar documentation at https://ci.inria.fr/pharo-contribution/job/EnterprisePharoBook/lastSuccessfulBuild/artifact/book-result/PillarChap/Pillar.html
    • hideable scripts with the option hideable.
      •  e.g., [[[hideable=true
        with a parameter in pillar.conf “scriptHide”=true this text will be hidden.
        ]]]
      • It’s, for example useful if you’re a teacher and you want to have two versions of your document, one with solutions (for you) and one without (for students)
    • auto anchor for headers
      • e.g, in a level configuration
        “level1”:{
        “numbering”=true,
        “autoAnchor”=true
        }
        there will be an automatic creation of an anchor for headers of level 1.
      • It’s useful when you want to link a title in the text, for example for a table of contents
    • header capitalization in a level configuration with options: capitalize, capitalizeEnglish, uppercase, lowercase
      •  ex: “level1”:{
        “capitalization”:”uppercase”
        }
        Will render all headers of level 1 to Uppercase.
      • It’s useful if you want all headers of a same level to be capitalize likewise
      • e.g., if you have “==i am a level 1 header” with “capitalizeEnglish” it will produce “<h2>I Am a Level 1 Header<\h2>”

Cheers,

Thibault


April 18, 2016

Torsten Bergmann - Algernon-Launcher for Squeak

Back from the days when I used Squeak there was a nice tool called "Algernon" which was a simple "type in search" tool. I used it very often.

Later in Pharo days such a tool was missing - but after a while the "Spotter" tool for Pharo was provided by the GT team based on the same idea.

The nice thing is that now also the Algernon code was updated for latest Squeak in a project called "Algernon-Launcher".

BTW: Spotter does not allow to evaluate the given text as expressions, but the tool is extendable and maybe should provide this Algernon feature by default as well.

April 17, 2016

Smalltalk Jobs - Smalltalk Jobs – 4/17/16

  • Bangalore, IndiaApplications Developer (SmallTalk) (Job ID 160037167) and Applications Developer 3 (SmallTalk) (Job ID 160037171) through J.P. Morgan
    • Required Skills:
      • The candidate should have an understanding of an object oriented programming language (e.g. Java, C++, C#, Python, Ruby, Smalltalk) and their underlying principles
      • Data modelling
      • Code version control
      • Understanding of performant coding and optimisations
      • Enthusiasm for increasing knowledge of financial markets and products is essential
      • Willingness to adopt an agile development process
  • Fremont, CASystems Engr Staff at Lam Research
    • Required Skills:
      • B.S or Masters in Computer Science, Computer Engineering or related field
      • 8+ years experience in software development
      • Knowledge of embedded software development and design.
      • Design, code and debug applications in various software languages and OS environments
      • Experience working in VxWorks real time operating system
      • Experience creating Windows Embedded Standard 2009 and 7, and develop application in these OS.
      • Knowledge of Object Oriented Software implementation and design
      • Knowledge of source control and software development life cycles.
      • Analytical approach to root cause analysis
      • Knowledge of multithreading is a must (preemptive thread scheduling)
      • Understanding of Networking/TCPIP and various forms of communication such as UART, USB, Lon, ECat.
    • Wanted Skills:
      • Smalltalk, C++, C# experience
      • ControlWORKS framework experience
Good luck with your job hunting,
James T. Savidge

View James T. Savidge's profile on LinkedIn

This blog’s RSS Feed


Filed under: Employment Tagged: jobs, Smalltalk, Smalltalk jobs

Pharo Weekly - Zinc: much more than HTTP server

Although Zinc HTTP Components is a framework for HTTP with full featured client and server implementations, it has long contained two sub packages that are independent of HTTP or even networking: Zinc-Resource-Meta (which implements URL and MimeType) and Zinc-Character-Encoding (for all kinds of character encoding).

While implementing the Pharo Unicode project, I made a couple of changes to Zinc-Character-Encoding.

The ZnCharacterEncoder hierarchy was refactored a bit with the introduction of ZnUTFEncoder and ZnEndianSensitiveUTFEncoder while a new encoder was added: ZnUTF32Encoder.

This means all official Unicode encoders, UTF-8, UTF-16 and UTF-32 are now supported. See the chapters ‘3.9 Unicode Encoding Forms’ and ‘3.10 Unicode Encoding Schemes’ in http://www.unicode.org/versions/Unicode8.0.0/ch03.pdf

The API of the encoders was also extended to not only work between characters and bytes, but also between integer Unicode code points and bytes.

A refactoring was done regarding streams as well with the introduction of ZnEncodedStream and ZnEncoded[Read|Write]Stream above ZnCharacter[Read|Write]Stream and the addition of ZnCodePoint[Read|Write]Stream.

Summary: some new features, all public API remains the same.

Sven


April 16, 2016

Pharo Weekly - Metronomic improvements

50694
18010 CompiledMethod>>#hasBreakpoint speedup
https://pharo.fogbugz.com/f/cases/18010

18011 QA async task flood
https://pharo.fogbugz.com/f/cases/18011

50693
17697 Badly encoded icon data
https://pharo.fogbugz.com/f/cases/17697

50692
18005 speed up Nautilus tests
https://pharo.fogbugz.com/f/cases/18005

50691
17999 Four tests failing in SmalllintManifestCheckerTest
https://pharo.fogbugz.com/f/cases/17999

16560 test runs: open debugger on failing tests
https://pharo.fogbugz.com/f/cases/16560

50690
18003 multiple usage in the weak subscriptions to the local announcers in the system
https://pharo.fogbugz.com/f/cases/18003

50689
18001 GToolkit version 3.19
https://pharo.fogbugz.com/f/cases/18001

50688
17998 Update Athens to latest
https://pharo.fogbugz.com/f/cases/17998

50687
17984 Method pane of Nautilus does not honor test methods of abstract unit test classes (and lets them run instead)
https://pharo.fogbugz.com/f/cases/17984

17970 String Utility method “repeat:”
https://pharo.fogbugz.com/f/cases/17970

50686
17983 Update GTSpotter to latest version that reduces memory leaks
https://pharo.fogbugz.com/f/cases/17983

50685
17975 #hierarchyClassTree sort by #name instead of #printString
https://pharo.fogbugz.com/f/cases/17975

17995 load rubric 2.19
https://pharo.fogbugz.com/f/cases/17995
50684
17989 QualityAssistant v2.6.3 (memory leak fix)
https://pharo.fogbugz.com/f/cases/17989
50683
17985 Package and methods icon cache are references nautilus instance which shows them first time
https://pharo.fogbugz.com/f/cases/17985

17964 Remove usage of Announcer in MultistateButtonMorph for the action to be done when clicked
https://pharo.fogbugz.com/f/cases/17964

17986 Nautilus uses old EventManager to subscribe on historyChanged which never garbage collected
https://pharo.fogbugz.com/f/cases/17986

17966 garbage subinstance of SystemWindow at image startup
https://pharo.fogbugz.com/f/cases/17966

17987 RubFindReplaceService produce leak subscriptions
https://pharo.fogbugz.com/f/cases/17987

50682
17015 Failing test: SetTest>>#testAllSetsAreHealthy
https://pharo.fogbugz.com/f/cases/17015

17979 (MessageDialogWindow new text: Hello) open should work
https://pharo.fogbugz.com/f/cases/17979

17897 Slot method used by Nautilus but not implemented
https://pharo.fogbugz.com/f/cases/17897
50681
17284 Rubric SubscriptOutOfBounds error
https://pharo.fogbugz.com/f/cases/17284

17972 Remove depended in MorphTreeNodeMorph on deletion
https://pharo.fogbugz.com/f/cases/17972

17968 a window should not be the top window after its deletion
https://pharo.fogbugz.com/f/cases/17968

50680
17804 –no-default-preferences does not work on the latest Pharo 5
https://pharo.fogbugz.com/f/cases/17804
50679 Moose

Addresses cases:
– case 17679
– case 17936
– case 17931
Other updates:

– made the width of the sequenceable number items to be 50
– examples for SharedQueue, CatalogProject
– specify an after: message in GTExamples

50678
17950 Improve Collection Sequenciable comments ver2
https://pharo.fogbugz.com/f/cases/17950

16947 Class-side Inst Var “#name” Makes It Too Easy to Break System
https://pharo.fogbugz.com/f/cases/16947

17841 Creating a class from a debugger/during compilation doesnt create a record in .changes file
https://pharo.fogbugz.com/f/cases/17841

50677
17945 TextEditor setEmphasisHereFromTextForward: broken for empty text
https://pharo.fogbugz.com/f/cases/17945

17943 It is not possible to write [ in Nautilus on the french keyboard layout
https://pharo.fogbugz.com/f/cases/17943

17937 Monticello does not fully unload packages
https://pharo.fogbugz.com/f/cases/17937

17621 Failing test SizeInMemoryTest>>#testSizeInMemoryOfByteObjects
https://pharo.fogbugz.com/f/cases/17621
50675
17930 MenuModel>>fromSpec: fails to open a PluggableMenuSpec if it contains a subMenu
https://pharo.fogbugz.com/f/cases/17930

17932 Natuilus “Class” button no longer shows if theres anything on the class-side
https://pharo.fogbugz.com/f/cases/17932

17929 Missing parenthesis around condition (testAsCommaStringMore)
https://pharo.fogbugz.com/f/cases/17929
50674
17632 Can not remove classes that are referenced
https://pharo.fogbugz.com/f/cases/17632

17923 SUnit Rules
https://pharo.fogbugz.com/f/cases/17923

17699 Finders code pane allows to save code with invalid syntax
https://pharo.fogbugz.com/f/cases/17699

17926 Improve Pharo Project Catalog Loading
https://pharo.fogbugz.com/f/cases/17926

17780 “Analyzing Packages” progress should not be shown when running package critics
https://pharo.fogbugz.com/f/cases/17780

50672
16775 Class Button is in the wrong state sometimes
https://pharo.fogbugz.com/f/cases/16775

17871 Slots need to be notified when they changed
https://pharo.fogbugz.com/f/cases/17871

16373 Methods called but not implemented in SUnit
https://pharo.fogbugz.com/f/cases/16373

50671
17904 Update athens 3.9
https://pharo.fogbugz.com/f/cases/17904

17912 QualityAssistant v2.6.2
https://pharo.fogbugz.com/f/cases/17912

50668
17909 Update Rubric to 2.16
https://pharo.fogbugz.com/f/cases/17909

50665
17218 needs to use new spec drag n drop transfer models
https://pharo.fogbugz.com/f/cases/17218

17823 Critic browser is not dark theme friendly
https://pharo.fogbugz.com/f/cases/17823

17898 RPackage>>#isDirty speedup
https://pharo.fogbugz.com/f/cases/17898
50664
17901 Morph#>>openCenteredInWorld do not use Display
https://pharo.fogbugz.com/f/cases/17901

14107 Truncated text on text lists with bold font
https://pharo.fogbugz.com/f/cases/14107

17885 ThemeChanged improvements
https://pharo.fogbugz.com/f/cases/17885
50662
Moose

50661
17891 creating of a new method in “no messages” category does not update methods list in Nautilus
https://pharo.fogbugz.com/f/cases/17891

16309 ThreadSafeTranscript>>examples doesnt work anymore
https://pharo.fogbugz.com/f/cases/16309

16922 Nautilus: Using class pane menu entry “Add class” can cause problems
https://pharo.fogbugz.com/f/cases/16922

17878 KM calls to unimplemented methods
https://pharo.fogbugz.com/f/cases/17878
50663
17782 RPackageOrganizer data do not full correspond to the newely generated ones
https://pharo.fogbugz.com/f/cases/17782

15893 Nautilus refresh not fine enough
https://pharo.fogbugz.com/f/cases/15893

14528 OSWindow: move tests out of package
https://pharo.fogbugz.com/f/cases/14528

17893 CompiledMethod>>hasLiteralThorough: does not work properly for GlobalVariables
https://pharo.fogbugz.com/f/cases/17893
50660
17869 add support for indirect calls
https://pharo.fogbugz.com/f/cases/17869

50659
17872 simulation mirror primitive100 for perform with superclass is not working
https://pharo.fogbugz.com/f/cases/17872

17873 Simple Test Cases for String (continued)
https://pharo.fogbugz.com/f/cases/17873


April 15, 2016

Göran Krampe - Spry Modules

As discussed in the previous article I want Spry to have a trivially accessible persistence mechanism enabling something similar to the Smalltalk image model, but based on a database. The memory organisation in Spry is basically nested Maps. After dwelling a bit on the inevitable hard question about modules and namespaces I have decided on a design that I hope will turn out simple and reasonably powerful!

Smalltalk has a Dictionary holding all the globals forming "the roots" of the object memory. In Smalltalk this Dictionary is also itself a global variable accessible as Smalltalk, in other words Smalltalk == (Smalltalk at: #Smalltalk). The primary use of Smalltalk is to hold all classes by name, so they are all reachable as globals. Obviously Smalltalk can also hold any kind of object (not just classes) as a global.

Spry also has such a top level Dictionary, but in Spry we call a Dictionary a Map to be a little bit more aligned in terminology with other languages (and it's shorter). This top level Map is the root Map and it is accessible via the word root. In Spry the root word is actually bound to a primitive function returning this Map, so in Spry we also have root == (root at: 'root).

Ok, so Spry has a Map of globals and one way of using Spry is simply by populating root with words bound to functions making these functions globally accessible, it's how I have done it so far. Yeah, yeah, I know, but for smaller systems it probably works just fine!

But...

Modules

But we do want a Module concept and given that I once designed a Namespace model for Squeak (that never was accepted) - it was inevitable I guess that it would reappear in Spry! :)

As many other languages do, I also simplify by making a "Module" do double duty as a "Namespace". It's a reasonable approximation although to be precise a Module is normally a deployment, versioning and distribution unit and a Namespace should ideally be aligned with how we humans are organised, but... whatever. In Spry I also simplify by not allowing nesting of Modules. A Module is simply a Map bound to a global word.

Modules need to have meta information about them. In Nim we use a Foo.nimble file to contain this meta information. In the JavaScript world there is a package.json file containing meta information. In Spry, since a Module is a Map, we let the _meta key hold a Map of meta information:

_meta = { name = "Foo" version = "1.0" author = "Göran Krampe" }

The name of the Module is thus only kept as meta information, this means that the code loading the module into our system decides what the Module should actually be named - thus we can choose to load a Module Foo by the name Foo2 if we already have a Module called Foo in the system. It could for example be used to have two different versions of the same Module loaded at the same time.

So how do we refer to things in different Modules? Obviously we can do it manually using (root at: 'Network) at: 'Socket, it's just a global Map after all, but Network at: 'Socket is simpler. I am also introducing yet another word type - a Module qualified word. It would look like Network::Socket and be evaluated as Network at: 'Socket. If we load another Foo as Foo2, then all existing references like Foo::Cat will of course not refer to the new Foo2, but we could easily scan for them and modify them, if we so wish.

To import... or not!

Finally, we face the issue of imports. Almost all programming languages use imports, often per class or file, but also per module. It's worth recognizing what true purpose they actually serve.

  1. One use of them is to avoid typing long names in the actual code, but ... that would typically only be an issue if module names where.. say very long like com.MyCoolCompany.ProjectX.Base.Common, but they aren't in Spry, since we don't allow nesting nor do we want people to use Internet domain names like that.

  2. It can be used to constrain the allowed references a Module can have, but... in my experience it's not often used to do that. One could however imagine a system of declarative rules of what modules can access what other module, or which group of modules can depend on which other group. In fact, I designed such a tool for Java back in ... waaay back.

  3. To enhance completion, only completing within the imported union of modules. I don't really view this as a critical thing, and it can also be solved using heuristics. Smalltalk systems also complete these days, and not having imports hasn't really made it less useful.

  4. To act as documentation for a Module showing what other Modules it uses, but... then we should not allow fully qualified references in the code since that invalidates this purpose. And we could trivially scan and find all usages within the Module without the import statements.

To sum it up...

In my proposal for Squeak there were no imports either, the idea was to always have the full reference in the source code, but to let browsers "render them short" if the unqualified name still was unique in the image. In Spry I am opting for a slightly different approach:

  • For a regular word lookup eventually ends up looking in root for globals. If it fails, it looks through the Modules one by one until it finds a hit. This means Socket will resolve to Network::Socket if Network is the first module found containing that word, and there is no global Socket shadowing it.
  • For a module qualified word, like Network::Socket, lookup is directly in the module by that name, we never look at globals. If there is no hit, it's not resolved, so no need to look elsewhere.

This means we can still use Socket in short form, but be aware that it means "Give me the first thing you find called Socket". If we qualify it means "Give me Socket in the Network module".

Thus, if we let root at: 'modules be a Block of the modules that wish to participate in such an ordered lookup - that should be enough!

Next Steps

So I will:

  • Write some module tests.
  • Add the global modules block and adjust lookup to use it for non qualified words.
  • Add the module qualified word and it's special lookup.
  • Make some base modules and add some mechanisms to ispry (the REPL) to use them.

When this works it's getting time to hook into Sophia!

Happy Sprying!