QuickSilver 0.6 – Cascades and Block Returns

February 10, 2011

QuickSilver Version 0.6

QuickSilver Version 0.6

http://www.silversmalltalk.com/index3.html

Code in the above example is:

1 to: 100 do:[:i |
Vm println: i + ' hello'.
i >= 50 ifTrue:[^i*i]]

Version 0.6 implements message cascades and block returns.

Source code is here.

There are also some new standard messages implemented:

-- "ifNil:"
-- "ifNotNil:"
-- "~="
-- "=="

QuickSilver now implements most of the standard Smalltalk control structures and the major development coding is complete.

There is now a Google Project for QuickSilver Smalltalk. All subsequent versions will be compiled from the online source.

I will also be changing the home page of http://www.silversmalltalk.com to run QuickSilver by default.

It is now time to start building some tools and applications.

Advertisements

15 Responses to “QuickSilver 0.6 – Cascades and Block Returns”

  1. Jose Says:

    Peter,

    I can create new/custom Smalltalk control structures?

    for example: on Object class

    * if:aBoolean then:aBlock
    * if:aBoolean then:aBlock else: anotherBlock
    * do:aBlock while:aBoolean

    • Peter Fisk Says:

      Not at the moment.

      But, it should be easy to change the compiler to add new control structures.

      • Jose Says:

        I like to see this feature,

        IMHO, one of the best features in smalltalk is that you can “change existent” or “define custom” control structures…

        Peter CONGRATULATIONS !!

        QSS is the first “user friendly” smalltalk environment that I tested…

        * no instalations (only use the browser)
        * no “images”
        * transparent compilation
        * quick & easy environment (only need a javascript code browser and editor)


  2. 😀 looking forward to creating my first Silver class. Brilliant Peter!

  3. Jose Says:

    Peter, Can you upload your source to (google-code) svn repository?

    Thanks,

  4. Jose Says:

    Exist as downloadable zip (on “Downloads” tab) but SVN repository is empty (on “Source” tab -> “Browse” link)

    * trunk, tags and branches are empty (without any source)

    I use a SVN client to synchronise with repository (download last sources) instead of download/unzip/copy to my local QSS folder.

  5. Peter Fisk Says:

    Hi Jose,

    Yes, I know that the SVN is empty. I just have not had time to organize it.

    — Peter

  6. Jose Says:

    Peter, please sorry for my impatience…

    My first contrib:
    After download, you can use SST open index.html on your browser as local file (I can test my smalltalk on local without any web server!!)

    Only need some changes…

    * On server.js:

    	readFile : function(fname, fn) {
    		if ( document.location.protocol == "file:" ) {
    			var ifr = new IFrame({
    				src: String.format('qst/{0}.st', fname),
    				events:{
    					load: function() {
                                            fn(this.contentWindow.document.body.firstChild);
    					}
    				}
    			}).inject(document.body);
    		} else {
    
    			Ext.Ajax.request({
    
    				url : String.format('qst/{0}.st', fname),
    
    				success : fn,
    
    				failure : function() {
    
    					alert('read failure of: '+ String.format('qst/{0}.st', fname));
    
    				}
    
    			});
    		}
    
    	},
    
    

    * On loader.js:

    	loadFile : function(fname) {
    
    		var fn = function(response) {
    			var text = ((typeof response.responseText != "undefined"))?response.responseText:response.innerHTML;
    
    			var chunks = text.split('\n!\n');
    
    			for ( var i = 0; i < chunks.length; i++) {
    
    				var chunk = chunks[i];
    
    				if (chunk.length > 0 && chunk.charAt(0) != '"')
    
    					Smalltalk.vars.Vm.eval(chunk);
    
    			}
    
    		};
    
    		Smalltalk.vars.Server.readFile(fname, fn);
    
    	},
    
    

    * On index.html add mootools:

        <script type="text/javascript" src="mootools/mootools-1.2.1-core.js"></script>
        <script type="text/javascript" src="mootools/mootools-1.2-more.js"></script>
    

    Alse need Extjs files: css, images and js

  7. Jose Says:

    This patch works on both environments (local files and web server).

    When I had some time I will try to remove mootools dependency…

  8. Jose Says:

    Remove mootools dependency from index.html on local files:

    On server.js:

    readFile : function(fname, fn) {
      if ( document.location.protocol == "file:" ) {
        var ifr = document.createElement("IFRAME");
        ifr.src = String.format('qst/{0}.st', fname);
        ifr.style.display='none';
        ifr.onload = function() {
          fn(this.contentWindow.document.body.firstChild);
        }
        document.body.appendChild(ifr);
      } else {
        Ext.Ajax.request({
          url : String.format('qst/{0}.st', fname),
          success : fn,
          failure : function() {
            alert('read failure of: '+String.format('qst/{0}.st', fname));
          }
        });
      }
    },
    

    On loader.js replace line:

    var text = response.responseText;
    

    By:

    var text = ((typeof response.responseText != "undefined"))?response.responseText:response.innerHTML;
    

    Tested on firefox-3.6.13 an Opera-11.01 on Mac OSX 10.6.6
    Not works on Chrome/Safari by browser bug: http://code.google.com/p/chromium/issues/detail?id=31068

  9. Jose Says:

    Peter,
    An error on last version…

    1 to: 100 do:[:i |
    Vm println: i + ‘ hello’.
    i >= 50 ifTrue:[^i*i]
    ]

    Returns: 2500 (but not print 1 to 50 “hellow”)

  10. Peter Fisk Says:

    I removed println: from Vm.
    Try this:

    1 to: 100 do:[:i |
    Transcript println: i + ‘ hello’.
    i >= 50 ifTrue:[^i*i]
    ]

  11. Jose Says:

    Works fine.

    Thanks


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: