A new programming language has been sighted, it goes by the affectionate name “nessie” and it claims to be the loch ness monster of programming languages.
the main trait of nessie it borrows from python: indenting.
the main difference to python: it is typed, something that python developers
are now considering for python 3.
ever since i started using python myself i have to agree, indenting is one of
the best ideas in the evolution of the syntax of programming languages that has
been made in a long time. indenting is a must for readable code anyways and
anyone who thinks that indenting is a problem is either writing sloppy code or
has simply never tried python.
i like concise and explicit syntax without redundancy. and that’s something
that nessie promises to offer. the syntax should serve both the user and the
compiler. the compiler should not try to guess what the user wants to do, but
it should also not force the user to be overly verbose.
nessie offers a number of interesting things that python does not (yet) have.
one of them is static typing. this topic has always raised a controversy in the
python community. nessie may be the way out for those that do like static
typing without forcing their opinion onto the rest of the python community.
there is also the very compact use of operators on all kinds of data
operations, like splitting a string: instead of s.split(" ") nessie uses s/" "
you divide the string at the spaces. the reverse of course also works:
arr*" " joins an array to a string.
there are many more operators and they can all be applied to almost any type.
there is a well evolved runtime library that offers an astonishing set of
features from image manipulation, a calendar module that supports any kind of
date manipulation you have ever dreamed of, support for most internet
protocols, xml, database access, you name it, it’s there.
like python nessie is object oriented, but it offers class member protection
that allows to add security features to your application that are simply not
possible in python.
one interesting feature here is nessies class syntax. you don’t need to mark a
class with a keyword, but just but the contents of your class into a file. the
filename becomes the class name. instantiate or inherit the file elsewhere and
you are done.
a bit more about types:
nessie is statically typed but it does not make you go out of your way to make
things work like java does. there is a mixed type which will hold anything, and
brings you back to the same dynamic typing flexibility that python offers.
you may also combine any types as you like: string|int|float.
incidentially a similar syntax for types is being discussed for python.
container types may be specified generic: array (which is really
array(mixed)) or more detailed:
mapping(string:array(array(int(0..359))). the latter is a dictionary
with keys of type string and 2-dimensional arrays with integers ranged from 0
to 359 as values. as you can see the typing is very flexible, you may be as
specific as you want and as generic as you need.
let’s have a look at nessie itself:
nessie: void main() write("hello world!n") pike: void main() { write("hello world!n"); } python: print "hello world!"
nessie is more explicit than python but less redundant than pike.
apart from the indenting syntax, nessie is essentially a dialect of pike.
it uses the pike runtime which brings with it a great amount of features that
have been evolving since the late 80ties. the features described above are
really all just inherited from pike. nessie actually just adds the indenting.
a minor difference, that may have a large impact on those that don’t like
braces.
python and pike are both great languages, and so is nessie.
it’s time for some change.
There are so many different flavors of pythonesque… *head spins* …oh well, I suppose you’ve gotta use the right tool for the right job.
“Last week, Japanese scientists explaced… placed explosive detonators at the bottom of Lake Loch Ness to blow Nessie out of the water. Sir Godfrey of the Nessie Alliance summoned the help of Scotland’s local wizards to cast a protective spell over the lake and its local residents and all those who seek for the peaceful existence of our underwater ally.”
So this language is a possible hoax too? Sorry, can’t help it
Does anyone know why the Python hackers want to implement static typing in the language?
Does anyone else find this sort of operator use unnatural and hard to read when you haven’t been using the language? I often read through code in languages I’ve never used, and usually you can understand them but things like: s/” ” would confuse the hell out of me! Maybe it’s just me, I guess programmers are related to mathematicians who are lazy about writing.
I liked the one in the SMH better:
http://smh.com.au/articles/2005/03/31/1111862521987.html
A new group set up to advance the cause of free and open source software has decided to recruit socialite Paris Hilton into its ranks as a means to gain more exposure.
The Open Source Development League said it was recruiting Ms Hilton because it knew of nobody else who had managed to gain such a degree of exposure despite having no apparent learning in this direction.
“Does anyone know why the Python hackers want to implement static typing in the language?”
No matter what you do and no matter how hard you try, someone will re-do 95% of your work to get one feature you didn’t provide.
The rampant proliferation of programming languages is getting pretty old, now. One project I tried to compile recently had dependencies on perl, c, c++, python, and java. Yuk.
How many mutually exclusive major development frameworks are there? Perl, Python, Ruby, Java, C#, Delphi, GCC, Lisp? Yuk, again. Add all the other minor frameworks like Tcl/Tk, and it’s triple Yuk.
Earlier, I was looking at some Python code, and it was all just different syntax for the same mundane stuff that C++ and Java can do. There just isn’t anything so brand-spankingly amazing that it justifies so much re-work, IMO. Academic research, sure, but why bog the business world down so much, too? Now we have each generation of graduates learning a different framework, so that only the most well-adjusted among them can actually get work done!
To correct the article, Python is NOT a programming language, that is a commonly debunked myth.
And since this has a runtime library .. ah .. actually, any real compiler/language creator know not to use a runtime library, ever.
Therefore, this language is moot for real world use.
“Python is NOT a programming language”
Yes, it is. Conceptually, it parallels Java and C# in many ways (OOP, compiled, high-level, etc.).
Earlier, I was looking at some Python code, and it was all just different syntax for the same mundane stuff that C++ and Java can do.
You can use C++ and Java as scripting languages?
http://www.gnome.org/~newren/tutorials/developing-with-gnome/html/a…
I’ve been going through these tutorials recently, and they popped into mind when you said this. Compare the C++ examples with the Python ones. Python is much easier to work with than C++. If everyone thought the same way you do, we’d probably be stuck with COBOL.
Now we have each generation of graduates learning a different framework, so that only the most well-adjusted among them can actually get work done!
In school, you don’t (only) learn programming languages, you learn how to program. If you’ve learned enough, adjusting to a new language isn’t that hard.
At least, I hope so. Otherwise, that’s kinda sad.
Forced indentation is not an evolution, it’s a step backward. Compare it with a bird (or a human) that can walk and fly compared to one that can only fly and not walk. Lambas (anon subs) are so painful in Python, thanks to its forced indentation. I’d very much stay with Perl or Ruby, thank you very much. And all my Perl and Ruby code are as nicely indented as Python, so what’s the benefit of forced indentation?
Yes, o/c you can. A language is just that, a language, tis the compiler & runtime that make either it a “scripting language”. You could write an interpreter for Java (BeanShell) or C++ (Ch) or you could write compiler for AWK (TAWK).
> you learn how to program. If you’ve learned
> enough, adjusting to a new language isn’t
> that hard.
Here here.
> s like: s/” ” would confuse the hell out of me
Again, here here.
I wish languages that came with operator overload also came with trained monkeys, thats would attack anyone that mis-used the feature.
You can use C++ and Java as scripting languages?
I could have just as easily have said Ruby or Perl, too, but the overlap among them all is staggering. So a couple compile at run-time. Put a dozen random programmers into a room and ask “So, should we use Ruby, Perl, Python, or Java for our website back-end?” If any consensus at all is reached, that would be a miracle.
When it becomes an arbitrary choice between frameworks, it usually just comes down to what the strongest personalities in the room dictate, and the dissenters eventually quit or transfer. Rarely is there a true merit-based reasoning; instead, it’s what’s in fashion this year.
Hey, don’t forget about the cows! They have their own language, too.
http://www.bigzaphod.org/cow/
🙂
I probably should have said “would you want to use C++ or Java as scripting languages?”
Ahh, OK.
@BigZaphod
I’m not at all impressed with Moo. Tis just like l33t and 100 other esoteric programming languages that just rename the same basic ops.
Whirl is cool, as it does something different.
Indeed that is true (although I honestly didn’t know it at the time I made it)–but COW is funnier than Whirl, IMO. Poor 3code never gets any attention even though I’d say it is closest to a “real” language…
I am sorry but can somebody explain what the author means by a typed language?
I assume they mean typed vs. spoken …
No, I jest, I jest. They are referring to data types, like ‘int’ and ‘string’. I program in PHP, mostly, and it’s typeless – I assume Python is the same way. I also assume this entire post is an April Fool’s joke. That aside, a typed language would be strict about the type of data assigned to variables (hence the typed language being typed). Kinda like Java and C++. Well, exactly like them. Except in this case, much harder to read and parse, because of the indenting.
I was going to provide an actual example.
Say you have two variables:
int MyInt = 0;
string MyString = “Woof Woof! I’m a cow.”;
Doing things like this:
MyInt = MyString;
Can result in an error or in data loss (when the data is converted/casted from one type to another). That’s type-specific. As I understand it, at least.
its just like Pyrex and Boo?
What a waste of time.
“the main difference to python: it is typed, something that python developers are now considering for python 3.”
What the hackers are proposing is an optional *static* typing, meaning specifying the type of variables in the code. Right now Python is dynamically typed, meaning the interpreter figures out the type of something at runtime. Even now, every object has a type and that type is very important.
And to answer another poster, forced indentation means you never have to use block delimeters like curly braces or “End If”, etc. I find it is a very nice feature
I find it funny that people complain about the forced indentation. I’m sure they’re the type of people that have never seen RPG on an AS/400. Now that’s definately yucky. Although, I have to admit it’s very functional for business applications, especially on POS machines, customer service, and other applications.
But no one seems to be using it. Unfortunately that matters.
I think this is an april fool!
No chance this is real.
So no link to Nessie..
ach, april 1st, they almost had me
There’s a famous D. Knuth quote from his “Structured Programming w/ Goto” paper that is oft quoted in the python news groups that mentions using a programs visual structure to convey actual program structure.
Anyway, whether forced indentation is a step forward or not is an interesting question, but the analogy that was given (“would you rather be able to walk or fly, or to just walk not fly” or something along these lines) was just not “getting” it. Indenting has proven to be a useful visual aid for setting apart blocks in code, much more useful for humans than punctuation (which is nicer for machines). Most people probably indent their code in the first place, and for those who do not (or would have a sloppy style otherwise) the indenting facility forces it upon them.
Is this a step backwards? I doubt it; forcing what is commonly seen as a good or safe practice is after all what language evolution has done over the years; most Assemblys, Fortran, BCPL, and some older (pre or non descendent from algol) languages lack types alltogether… you don’t find languages like this today, nor do you find many programmers that argue rigid typing systems are bad, or that structs (or classes) restric the programmer into one paradigm. For people to complain so much about a syntactic practice that almost *everyone* follows anyway, its one of the bigger mysteries in programming language acceptance.
As for the person who said PHP lacks typing; it does not, its dynamically typed, as is python, perl, ruby, etc. The optional static typing system that was ‘proposed’ for python is called Monkey Typing, and the proposal is readily available through a google search. Dynamic typing itself is considered to be undesirable in some circles, but what it does for fast prototyping and rapid development cannot be ignored even if no real studies exist. Every step forward in programming language design has been declared a giant step backwards at one point or another, but eventually people come around. If you asked someone in 1967 what the most popular language was, odds are you’d hear “Algol” or “Simula” and NOT Fortran, although it was by far the most widely used language of the period. However, if you look at the “languages of today”, they take from Simula (OOP) and Algol (block structure, types, … everything).
Finally, to the person who was annoyed that all of these programming languages seem to offer the same things, kindly remove foot from mouth and read a thing or two about the programming languages you cite. A programming language is not about being turing complete (since extremely trivial sets of commands are functional equivalents of the most powerful programming languages), its about providing useful abstractions for expression. When you write a program, what is it you are writing? Are you writing instructions for a machine to parse, or are you writing instructions that map to a particular algorithm, or are you writing an algorithm that maps to some particular real world problem? The answer is of course all 3, and we are *still* looking for useful expressions and abstractions that allow us to do all 3 in easily understood ways.
PERL was created to do text processiong, Python’s main notion is that of Namespaces, RUBY is completely object oriented, C++ was made to provide useful abstraction mechanisms for C programmers. All of these languages have a purpose, even if you don’t know what they are. If you don’t think they provide different abstractions, or if the abstraction is not useful for you, you either don’t know anything about these languages, don’t know anything about programming, or are a genius who can visualize entire systems at once.
As for the person who said PHP lacks typing; it does not, its dynamically typed, as is python, perl, ruby, etc
No, in php you can do:
$a=10;
$b=’20’;
echo $a+$b+$c;
and have it working.
You can do this in perl, but not in python and ruby, wich are strongly typed.
OTOH, It’s a today news that Zend Corp. has embraced python development, so now it offers support for a strongly typed dynamic language, and sports three new products “PyZ Engine”, “WebWare Accelerator”, and “Python Software Studio”, als noted as PySS.
I think the Python from Zend corp projects and the article’s Nessie project are April fools jokes from the PHP company and Pike users respectively.
There’s something not quite right when you see this:
“indenting opens only the body of a statement. to create a new scope the block must also start with an empty line”
I scrambled away from positional programming long ago. Albeit, this is not the same thing, the language doesn’t give me the warm and fuzzy feeling.
>No, in php you can do:
>$a=10;
>$b=’20’;
>echo $a+$b+$c;
That doesn’t mean that there are no types associated with these variables. The PHP interpreter knows that $a is an int, and that $b is a string, and that’s how it knows how to make a string out of them.
Just because its hidden (in most uses) from the programmer doesn’t mean it isn’t typed.
And Python, Ruby and Perl choosing to deem that usage invalid simply means that the designers of those languages decided that that was a meaningless operation and don’t want to support it (perhaps there is other reasoning, but it has nothing to do with typing vs. no typing).
yes, i hate the newline too.
that is an experimental parser,
try the colon parser, which solves this problem in a different way.
i do not want that newline either, it is a sideeffect of the newline parser (which is named like that because it is defined trough the newline handling)
this is meant as a discussion base to find a real solution.
the colon parser presents one, and the parser-parser (named because it uses the Pike.Parser module) tries to implement yet another way to solve the problem by actually analysing the contents of the line, trying to decide what the line contains.
you are not supposed to like that newline, my hope is that you may feel inspired to come up with a better solution.
greetings, martin.
I was it slashdotted April 1, 1993
wasnt one of the big attractions to c the fact that whitespace didnt matter, like earlier languages? how is a return to that considered a syntax evolution? its like saying that a thin client archecture is a good idea because its getting popular again.
Anybody who thinks Python is just “synactic suger” for stuff C++ and Java can do, I challenge you to do this:
Write a method to parse a (pre-validated) XML file. The method must be generic (can be applied to any XML file, regardless of DTD), and return an object tree with a proper class hierarchy. The latter requirement means that if I have something like (brackets replaced by parens):
(person)
(name)Bob Jones(/name)
(age)24(/age)
(birthplace)Sri Lanka(/birthplace)
(/person)
I should get an object of type ‘person’, with fields ‘name’, ‘age’, and ‘birthplace’.
This is just plain impossible in C++ or Java, because you can’t create classes at runtime. You have to encode a class hierarchy into every parser, even though parsers basically all do the same thing, because you can’t write a generic one that will handle any hierarchy. Further, you’ve now encoded knowledge of the class hierarchy into two places (the parser and whatever code uses the object tree), which means you’ve got to do a bunch of busy-work when the hierarchy is modified.
To top off the previous example: because C++ and Java don’t have procedural macros, you can’t even automate the generation of such a parser from a simple DTD-like specification!
Of course I said that php is not like ruby and python, wich are strongly typed, not that “there is no type information attached to a memory area wich is commonly named a variable”, so what are you trying to correct?
I assume by your definition everything (except maybe BCPL?) is strongly typed. I guess having sized registers make most assembly languages typed.
Please consider that a large part of the world disagrees:
http://c2.com/cgi/wiki?TypingQuadrant
>Of course I said that php is not like ruby and python, wich are strongly typed, not that “there is no type information attached to a memory area wich is commonly named a variable”, so what are you trying to correct?
>I assume by your definition everything (except maybe BCPL?) is strongly typed. I guess having sized registers make most assembly languages typed.
Please consider that a large part of the world disagrees:
http://c2.com/cgi/wiki?TypingQuadrant
Weak vs. Strong typing is something entirely different, but PHP *does* have some notion of type. The comment I read said PHP wasn’t typed, which just isn’t true. My notion of weak and strong typing is that with weak typing you can access something as if it were of a type that it is not, whereas in strong this is impossible. There are lots of things that languages with strong typing do to mimic the nice shortcuts available with weak typing, but in the end you can’t change the core.
While its on the topic though, I don’t find the arguments for weak typing to be very convincing anymore considering that duck typing and runtime type inference lets you perform many of the same shortcuts without the cost of using a weak type system.
As for the person who asked about C’s popularity, it did not become popular because of its disregard of whitespace, it became popular because it covered a decent enough set of what you can do in assembly with a slightly higher set of abstractions.
Thompson’s first try with unix was with a language he created called B (which was a direct descendent of BCPL); but he quickly scrapped the project because it was too tough to use B. Original C was a slightly modified version of B that added limited compile time types; but the reason Thompson et. al were able to go through and finish Unix with C and not with B had nothing to do with whitespace or types at all; C had structs (the idea of records that could work in a structured environment was already 7 years old) which B lacked. Structs mirror common assembly language practices pretty well and provide a pretty efficient way of laying your data out without high level semantics getting in your way, which turned out to be very important for systems programming.
I think C spread wildly because Unix did, and Unix spread unhindered because C (despite not being standardized for a few decades) grew into a decent systems programming language and a useful step of abstraction away from assembly.
I have a vague feeling the reason why things like “11”+12 dont work is that its not immediately obvious what should happen. Should the answer be 23 or “1112”?
As for folks complaining about one having to indent code properly, seems to me the whole world should be doing it anyway. So why not save on some typing and ditch the {};’s?
As for python not being a programming language…grow up.
you are right on target.
i have been using pike and its predecessors for more than 10 years, i love the language. i indent religiously 😉
but ever since i started to use python, those {}s have been nagging me. so i tried to see how pike feels without them.
i considered python, but pike has a some important features that python lacks. the most important being the ability to protect class members from outside access, which is crucial for a multiuser environment where people can run their own code. see the note on http://www.python.org/doc/2.3.5/lib/restricted.html
already the predecessor to pike was designed to allow such protection.
greetings, martin.
Weak vs Strong typing /is different/ from what you want to talk about. I just said php is weak and
(Ruby|Python|Smalltalk|Self|Io|Lisp|Goo|whatever) are not, please reread my message.
Mr. “away”.. notice that the real problem is not ‘1’+2.
If you did not notice this, I wrote ‘1’+2+not_ever_defined_variable.
Guess what is the type of the undefined variable?
it is a string for “.” , an int for “+”. But wait: it is not a string if you use type hints. And wait: in an arrayhashish context like this:
$a=array($e=>30, $d=>’20’, $f=>10.2); //$e,$d,$f undef
foreach ($a as $k=>$v) {
print $k+$v;
}
guess what will happen? now try.
maybe you have to try Ruby, almost no {} and public/private splitting, in a dynamic suite a-la python
> As for folks complaining about one having to indent code
> properly, seems to me the whole world should be doing it
> anyway. So why not save on some typing and ditch the {};’s?
The newest kind of languages edit the syntax tree directly (they are not text-based). In these languages, braces and indentation are not part of the code but how the code is displayed. Changing indentation in such languages is like changing text size or font – it doesn’t affect the code.
I think the ocaml style static typing is some of the best ever. Basicly you don’t need to declare anything, for most cases ocaml figures out for you what the types are.
For example
let f a b c = if a<5 then a else b*c;;
(might have mistakes I am writing this from memory)
Then it automatically knows that f is a function that accepts 3 ints and returns an int.
Or:
let f a b c = if a<5 then List.append c a else List.append c b;;
Then it will know that a and b are ints and c is a list of ints. It also supports something simmilar to ‘templates’. for example, if you have a function that just modifies a list irregardless of its type then it will know that the function accepts a list of ‘a type and returns a list of ‘a type.
Really Cool.
not to avoid trying to combine incompatible types, but to know what the INTENT of the programmer is when assigning types. explicit typing is part of the documentation of the code. for an expression like a+b, surely it is possible to avoid strange results without explicit types, but only if the types are documented, i as a reader of the code can figure out what the result is supposed to be. and as soon as you document that, you may as well share the same information with the compiler, and let it help you find mistakes.
greetings, martin.
Hmm it seems simply like another language with a syntax derived from C.
why would { } be redundant? it only helps to define clearly the boundaries of the function main in the code provided. Python can be really ugly but it does the job. But I must agree that ugly code is tougher to debug and that for relatively large projects, it should be somewhat forced to have readable code.
>This is just plain impossible in C++ or Java, because you can’t create classes at runtime.
Really makes one wonder then why Objective-C never took off except with NeXTStep and it’s descendants (now GNUStep, Cocoa), and now, interestingly, PyObjC. One would think that a C-like syntax (in fact, entirely like C except for messaging syntax) plus the ability to create classes at runtime would be a real hit.
as for pike, the syntax is not only derived from c, it IS c.
pike started out as lpc, a runtime compiled object oriented c.
(much like c++ is c, more than objective c is c (syntax wise))
nessie of course strays away from that, its syntax could be called c-derived, but then so could python probably. the question here is really what makes up the core of c syntax?
greetings, martin.
objective-c is nice, but i feel it’s syntax is overloaded. pike can do the same things as objective-c’s additional syntax allows without introducing much additional syntax elemets.
objective-c merges two completely seperate syntax concepts into one language.
thus syntax wise pike is a lot leaner than objective-c.
i am not saying that the objective-c way is wrong. pike does not have any c left in itself, all function calls are actually messages to objects. while with objective c, the c-parts actually are c. so for pike the difference becomes non existant. i don’t know if it is possible to use objective-c without using any c (ie, no function calls)
greetings, martin.