Novel Thoughts on Scripting and Languages

Neil Hodgson nhodgson at bigpond.net.au
Wed Jan 8 07:56:44 EST 2003


   The core difference between Python and JudoScript are that JudoScript
allows more Perl-like quoting and Smalltalk like blocks. The documentation
manages to obscure this greatly so I couldn't work out how to define a new
equivalent to do ... as sgml.

James Huang:

> Anyway, to answer your concerns over Jython, first of all, assume you
> accept that JudoScript is as capable as Jython to script Java. The
> following examples demonstrate some of the differences:
>
> -------------------------------------
> thread mythrd param1, param2
> {
>   println 'parameters are: ', param1, ' ', param2;
>   println 'Done.';
> }
> start thread mythrd(1, 'xyz');

   Python equivalent (although I'd normally subclass Thread instead):

def mythread(param1, param2):
   print 'parameters are: ', param1, ' ', param2
   print 'Done.'
threading.Thread(None,mythread,'',(1,'xyz')).start()

> -------------------------------------
> copy '*.java, *.jj' in '~/src/' except '*Test*, *test*'
>      recursive
>      into '~/archive/src_' @ date().fmtDate('yyyy-MM-dd') @ '.jar';

   This is a a function call with keyword arguments. 'copy' could be
implemented in Python with equivalent functionality and would be called
like:

copy(['*.java, *.jj'], in='~/src/', except=['*Test*, *test*'],
      recursive=1,
      into='~/archive/src_' + date().fmtDate('yyyy-MM-dd') + '.jar')

> -------------------------------------
> do 'http://www.yahoo.com' as sgml
> {
> <a>:   println $_.href;
> <img>: println $_.src;
> }

   In Python this is sometimes done with methods like so:

class mySGML(SGMLResponder):
    def a(self):
        print self.current.href
    def img(self):
        print self.current.src
do_sgml('http://www.yahoo.com', mySGML())

   Where the method names themselves are insufficient to handle all the
cases, doc comments are sometimes used as an extension mechanism.

   The JudoScript style can be more closely emulated in languages with
blocks like Ruby. I'm not that familiar with Ruby so there may be some
mistakes here. This could look like:

do_sgml('http://www.yahoo.com',
{
"<a>" => { println _.href },
"<img>" => { println _.src }
})

> -------------------------------------
> preparedExecuteQury qry:
>    select name, email from emp where id=?;
> with @1 = '00123';
> while qry.next() {
>   . 'Name:  ', qry.name; // '.' is synonymous to 'println'
>   . 'EMail: ', qry[2];
> }

   The SQL features seem to be just functions/methods with variable
interpolation.

> These were all in its initial release. It is the vision of these (and
> more) plus Java scripting that convinced that this language is worth
> doing.

   What *exactly* is the vision. Looks to me like the capabilities are the
same as Python/Ruby/Perl but with different syntax. Other scripting
languages than Python are closer to the styles of syntax JudoScript uses. We
Python users tend to like constrained syntax instead, including, for
example, the lack of regular expression literals or here documents.

> Python land has wheat, Java land has rice; both are rich in
> carbohydrate. In addition, Java land also grows beans. What do you
> want to ship across that bridge? If you one day decide to reside
> permanently in Java land, why don't you drive a Cadillac but instead a
> Lexus? In any case, JudoScript is a hovercraft.

   They are all programming languages. Hyperbole is less likely to win
converts than understandable documentation.

  Neil






More information about the Python-list mailing list