Novel Thoughts on Scripting and Languages

James Huang judoscript at hotmail.com
Thu Jan 9 01:09:46 EST 2003


"Neil Hodgson" <nhodgson at bigpond.net.au> wrote in message news:<geVS9.14961$oS1.61201 at news-server.bigpond.net.au>...
> 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()
> 

Close enough.

> > -------------------------------------
> > 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

General-purpose languages can do anything, so your first statement is
always true. The vision is, JudoScript has very high level constructs
including syntactical support, so that in many situations you can
specify solution straightforwardly, intuitively and concisely. Of
course, you can program, even for those areas that have high-level
support (for whatever reason, say, study a particular Java API like
javax.mail.* or java.util.zip.*).

For the lack of words, try this: scroll back to your response of
"do_sgml()" to my "do .. as sgml" example, move back 3 feet, and see
if you can understand what my code does and what yours does. :)

> Python users tend to like constrained syntax instead, including, for
> example, the lack of regular expression literals or here documents.

Agreed. Java1.4 and JudoScript does the same. I believe that Python's
programming model is exactly right, so is JudoScript's because it's
virtually the same. I hate visual polutions, especially in code. I
love simplicity, extremely. Count this as part of the vision.

> 
> > 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.

Just tired of being tied up to 0s and 1s too much. Converts would be
good, but wouldn't this be fun itself?

I am proud of the documentation of JudoScript, although there is
always room for improvement. But your good suggestion is well taken
anyway.

> 
>   Neil

Thanks, for one of the best responses.

-James




More information about the Python-list mailing list