In recent years “scripting languages” are becoming a path which is a must go for rapid application development. The open source community has seen many scripting language implementations. Some really popular and good ones available are perl and python.
I recently had a pretty good discussion about this with one of my friends on chat. Mary was trying to find out about type systems in general and the basic classification of languages in terms of the typing system they use. The following is a summary of what we discussed and finally concluded upon.
The major reason why scripting languages exist these days is because it is easy to develop using one. Most scripting languages don’t enforce type declarations of the variables which relieves the developer from supplying the type of a variable every time he declares it. Scripting languages often feature a very rich set of primitive data structures which can be operated upon easily by using very concise syntax. They also feature a huge library repository so that the developer time is cut down.
These were more like the “language inherent” features of a scripting language. Scripting languages also have another notable common aspect which is of the way they are implemented. Almost all scripting languages are interpreted. Often, in popular use of term, “scripting” is generally attributed to an interpreted language implementation rather than one which has language features like the ones shown above. However, this might be incorrect to say if we adhere strictly to the “ease of programming aspect” of scripting languages as their compelling feature.
Personally, I give a lot of importance to efficiency. That means I am not glad to see slow implementations of good scripting languages. However, I also understand that these days programming throughput is so important that people are willing to sacrifice efficiency for gains in programmer productivity. This brings us to an important question. Does programmer productivity imply an interpreted or slow implementation of the language? Programmer productivity depends on a number of things
– The ease of use of the language (availability of high level data structures and operations, relaxation of type declaration)
– Lesser learning curve for the language itself
– As a (though not a very avid) developer, I have seen that the major amount of learning curve that I face is from learning new APIs for different languages. Often getting used to the libraries of a language is more demanding than learning the language itself.
– An easy way to integrate native (harder but more efficient) languages to the scripting language. One may think of the scripting language API in a low level language like C to be the bridge used to do the same.
It should be noted that none of the above features actually imply that the language implementation be interpreted. Often the meta-hacking and introspection demands in a scripting language are high. However, even this amounts to a powerful runtime of the language and doesn’t necessarily imply an interpreted language implementation. In fact, the very fact that scripting languages and native languages are so diverse offer rest of the three problems to a programmer.
Mainstream programming languages have also come far from the times of the assembler and C. Nowadays languages sport constructs for object oriented programming, sometimes even syntactic sugar for commonly used primitives (C#?). Languages like OcaML feature a very rich type inference mechanism which does away with the need to supply types at all. This is like scripting languages with typeless variables except that in scripting languages the types are checked at runtime whereas in OcaML it is statically checked, making the final compiled program faster. Advances like these show that it is possible to keep an efficient implementation of the language even if the language has scripting language like features. Languages like Java have a really powerful runtime which enables programs to introspect existing data structures and what’s more, even create custom types while the program is running. Language features like these go a long way to support better software engineering practices and increase productivity.
It is in fact possible to eliminate the other three hurdles in programmer’s productivity by implementing a well designed language system. Why do I call it a language system? It is because, most often than not scripting languages are used to glue together natively implemented components. Thus libraries of the scripting language are native, but the program is made in the scripting language. Sometimes, scripted components are called from inside the native application. All this motivates a good amount of interoperability between the two languages and that’s where the API for the scripting language in the native language comes in. This bridge should be easy to use. In a well designed language system, this bridge can also be entirely eliminated. The best example of such a system that I can think of is BeanShell/Java. The BeanShell scripting language is an adaptation from Java itself except that it has the features of a scripting language like typeless variables and syntactic sugar.
However, since the languages are inherently the same the system attempts to completely do away with a bridging API. Thus BeanShell scripts can run in the same runtime as the native Java program itself. They have completely interoperable objects and methods. So an object in BeanShell can be thought of as a normal object in Java and vice versa. There is no API required because the BeanShell scripting engine takes care of making objects in BeanShell interoperable with those in Java using Java’s powerful reflection mechanisms. Now let us see what does this system give us. Learning curve for the language? Very little as it is an adaptation from the native language we are anyways supposed to know. Learning curve for libraries? None, as it has the same library suite that Java has except that now it is available from a language which is easy to program in. Learning curve for the bridging API? None again as there is no bridging API! However, BeanShell/Java is not a very perfect system for the following reason.
Java is a neat language and there have been claims that it runs fast enough to be compared to C/C++. However, it still has a large memory foot print and high startup times. The complaint is more against Java than BeanShell. Current implementations of Java still rely on a Java runtime to C runtime bridge for most system calls. It would have been better if Java was directly used for interfacing with the OS… just too many issues to discuss here.
BeanShell doesn’t give any high level convenient data structures like other scripting languages. It would have been great if BeanShell had syntax for directly manipulating data structure classes in the Collections Framework. Some more operations could also be automated. This might result in some form of a bridge API emerging. However, it will never be a bridge between the two languages. It would be a bridge between high level data structures only.
BeanShell is interpreted and slow when it might have chosen not to be. Perhaps it was in the interest of BeanShell (designed to be embed-able in Java applications) to be implemented in Java itself and exploit reflections through the Java API. It might have chosen to compile the script to bytecode on the fly and then run it. However, this is not the goal of BeanShell. BeanShell is supposed to convert a script into some data structures, objects and changes in the runtime such that it seems as if the script executed as a Java program in the same runtime.
By a language system we are targeting the same runtime, the same libraries via two languages. One for rapid prototyping and one for actual type checked, efficiently compiled prototyping. This is close to the .NET architecture except that instead of having “the one” runtime for all possible languages in the world, you have one runtime for each native language with a scripting dialect also compiled in the same runtime. Having “the one” runtime causes languages to be forced out of their natural being into a model more suitable to the runtime. Thus, if .NET has a predominantly object oriented kind of a runtime, Haskell or Lisp will look kind of odd on it.
Another compelling feature of scripting languages is that they are embed-able in applications. Thus, the native program itself can convert a script string supplied, to meaningful operations on its own data structures. BeanShell is essentially aimed at this. Such language implementations could be interpreted. However, it is again possible and desirable to be able to actually compile them on the fly and embed them in the existing language runtime. Such an API for executing scripts could actually be derived from the scripting dialect implementation itself as discussed in the previous paragraph.
And now some rant ;-). I have been looking at this language called Objective C lately. It seems to be a natively compiled version of a language like Java. Apart from that it is fully and efficiently interoperable with C (this is a big plus!) and has a powerful runtime. This it is an excellent candidate for being the native language part of a scripting dialect. The scripting dialect could be used for rapid prototyping without alienating a lot from the base language and at the same time contributing to a common pool of libraries. The scripting dialect would basically consist of the scripting language definition, and two implementations of it; one for compiling these to generate native code for the same runtime, and another providing an interpreting API which would allow us to embed scripts into applications. The interpreting API could as well be a Just-In-Time compiler, reusing the effort spent in making the native compiler for the dialect. Has anybody done this for Objective-C? (I have heard about a python implementation in python from one of my friends… we now know a use for that. But again, I won’t choose python as a native language for a good language system.)
About the Author:
Ritesh Kumar is a graduate student in the Department of Computer Science, University of North Carolina at Chapel Hill. Operating Systems, Systems design and Development Platforms are things that interest him the most. He can be reached at ritesh at cs dot unc dot edu.
If you would like to see your thoughts or experiences with technology published, please consider writing an article for OSNews.
” I have been looking at this language called Objective C lately. It seems to be a natively compiled version of a language like Java.”
Well, Objective C tends to fall in the more dynamically-typed language category. It’s a lot more similar to SmallTalk or Ruby ( http://www.ruby-lang.org ) than it is to Java.
In fact, you can write extensions to Ruby in Objective C. This would be very similar to the scenario you describe where parts of your system are written in a compiled language and other parts are written in a ‘scripting’ language for rapid development.
Lua was designed with embeddability and compatibility with C in mind. I’ve seen some pretty impressive ways of implementing it with more object oriented languages/libraries, too. It’s really quite nice.
http://www.lua.org
Worth looking into. I’m sure it could talk nicely with objective C.
Oh yeah, and it’s really fast.
Ruby ( http://www.ruby-lang.org ) plays well with Objective C.
You can write extentions to Ruby in Objective C. It’s quite nice since Objective C is your compiled language with some dynamic features and Ruby is a very dynamic OO programming language that is great for rapid development.
While there’s talk that Objective C influenced Java, I don’t see too many similarities between them. Strike that, I don’t see any similarities between them.
…and I don’t mean the abhorrent sh/bash scripting language.
while I would prefer to see perl integrated tightly into the system (make ‘psh’ the default shell), too many people are repulsed by the syntax. I would settle for python. ANYTHING but the utterly limiting and archaice sh syntax.
(I believe Perl 6 isn’t either)
Python is a bytecode compiled language (simmilar to Java or .NET), it just compiles on the fly.
You even have the option of using the compiled language by accessing the .pyc part.
Python has full OOP with multiple inheritence, operator overloading, etc…
Basicly, Python CAN be used for some simple scripting, but it is definatly used for much more then that.
From the horses’ mouth:
http://www.virtualschool.edu/objectivec/influenceOnJava.html
maybe you should check out csh, it’s a shell with, that’s right you guessed it, a c like syntax.
also, it’s really easy to use system calls in perl, just enclose it with a `
eg
#!/usr/bin/env perl
#
my $cat_output = `cat /etc/fstab`;
print “Here are the contents of /etc/fstab:
$cat_output
“;
“””
Mary was trying to find out about type systems in general and the basic classification of languages in terms of the typing system they use.
“””
The series of papers “The Theory of Classification” by Anthony J H Simons are pretty good on that topic –
http://www.dcs.shef.ac.uk/~ajhs/classify/
IMHO Scheme is an excellent candidate to build other languages on.
I’m sure that Pike should also be noted here.
http://pike.ida.liu.se/
where would Prolog fit into all of this? it’s run through an interpreter but you can’t run it like you can with perl or can you? i though the only way of running it without opening up the Prolog interpreter was by compiling it into binary. i could be wrong though…
I can recommend Ruby. Its syntax is really gentle, with a low signal to noise ratio. I am more productive than I have ever been before (Sml, C++, Pascal, Basic).
I care about that my programs can easily be maintained, even long after I am gone.. Ruby fits this perfectly.
“””
Python is a bytecode compiled language (simmilar to Java or .NET), it just compiles on the fly.
You even have the option of using the compiled language by accessing the .pyc part.
“””
Aren’t most “scripting languages” compiled to bytecode internally these days? Some languages just don’t write bytecode to a file. It seems strange to say it is “not a scripting language” just because of that.. Java and .NET at least optimize bytecode and have JIT compilers, whereas Python .pyc is generated just to avoid reparsing sources (and normally is written for imported modules only, not for main script).
There used to be an Objective-C scripting language using WebObjects/NeXT called webscript, but it was abandoned. However, there is a very interesting scripting (as well as compiling) language for OS X which is a strict superset of Objective-C called F-Script ( http://www.fscript.org/ ). It also makes use of the Cocoa libraries, and, of course, all things C. (Not sure if it can use Obj-C++ to access C++ libraries.) — There was also something called Joy which seemed nice, but it hasn’t been updated in years. More options?
“””
Java and .NET at least optimize bytecode and have JIT compilers, whereas Python .pyc is generated just to avoid reparsing sources (and normally is written for imported modules only, not for main script).
“””
Python writes pyc files for the main script aswell (Atleast on my machine) and has a flag to generate it automatically. It also does optimisations when it compiles, just not agressive ones.
See here for an example of ‘optimizing’ some common operations: http://manatee.mojam.com/~skip/python/fastpython.html#notc
(specifically how +, *, and << perform the same unlike in other languages)
Second, Python does have somethine like a JIT compiler:
http://psyco.sourceforge.net/introduction.html
So why is Python a scripting languae and Java/.NET not?
Yes, cool that another one is using this language as well
I really like programming in C, but some months ago I was searching for a scripting language, which would not have to be compiled for some quick’n dirty scripts.
I looked at perl, python and ruby, but none of them kept my beloved C/Java syntax.
But finally I found pike, and it is really C for scripting with some cool features (like switch() on strings, or advanced array handling).
http://www.ruby-lang.org/en/
http://www.rubycentral.com/
bash, perl, python and others are just wannabe scripting languages. i know perl and learnt python but ever since i touched ruby, i haven’t looked anywhere else.
in less than 2 hrs, i put together a photo-album creation script that uses ImageMagick to do the scaling blah blah blah and does GREAT layout in HTML, and takes a snapshot of movies to show in thumbnail (mjpegtools)
ruby IS the way to go, anyone who tells you otherwise just doesn’t know enough.
here’s what i use.
C – kernel and systems coding (C++ sometimes for systems stuff).
tcsh – basic shell scripting (like 5-line scripts)
ruby – long term shell scripts.
I was expecting to be the first Ruby fan poster.
I better get on the line. 🙂
Funny that the article didn’t even mention it.
I can code in Ruby all day long without getting tired. (But I may run out of ideas, cause from idea to code is fast with it 🙂
To quote Ralph Richard Cook: “I look at it this way. A lot of the new, interesting software is being written in a combination of two languages; a high-level, dynamically typed language with good built-in data structures and an environment for rapid software development, and a statically typed, heavily optimized language for performance. For a Python programmer, these two languages are Python and C. For the Common Lisp programmer, the two languages are Common Lisp and Common Lisp.”
“Python is a bytecode compiled language (simmilar to Java or .NET), it just compiles on the fly.
You even have the option of using the compiled language by accessing the .pyc part.”
Does it depend on a runtime? Yes, so for the sake of deciding whether it’s appropriate for a situation or not it is a script. If you precompile it then I suppose you don’t need to call it a runtime.
And PERL 5 and I believe all previous versions compile to bytecode. What makes python different is that as it is a whitespace nazi it can be more efficient in the parsing stage.
Ruby has pulled me out of a language-rut. I went in search for a language to replace my bash scripts, and after using perl i knew there had to be something better. The first language I tried in my search was python, since I heard a lot of things about it. Yuck. talk about psuedo-object-oriented. Why in a modern language do you have to pass self to every member method? Well after going through the free online ruby book (http://www.rubycentral.com) i was in LOVE. What a beautiful language. it’s as if the author said “what’s the best about all languages” and combined them into one. blocks for closures, statements return values like lisp, EVERYTHING is an object, classes can be dynamically altered, lambda methods, built in accessors/mutators, CLEAN syntax, native inline regexes, array and hash literals, you name it. it’s just simply the best language i’ve ever seen.
There is an open source scripting language for Objective-C called F-Script at http://www.fscript.org . Like BeanShell with Java, F-Script directly manipulates Objective-C objects, without the need for a bridge. In addition, it has a very interesting object browser with let you browse Objective-C objects and invoke methods.
blahblah: want a Python-enhanced command line?
http://ipython.scipy.org/
CitizenKane: the major difference between Ruby and Python is style. If you spend a few minutes perusing both main sites and compare syntax, you’ll discover that they have a large portion of syntax in common, likely due to the fact that Yukihiro Matsumoto knew Python before starting in on Ruby. Seems he was dissatisfied with Python’s OO syntax, and the toy-like nature of Perl back in ’93.
http://www.ruby-talk.org/blade/00382
On the most part syntactically, Perl + Python -> Ruby.
Oh, and Python doesn’t aspire to be a “scripting language”, when it is a general-purpose programming language that can used for scripting (exemplified by the fact that you need to import a module to execute external processes).
http://www.rebol.com/
You got to love a language that is 560Kb (including a GUI)!
(and 217Kb for the console only version). Compare that to the Mb’s and Gb’s for others.
AND it works on 40+ operating system platforms…
Carl Sassenrath has a good idea, I wish it was used a LOT more widely.
2 pages, 3 languages: OCaml, Objective C and BeanShell. Of those only the last is a scripting language, and even then not commonly used. Bizarre.
I first started learning programming from shell scripting under Linux. From there I moved on to Python. I loved it until I found Ruby. I absolutely love the syntax of Ruby. To me, it seems so easy to write such small and succinct code. The only problem is that for number crunching, it doesn’t seem to be very fast. Perhaps it’s not something that people do often, but I had to generate a little over a million numbers to keep in a list one time, and it took my computer over 3 minutes to do it. I know it wasn’t the fastest of computers (800MHz 2GB/RAM), but that was way too long to take to do that. I also like Common Lisp ALOT, but “simple” things like splitting strings at specified patterns can be a REAL pain, so I have trouble finding that one to be practical.
” had to generate a little over a million numbers to keep in a list one time, and it took my computer over 3 minutes to do it.”
Sounds like you could have used narray (numerical Ruby) to speed things up considerably, for more info see:
http://www.ir.isas.ac.jp/~masa/ruby/index-e.html
“CitizenKane: the major difference between Ruby and Python is style.”
Josiah Carlson: On the surface this may seem to be the case, however if you look a bit deeper you’ll find more significant differences. Ruby’s blocks are a deceptively simple, yet powerful feature for creating domain specific languages; Python doesn’t have anything similar.
Here’s a couple of recent posts to ruby-talk from a Pythonista who recently looked into Ruby in depth and found more difference than just style:
http://www.ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-talk/99802
http://www.ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-talk/99817
“””
Does it depend on a runtime? Yes, so for the sake of deciding whether it’s appropriate for a situation or not it is a script. If you precompile it then I suppose you don’t need to call it a runtime.
“””
So I suppose .NET and Java are also scripting languages?
” I have been looking at this language called Objective C lately. It seems to be a natively compiled version of a language like Java.”
Objective-C is an object-oriented superset of C which was created by melding ANSI-C with Smalltalk. Because it’s Smalltalk-based, the syntax takes a little getting used to, but once you get the hang of it you’re spoiled for anything else.
Yu might want to try out StepTalk,
http://steptalk.agentfarms.net/
which is a Smalltalk-based scripting language that sits on top of GNUstep, the open-source variant of the old NeXT platform. GNUstep is built with Objective-C and currently uses its own variation of Apple’s Foundation and Appkit classes. IIRC, StepTalk is actually a variant of Smalltalk, but for use with the Objective-C classes of GNUstep.
You might also be interested in GNU Smalltalk. Unlike traditional Smalltalk systems, this one is command-line driven, and is very well suited to scripting tasks. You can check it out at:
http://www.gnu.org/software/smalltalk/smalltalk.html
Dean Powell
Discussion of scripting languages without any mention of Tcl is just hilarious.
Ever heard of Jython and Jacl? Jython is pure Java implementation of Python, Jacl is pure Java implmenetaion of Tcl, having all good points claimed by BeanShell.
Both can be compiled down to JVM bytecode. Both have automatic Java bridge, with native syntax. (Jython can subclass Java classes, Jacl can call Java methods as action family commands, etc.)
And they are *real* languages, many years of efforts behind their syntax and core libraries. Yes Jython and Jacl passes Python and Tcl’s syntax regression test suite and have all the core libraries Python and Tcl programmers would expect.
Python has a semi-automatic bridge to Objective C. With PyObjC Python class can subclass Objective C classes and Cocoa application can be written only in Python. It also works with GNUstep in some degree.
Thought I would mention javascript here as well. Javascript is a rather suprising language that has been tainted by different support in browsers.
Recently used Rhino (from Netscape) in a Java project and was pleasantly surprised by it.
Mixing Javascript and Java in one project clearly highlighted the advantages of scripting languages. The Javascript elements were simpler without all the casting and error handling. I wouldn’t want to do the entire project in javascript but I really want to integrate Rhino with every other project I am working on.
It seems to me that Perl epitomised the scripting approach with it’s “just works” and “gets the job done” “quickly and easy” philosphies. Something that most high level languages (in particular Java) have certainly forgotten.
Assembly Coders – these are extinct group of primitive
form of life before the advent of culture or
civilisation, althought having no access to
any formal human-recognizable language structure
they were amazingly versatile in their skills
to construct reality by pushing and popping strings of
little pebbles from holes dug in the ground. Ancient
arcade machines sometimes found in desolate pubs
testify to their once glorious existance.
C – C Programmers are more like highly evolved alien beings
from outer space who spoke purely in binary
and pointers. They often take the disguise as
unsightly middle aged man with beard and glasses
amongst earthlings. They do not care for the
artifacts of language or culture, they only care
for the semantics. Their job is to construct and engineer
the roads, the transportation, the network lines,
the infrasture that our civilazation have come to depend very much
on. They are very hard to communicate with as
intepreting their language requires unusually
greater IQ than most of our earthlings can aspire to.
C++ – C++ Programmers are born again C programmers
who realised their folly of seeing the world
in pure binary and pointers. They want to see
reality more concretely thus they talk in
objects and classes. More often than not,
C++ Programmers are still attached to their
old ways and their attempts to communicate
with others often result in abstrated
hodgepodge just as complicated as the C
language. Most C++ Programmers feel
they may have had a deprived childhood.
Java – Java Programmers are like C++ programmers
except they were brought up in aristrocat families.
Their manners in their language are refined and elegant
althought at times may appear slightly
pretentious and artificial. They are very
socially closed and mix with their own
kind only, basically they dont like
outsiders playing in their upper-middle class
private school sandbox. Being economically previliged
means they have ample access to inheritance
like network libraries, etc. Although their
reputation is good amongst corporate circles,
they are rumoured to be impotent when it
comes to GUI.
Visual Basic – Visual Basic programmers
are perceived to be like your every day a dime
a dozen computer science graduates. They
are naive, confident and sometimes a little brash
in their perceived ability to deal with the real world.
Their language developed from high school
jargons and street slang though highly
vulgar in the eyes of other programmers,
were often effective (or adequate) in solving a lot
of every day ordinary kitchen and sink
problems. Often the case, a job completed
by a Visual Basic programmer, thought cheap
and fast leaves little to be desired,
tales of half patched pipes leaking from under kitchen
sink are well known in the industry.
C# – C# Programmers are Java programmers
wannabes. wanting to achieve the same
social status and previledge that
Java programmers have, C# programmers
lacks the authentic social grace and ethics to
could help them rise above the
Visual Basic suburbia coarse mentality
that tends to predominate them. C# Programmers
also tends to like screen widgets that are glitzy.
They are the type of people
that the marketing department love
to target in their product focus group.
COBOL – Cobol Programmers are not really people, they
were actually mutated from hole-punch
card readers. they have no human affectations
and thus are very capable of churning out
millions of incredibly mundane and
humanly degrading pages and pages of
printed accounts reconciliation codes.
although they were disbanded
by the human rights organisation, Cobol
programmers were actively recruited just
before the millineum to solve the Y2k bug
which they were originally responsible for.
Fabled Programmers – the are many
species of programmers that claim
to exist but no one have ever met
any of these illusive creatures in real life,
althought they appear to be
very vocal in obscure scientific journals.
programmers who go under the
label of ‘FORTH’, ‘OCAML’, ‘Awk’,
‘Lisp’, ‘Eiffel’, ‘ADA’, ‘Modula-2’
are amongst the most commonly
heard fabled programmers.
The New Generation – the New Generation
are a renegade group of programmers of various
culture and descend. although subversive to the
traditional codes, the new generation
owe their competency and agility to
their heritage developed from the fabled programmers.
the new generation are confident and feel
rightly justified
due to their years of experience and abuse
from working
under the oppressive regimes of all the
other programmers. their alignment
with the open source movement shows their
idealistic pursuit for freedom and self
determination. Python, PHP, Perl,
Ruby, Rebol, LUA, D are the
most commonly used languages amongst
the New Generation.
Perl – Perl programmers represent
a good example of the possible dangers of falling
into one of the new generation renegade groups.
Perl programmers suffer the dellusional belief
that the Perl language is a real programming
language. programs that are written
in Perl (developed from layers of
very complicated command line options encrypted
in regular expressions)
often look like the work of a very mad
person, which enforces the common perpection
that all Perl programmers are mad or cult members.
Perl programmers also have plenty of ardent believers
in the second coming.
Every time I hear someone talk about how great Ruby is, they sound so… similar to how everyone else saying the same thing sounds. You never, EVER read someone’s post saying, “Ruby’s great! It’s pretty clean. It’s my fav.” Oh no. It’s always more along the lines of, “I used to use other languages. Then I found Ruby. Until you learn Ruby, you know not the secrets of Universal Nirvana and Enlightenment, which I have attained through learning RUBY.”
Am I going nuts, or do other people see it, too?
I used to use other languages. Then I found PLT Scheme. Until you learn PLT Scheme, y ou know not the secrets of Universal Nirvana and Enlightenment, which I have attained through learning PLT Scheme. 🙂
Python has preliminary PLT Scheme bridge. Search for PLT Spy on Google. So you will be able to attain the secrets of Nirvana and Enlightenment (blahblah) in comfortable Python interactive shell…
Yes, cool that another one is using this language as well
I really like programming in C, but some months ago I was searching for a scripting language, which would not have to be compiled for some quick’n dirty scripts.
I looked at perl, python and ruby, but none of them kept my beloved C/Java syntax.
But finally I found pike, and it is really C for scripting with some cool features (like switch() on strings, or advanced array handling).
If you cannot get over a syntax, that’s not good. You should study formal languages well and understand that syntax is really not a factor at all. If you know C or Java really well, a language like Python should take no longer than a couple days of reading a “Nutshell” book to grasp the syntax and common idea. Python behaves like C/C++ and java in that it is an iterative language that uses the while/for/if looping and branching mechanisims. If you spent a day with it, you would in fact find that it implements these in ways that are often more natural and logical for your purpose. My advice, not that you have any reason to listen to it, is to force yourself to understand a programming language, such as ML or Prolog or even Python to start, that is syntactialy different from what you are used to, to grasp a deeper understanding of what it means to construct an algorithm that transends the characters you see on the screen.
Python has Mozilla bridge, or to be precise XPCOM bridge. Therefore any Mozilla XP component can be used with Python, including Javascript one.
Python also has direct binding to Spidermonkey. (Javascript engine written in C. Rhino is one written in Java.) Search for python-spidermonkey. It allows you to call Javascript functions just like Python functions.
Python has binding to KDE component architecture, therefore you get KJS support for free.
Perl…it makes easy things easy and hard things possible!
’nuff said…if you can’t do it in Perl, you CAN’T do it.
Seo,
That’s actually my project.
True Nirvana will come by way of PyGTK inside DrScheme. 🙂
Nice to meet you! I am honoured. DrScheme rocks. I have my best regard to you and your project. Keep up the good work!
You forgot the footnote that says: “*only if you’re problem can be modeled as a regexp…”
Seo,
Nice to meet you too! Glad you’re into Scheme. Let me know if you ever want to work on a project with us!
“””
So why is Python a scripting languae and Java/.NET not?
“””
Well, one reason is that Python seems to be designed to be elegant and convenient, even when this sacrifices performance. Basically, more optimized for programmer productivity than code speed. Java/NET are strongly typed, which gives some performance advantages and early type error catching, that can be helpful in complex programs. OTOH, Python is great for small programs you want to write fast – for scripts.
I mean, if it is used mainly for scripts, let’s just call it a scripting language (Java&NET have a different niche after all). Also consider that it is somewhat hard to deploy python programs in other form than a bunch of scripts (yes, I know that there are third-party tools).
The Oberon System by Wirth and Gutknecht and all its successors (e.g. Blackbox from http://www.oberon.ch, Bluebottle from http://www.bluebottle.ethz.ch/) feature a small and efficient compiled language (variations: Oberon, Obebron-2, Component Pascal, Active Oberon) as both the basic language for system development and the script language.
Sun licensed and examined the Oberon compiler around 1991(!), and Microsoft Research subsequently hired a student of Wirth.
Oberon, quite obviously, influenced Java and C# deeply.
A design truly remarkable in its purity — the best comparison reliability/simplicity/efficiency-wise would be with AK-47.
IMHO there is only a two type of programmers: hobby coders and professionals. The second group needs a strict type system and strict compilers, because it is decrease a number of the possible bugs. It is not matter if you write a small code for yourself, but in a bigger applications (>20 000 lines of code) it can be very important.
Does anyone use Rexx!? I think ObjectRexx is used on the i86 world. But me knows just ARexx 🙂
Back in my old companies OS/2 days, a couple colleagues of mine used to swear by Rexx.
I use a ‘scripting language’ as my first language.
I may add that I used to use C as a secondary language for extensions.
Now, luckily, my fav language has a wonderful library named ‘dl’ that is a portable interface to the dynamic linker, so I can completely avoid C.
I love it.
I’ve always felt that the defference between scripting and programming languages is no longer particually important. Both are means of telling the hardware what you want it to do, both require writing syntax with cirtain gramatical rules and the differences between them have become so blurred as to have no real importance, at least amoungst the new sets of both.
Programming languages that target bytecode and virtual machines (Pascal IIRC could, Java and .NET languages do by default), rather than machine code, as do most scripting languages (Python, Perl, Ruby) rather than being interpreted.
Some programming languages can run as interactively (Smalltalk) and I’m sure that you must be able to precompile some scripting languages to machine code.
Some programming languages are weakly typed (Lisp), and you can get strongly typed scripting languages (Perl, with the correct pragma).
Is it really useful to make a distiction which inevitably makes some languages (e.g. C, C++) seem like they are more “worthy” to write in rather than picking the one that has the feature set that will make the task at hand easiest.
scripting is an attitude.
Even the author of the article agrees, I believe.
The point of thinking in scripting is to put the accent on getting the job done. In this sense, sripting may be a synonimous for agile
I’ve been doing some “experimentation” with Python lately and I gotta confess I love it.
Still, I am curious to check Ruby, since it seems to have such a passionate following.
So I’d like to know from the Ruby-lovers if there are any good IDEs for Ruby, for Linux and/or Windows, with auto-completion and this kind of nice stuff that I find on Eric3 for Python.
see this page:
http://tinyurl.com/23doj
BTW I’m using SciTE as my main ide ATM, it has code folding, syntax highlight, autocompletion (dumb), and there is really lot to fine tune in it.
Wow – cool to see pike mentioned! =)
Pike is _really_ fast [0] and comes with some nice syntactic sugar. Above all, pike has a loot of neat fetures for string manipulations and a pretty nice set of extensions by modules.
There seems to be something like CPAN for pike emerging now as well.
@nate:
Of course you are right. People should really look around and try out a lot of languages. Even similar languages like
OCAML and SML. But when you say that If you cannot get over a syntax, that’s not good. and You should study formal languages well and understand that syntax is really not a factor at all. I have to disagree.
Syntax is what makes a language to make sense for a certain type of use (methodology if you want). For instance switch statements on strings in pike or php is by far more readable and understandable than if/elseif or dictionaries (mapping a string to code).
—
[0] http://developers.slashdot.org/comments.pl?sid=106535&cid=9068697
There’s a plugin for Eclipse.
http://sourceforge.net/projects/rubyeclipse
For instance switch statements on strings in pike or php is by far more readable and understandable than if/elseif or dictionaries (mapping a string to code)
in python. I forgot to mention the language =)
“IMHO there is only a two type of programmers: hobby coders and professionals. The second group needs a strict type system and strict compilers, because it is decrease a number of the possible bugs.”
Take a look at this article by Bruce Eckel on “Typing”:
http://www.mindview.net/WebLog/log-0052
“IMHO there is only a two type of programmers: hobby coders and professionals. The second group needs a strict type system and strict compilers, because it is decrease a number of the possible bugs.”
Explain that to the professional programmers at places like Google, Naughty Dog Software, Ericsson, etc, who make use of dynamically-typed languages to great effect.
“Some programming languages are weakly typed (Lisp), and you can get strongly typed scripting languages (Perl, with the correct pragma). ”
Wrong. Lisp is a dynamic, strongly typed language.
You cannot substitute one type for another(strong typing).
Variables can be bound to any value/type however(dynamic typing).
> Fabled Programmers – the are many
species of programmers that claim
to exist but no one have ever met …
programmers who go under the
label of ‘FORTH’, ‘OCAML’, ‘Awk’,
‘Lisp’, ‘Eiffel’, ‘ADA’, ‘Modula-2’
Hey! I’ve spent all day writing Awk scripts! Its a great language for text processing and the like (poor for everything else of course but horses for courses). Every sys admin should know Awk (its very simple if you know Perl or C) it simple, lightweight, ported to every unix ever (plus Windows, OS2 etc) and powerfull in its field.
I’ve also been known to do bits of lisp and forth, ADA and Modula-2 stuff though I leave to the unicorn in the corner…
Every time I hear someone talk about how great Ruby is, they sound so… similar to how everyone else saying the same thing sounds. You never, EVER read someone’s post saying, “Ruby’s great! It’s pretty clean. It’s my fav.” Oh no. It’s always more along the lines of, “I used to use other languages. Then I found Ruby. Until you learn Ruby, you know not the secrets of Universal Nirvana and Enlightenment, which I have attained through learning RUBY.”
OK, I’ll say it: Ruby’s great! It’s pretty clean. It’s my fav. 😉
The reason you hear about people saying they’ve ‘found Ruby’ is that Ruby is indeed a very nice programming language. So nice that programming in other languages just seems like a lot of work by comparison. Yes, I’ll admit, at this point Ruby is my primary language (it’s the tool I reach for first), but I still have to do some C/C++ (and when I do, oh, the pain!)
Give it a try and see if you come to the same conclusion. What’s wrong, are you afraid that you’ll be spoiled and not want to program in other languages?
and don’t forget the Rebol plugin for internet explorer … http://www.rebol.com/news4301.html
http://freeride.rubyforge.org
Is an IDE for windows an X (Fox lib , but the gui part is modular, i’m trying to port to gtk )
“Give it a try and see if you come to the same conclusion. What’s wrong, are you afraid that you’ll be spoiled and not want to program in other languages?”
I’d like to try it some time. I just had a kid, so free time is a little scarce, but I definitely plan to try it over the summer. I like everything I hear about it. It’s just REALLY weird how people talk about it Like clean zealotry, mixed with some cultism.
But the language itself sounds very cool.
cos even RegExps are pure objects …. oh the joy, I weep for the elegance of this language. Perl and Python suck donkeys balls in comparison.
In Ruby
r1 = Regexp.new(‘^[a-z]+:\s+w+’)
In python
p = re.compile(‘ab*’) # ugh
In perl
(%@#$^*^) # double ugh
As Bruce Lee once said:
“Empty your mind. Be like water.
Put water into a cup, it becomes the cup.
Put water into a bottle, it becomes the bottle.
Put water into a teapot, it becomes the teapot.
Water can flow, it can creep, drip or crash!!!
Be water, my friend.”
Ruby lets you be water.
“Ruby lets you be water.”
Gee, what else? Got some “The Ruby Watchtower” booklets for sale?
In Ruby
r1 = Regexp.new(‘^[a-z]+:s+w+’)
You can save a lot of typing by doing:
r1 = /^[a-z]+:s+w+/
r1 is now an instance of Regexp, and you can send messages to it, like so:
r1.source #=> converts the regexp to the string:
“^[a-z]+:s+w+”
I suppose the former way of doing it by using Regexp.new looks like a lot of extra typing to Perl folks, while the latter way of doing it looks susiciously too Perlish for Pythonistas. So depending on your audience you can keep both crowds happy 😉
Gee, what else? Got some “The Ruby Watchtower” booklets for sale?
Look for “The Ruby Way”, or post your name and address and we’ll send a couple of guys on bikes over 😉
it’s not the advocation. It’s that matz just programmed most of the ruby brainz
I mean: have you evern noticed that almost all the ruby presentations or articles out there talk about the *fun* of programming?
yeah, you can be efficient, productive, scalable in many languages, but ruby is the only language/environment I’m aware of that talks about being happy.
yeah, you can be efficient, productive, scalable in many languages, but ruby is the only language/environment I’m aware of that talks about being happy.
You’ll hear exactly the same from the Pythonists (myself included)
Mh, I’d say the key concept in most python’s presentations I’ve read is ‘clear’ or anyway something on the line of OOWTDI.
Not that I’m saying fun is the more valuable feature of a language.
Say,
Being able to have aliases for methods is fun, cause it let me express things in a way that maps better to my own mind and to the use I’m making of a method.
Having lots of methods built-in in base classes is fun cause it relieves me from thinking to include external modules and use that.
No distinction beetween any object in the system is fun cause I don’t have to think “oh, but I can’t do that with this..”.
callcc is fun.
Yet, all these things are commonly viewed as really evil things from all the python developers I’ve talked with.
I really believe OOWTDI is incompatible with fun in programming.
Quoting larry wall, it’s like you teacher telling you that you can play any game you want as long as it is the game she chooses.
Saying that python is fun is fully agreeable, but sure this is not its defining feature.
PS
no need to convince me to use python, I already do and have fun with it
Saying that python is fun is fully agreeable, but sure this is not its defining feature.
Oh yeah, after all it’s Ruby the one name after that british guys Monthy Ruby – oh wait
For me Ruby and Python are so similar that it’s hard to say one is funny and the other is not, and it’s something subjective anyway. I have friends who say C# is very funny (me too, but usually it’s something like “humm that’s funny, it was working before…”)
Pike: very fast but the Windows build seems like an afterthought.
Ruby: I like it. Wish it were faster though.
Tcl: Has it been mentioned? Very nice scripting language as they go. : )
that’s not true. they do many similar things, but they have some key philosophical differences. someone else in this thread may have mentioned “ruby eye for the python guy”. google it and check it out sometime.
I know the differences. I’ve done “pet projects” with both (although I use more Python, maybe because I managed to get some nice Python books first)
It’s a question of perspective. In a close, 4-feet-high look, you may call Ruby and Python very different, but if you think on a panoramic, 5 miles-high view, and align Python, Ruby, C#, Lisp, Java, Pascal, etc etc, Ruby and Python are very similar.
The same way that I look at my brother and say “he’s _completely_ different from me” but people outside my family say “you’re almost clones!”
python doesn’t support blocks. python classes are closed unless you hack with the reflection apis which can get nasty. python REQUIRES tabs. python has tacked-on OOP (passing self as a parameter everywhere). python can compile to bytecode when ruby cannot. every statement returns a value in ruby, which is not true of python.
though really out of all of that, the #1 difference is python does not support blocks. blocks are such a powerful and useful idom that it will radically change the way you code. if you don’t agree with that, then you have not used ruby properly.
..Oh I should have heard it coming…
Are you reading my messages at all, or were just drooling for a chance to put the extremely well known “why Ruby is better than Python” mantra?
Where in my messages I said one is better than the other? I was just saying they were similar when it comes to “fun to program”, having languages like C and Perl in mind..and yet I know that’s very subjective, might be plenty of people out there who think Perl is very funny (and they certainly have a “why Perl is better than Ruby and Python” list for their own)
The Gang of Four in “Design Patterns” recommends designing to the interface, not the implimentation. As a breed, programmers (or at least osnews posters) seem to be hyper-focussed on which tool or language implimentation or program implimentation of OS implimentation is ‘better’. We fan the flames and it goes on and on and on… Great way to fragment our energies.
What software needs is clean open protocols, and clean, well-documented STANDARDIZED interfaces.
#1 Good ideas to solve real problems
#2 Good designs to fit those requirements
#3 Good implementations
In that order! Screw this Tower of Babel crap! I don’t care which language you use. Show me your problem domain. Show me your program architecture, the overall and in-detail design. Show me how I can extend and modify while respecting the overall design interfaces. Then I’m in. Otherwise… talk is cheap. Blah, blah, blah….
Python does *not* REQUIRE tabs. As a matter of fact all of the Pythoneers I know use SPACES for indention.
I am mostly use C++ and Object Pascal in my work. And the strict typing system helped me to kill many-many bugs. This is my experience.
Google and other companies: I don’t claimed that scripting languages are totally unuseable. This things are very good for small programs, little utilites. I am use PHP on my little webpage, and there is a small bash script in my linux setup program. But IMHO Google is use C or assembly in their search engine, not any scripting or managed language.
Google and other companies: I don’t claimed that scripting languages are totally unuseable
Google might be very happy with your tip, they need all the help they can get.
Interesting comments on what is or is not a scripting language, what is an interpreted language, and what makes a scripting language a scripting language. The lines between interpreted and compiled languages have been blurred through the years to an extent. However, one statement I will make is that scripting languages are, by definition, interpreted.
A scripting language is a language in which (by default anyway) the source code is the program. If the program that you run is the text file of the actual code that was written, then you are running the language as a scripting language. Since this program cannot be run without a binary program running underneath to translate programming syntax to something understood by the OS, it is interpreted.
It used to be that “scripting language” and “interpreted language” were synonymous. Now, though, we have Java and the like. Java programs are not (generally) run directly by the hardware or operating system, but require a separate program to run underneath them (a “virtual machine”). However, Java programs are also not the actual text files that the programmer wrote. So is Java an interpreted language or is it a compiled language? Yes. Or was that no? You can see the difficulty of these two classifications still being mutually exclusive. You might say that languages like Java are semi-interpreted (on the other hand perhaps you’d say they are semi-compiled :-)). You could also be tempted to say that since it requires a separate program running underneath, like a scripting language, it is an interpreted language (and the program is sometimes referred to as a “byte code interpreter”).
Of course, the lines will be even further blurred if/when an operating system which actually runs all its programs from human readable scripting language code becomes somewhat popular.