Novel Thoughts on Scripting and Languages

James Huang judoscript at hotmail.com
Wed Jan 8 23:47:39 EST 2003


Andrew Dalke <adalke at mindspring.com> wrote in message news:<avi2jc$o0n$1 at slb2.atl.mindspring.net>...
> James Huang wrote:
> > This is an example of scripting:
> > 
> >   sendMail
> >      from:  'me at here.com'
> >        to:  'a at b.com, b at c.com'
> >        cc:  'd at e.com'
> >   subject:  'test test'
> >    attach:  'bin.jar'
> >      body:  [[*
> >                 blah blah blah
> >                 blah blah
> >             *]]
> >  htmlBody:  [[*
> >                 <html><body><b>Blah</b> blah
> >                 </body></html>
> >             *]]
> >  ;
> 
> As compared to programming which would let you specify the MIME
> type for the attachment, or compose the content dynamically instead
> of from a file, and say that the htmlBody is multipart/mixed instead
> of multipart/alternative, or include PDF as one of the possible
> alternatives?
> 
> Here's an example of something I don't see 'nicely' doable with
> your API.  I want to send email to my clients.  For each client I
> want to include a little graph (say a bandwidth usage graph) which
> is automatically generated from my database.  In Python I can do
> all this without having to explicitly use a temporary file.  It
> seems that you have to create a temp file, which then means you
> need to worry that the current directory is writeable or that there
> isn't some sort of attack possible in your common-writeable
> temporary directory.  (Hence not as 'nice'.)
> 

First off, I don't call "sendMail" an API (but that again may fall
into the meaningless confusion of what exactly is API, scripting,
...). For what you described, you are right, you need to fall back to
API such as Java's javax.mail.* package, which is used by this
"sendMail" statement.

Obviously, you are an expert in mail programming, and the situations
you described are rather involved. It all boils down to probability
when analyzing computer systems -- what are the probabilities of what
JudoScript-sendMail can handle and what not. Also, how many people can
use JudoScript-sendMail, how many use mail API(s)?

> 
> I also wonder if there are problems sending headers which use
> multiple character sets.  You only allow one character set for all
> of the header.  Suppose my name is Peréz (in the From line) but
> I want to send a Subject in Japanese?  Now, I don't know enough
> about character sets to know if this is a problem (perhaps Hebrew
> and Japanese might be a problem?) or even if email programs allow
> this.  But I do know the email spec for encoding in the header
> does allow intermixing multiple character sets in even the same
> header line -- and Python's API supports it.
> 

You can specify different character-sets for any of these 3:
"sendMail", "body" and "htmlBody". I've heard Japanese emails may use
different encodings for differnet parts, as you described.

> Anyway, if these limitations are part of scripting then I
> prefer programming, where I can easily define a new function for
> the special (though common!) case you have above.
> 
> There is an argument for making a programming language which is
> easy to use so that non-programmers can work with it -- the
> "Computer Programming For Everyone" idea.  That must be balanced
> by the fact that while the common case is common, the special
> cases are needed, even for beginners.
> 

JudoScript's extremely-easy-to-use features are not designed for
non-programmers, but rather for potent programmers especially those
who know Java. I can program javax.mail.*, big deal, but only if I
have to.

> by the fact that while the common case is common, the special
> cases are needed, even for beginners.

JudoScript's many easy-to-use features do not stop you from invoking
underlying APIs at all.

It is hard for me to understand why some programmers are so afraid of
easier ways of doing things (not necessarily you, Andrew, but there is
an anonymous guy responded to an article on LinuxJournal site). We can
program does not mean we have to program, unless, perhaps, for job
security reasons.

> 					Andrew
> 					dalke at dalkescientific.com

Thank you,
-James




More information about the Python-list mailing list