“Twilight is an imperative, object oriented, general purpose programming language. The guiding principles of Twilight are simplicity, practicality, and orthogonality. It is a language which is easy to learn and to be productive in. An experienced programmer in Python, Java, C# or C++ will be able to pick up Twilight in a short period of time.”
Yet another programming language, what’s new?
Programming languages move on as time passes… even the good old C++ is still getting changed frequently.
Your question is like: “Why do they still developing on Firefox?”, “Why do Operating Systems get Updates?”, “Why another Quake when there was already Quake 1?”, “Why developing High-Res Displays when we already have 640*480 pixel displays?” …
they cant even be bothered to wrap code in pre tags on their homepage. ugh. and the whole “list:collector:hash:iterator:thing:colon:mykeyword:colon:colon:colon” thing is fugly.
the only interesting thing is its a syntatic wrapper to output C code… apart from that, no reason to drop my current language set for this.
Well, I must say that the examples just turn me off on this one. I think the author of that site needs to learn more about formatting text using HTML. If you want to promote a new language, the most important thing you can do is make sure your documentation is readable.
Edited 2006-09-01 21:29
WTF is that supposed to mean, an “open source language”??? Use words like they mean something, man! Pfff…
Soon they’ll be releasing “open source televisions” and “open source fast food”. That’s just plain stupid.
Why do we need yet another language?
My sentiments exactly.
Because they’re fun to write. And if someone finds them useful, so much the better.
I’ve read the comments so far and have a few responses:
– It’s fair to say that I’m biased, but I don’t think the language is ugly at all. When it’s in an editor it is simple, concise, easy to follow. At the same time, I did not put sufficient effort into the site (busy coding instead) and admittedly, it doesn’t do it justice. I’ve taken a moment and formatted some of the code – the HelloWorld at the beginning and the sample class, Tokenizer, at the end. Have a look if you are interested in seeing it in a better format. I’ll fix the rest as time permits.
-Why another language? There are a number of excellent languages out there, but I was after something specific, and wanted it all within a single language.
Object Oriented Syntax
Compilation to native code – no interpreter overhead
Both static and dynamic typing
Automatic Memory Management (Garbage Collection)
Exceptions
Multi Threading (not yet implemented) (no artificial barriers to thread performance, e.g. reference counting)
Simplicity, with an emphasis on building functionality in the class library
An Open Source implementation
Sooner rather than later
As far as the open source comment, I supposed it is technically an “Open source language implementation”, but just “Open source Language” seemed sufficient…
Edited 2006-09-01 22:35
Open Source Language? A language does not have source. A compiler does. So it’s a language with an open source compiler?
Are there any language specs? Are those open standards?
As I clarified in my last response, it is an open source implementation, which is to say an open source compiler and standard library.
The implementation defines the specification at this time. No doubt, it could be expressed in EBNF and documented and called an open standard. What I think is great about open source is that it allows for a single implementation, there is no need for multiple competing implementations with subtle differences. This is a strength of languages like Perl, Python, Ruby, and other “Open source languages”…
It is OK. I was too rough. It is just a waste, but that’s up to you. That’s not our business.
Fortran 95/2003 is fine. And millions of lines of Fortran 77 are available for free (e.g. Netlib).
And it was tested during decades by hundreds of thousands (if not millions) of coders and users. And INTEL supports it. And SUN supports it. And IBM supports it. And AMD supports it. There is even a .NET pipe. And all major Labs and Universities have legacy Fortran code. And it is normalized (the J3 comissions). And it is fast as hell.
And TWO (2) free software, open-source compilers are available for MOST platforms (GFORTRAN and G95.) And there are wrappers for TCL-TK, C, OPENGL, X11, etc.
Can you, please, explain what is the advantage of your wonderful new “open source” and highly tested language?
Edited 2006-09-01 23:19
Well, my experience is with a different family of languages, C/C++/Java/Python… It’s my understanding that Fortran is great for scientific and numeric applications, and for all I know other things as well, by all means use it. For my own purposes, and perhaps others like myself, a different syntax is preferable and more productive. My experience with Java and Python suggested to me that:
Object Orientation can be extremely productive…
There is a place for both Static and Dynamic typing, and the availability of both allows for optimization and early error detection in some circumstances (Static), very fast prototyping and development in others (Dynamic).
To top that off, I wanted the potential performance advantages and code obfuscation advantages of native code and the productivity benefits of automatic memory management…
You are an ass… The guy wrote a new language. Who cares if you think fortran is the best thing since the invention of the wheel?
I for one applaud the guy for his effort and implementation and appreciate the fact that he started it off as an open source project.
I respect the ability to make a language, but get some experience in other languages first, innovate. I design pet languages for fun, and I wish you had brought one of those to life instead of a C-syntax copy cat.
Learn a functional language like haskell – it’ll really stretch your perception of programming languages. Check out Lisp, Lua, Ruby. Take a tour of new programming ideas – flare, composite-domain specific languages.
The problem with getting a language popular is that it has to offer enough benefits that people switch to it. Yours has no sell point that I can see. At all.
For a pet language to reach anything more than ahandful of users it needs a collection of benefits, selling points. It has to solve a problem.
Sorry if this is discouraging.
[edit] Perhaps I’m not seeing the good points – the page the article links to is long and ill formatted. I’d have a summary page and then a number of tutorials instead. The summary page should hit all the selling points.
Edited 2006-09-02 00:39
I think your comments on the site and documentation are right on, I’ll try to put things in better order and clarify a bit, consider checking back in a few days…
Good work – and thanks for sharing Twilight. Ignore people like Paiter, who seems to have taken offense at the fact someone has created a language and made it available.
One thing I’d like to suggest is that maybe you should ask someone else to do your website, or set out a presentation style. A different font, italics and/or bold should be used to distinguish inline code and filenames.
For example, your website has text like:
You can have multiple -buildFile
references on the command line and the arguments contained within
them (newline delimited) will be read just as if they were all
appended to the command line space-delimited. A buildFile can refer
to other buildFiles as well. This mechanism is used to make the
overall build system multi-platform while containing platform
specific bits in a limited set of buildfiles which are copied into
place on each platform – specifically, in the
twhome/tw/current/buildFiles directory, the files buildPlatform.txt
and buildPlatformStdLib.txt
Quoted again, the words I’ve put in bold could do with highlighting in some way (e.g. a fixed-width font for the code, italics for the filenames/directories and so on):
You can have multiple -buildFile
references on the command line and the arguments contained within
them (newline delimited) will be read just as if they were all
appended to the command line space-delimited. A buildFile can refer
to other buildFiles as well. This mechanism is used to make the
overall build system multi-platform while containing platform
specific bits in a limited set of buildfiles which are copied into
place on each platform – specifically, in the
twhome/tw/current/buildFiles directory, the files buildPlatform.txt
and buildPlatformStdLib.txt
I appreciate that your time is better used for Twilight itself, but some of the comments here suggest that the website is working against Twilight to varying degrees.
When Java was released I did the question: Why another language?
And Java reigned over us for several years.
When C# was released I did the question: Why another language?
And C# reigns over us.
What about Python? Why we want to have Python if we have Java and C#?
What about Ruby? Why I need Ruby if I already have Python?
Why break the new ideas saying the infamous: “Why do we need another XX?????”
This work is still young, but, maybe it will write the history next years!!!
Go ahead man with your work!!
Java and C# were created by Sun Micro-Systems and Microsoft, respectively. That’s not a minor detail.
Interesting that you didn’t mention who created Python and Ruby… Do I sense a bias, or just a really bad defense of your position?
I really don’t know if it is bias. You tell me.
All this script stuff appears and disappears before someone has time to actually do something with it.
I see people on the web complaining that they take hours to do something like an internal product or months to do cubic stuff like matrix multiplication or inversion. With Python. Is Ruby better?
I also see old codes like mathematica, which is pure C with a bunch of in-house libraries, to perform beautifully in complicated calculations.
I know of some students that didn’t finish the assigned tasks because they were actually reading python books.
Bias? Maybe. All this Python-Ruby is very “fashion”
“””I know of some students that didn’t finish the assigned tasks because they were actually reading python books.”””
Is it just my imagination, or does nothing in the above post make sense?
Didn’t finish their assignments because they were actually reading books about Python?!!
How does one even argue with something like that?
But if Python *is* just a fashion, someone needs to tell Google, and pronto.
Edited 2006-09-02 02:16
…I’ll be a very happy man. I’m a little confused about the triple licencing issue but not overly concerned. I’ve been looking for an easy language to learn and this may be it.
I know Python and C and some Java and C++ and I’m not satisfied. The learning curve on the C++ STL and templating is too complicated. Java has a chain around its neck when it comes to redistributing code to a machine without a JVM and if you’re developing for a platform without one, well…let’s just say that Java is out of the question for some platforums. Python is slow becuase its dynamic typing prevents it from static compiling. And last of all C has terrible typecasting issues especially when dealing with function pointers (not to mention function pointers sometimes need special attention on some C++ compilers).
Now for the real question: CAN it do everything that the others do without casting? I’ll probably download it and go through it but I haven’t seen how it deals with arrays of function references/pointers and polymorphism yet. Stay tuned…
That’s good to hear, there is still work to be done (is is “Alpha”) but it’s coming along. Many of the reasons you mentioned for trying the language are the reasons I created it.
Typecasting is automatic – all “casts” occur on assignment from a variable of one type to another, including dynamically typed variables. If the cast is guaranteed to be correct based on the types there is no runtime check, if the cast may or may not be correct it is checked at runtime, and if it cannot be correct there will be an exception during compilation.
Container types (Collections) such as Arrays, Vectors, LinkedLists, Maps, etc, are all managed through object oriented syntax,
array.put(0, item);
item = array.get(0);
It is not yet implemented, but the plan is for an operator overload to allow the more common C/etc syntax for all types, so that
array[0] = item;
and
item = array[0];
will eventually be equivalent to the above OO syntax.
There are not function pointers per se, for the most part dynamic typing replaces that, so that if you have many items of different types, but all of which implement a particular method, you can call any of them with the same code (regardless of inheritance), e.g. This is also like Java’s interface mechanism except that there is no need to explictely define the interface, classes can implement only certain portions, and calls are checked at runtime.
Where a reflection/introspection mechanism whould be better (where, say, the name of the method is not defined at compile time but you want to derive it from a string value at run time), this is planned but not yet implemented.
Edited 2006-09-02 04:39
I think D is more interesting with things like design by contract and templates.
Like Someone said before people should look at other languages instead of inventing another object oriented C-like language.
There are similarities, but on the whole it is very different from D. It includes dynamic typing, ala Perl, Python, Ruby, which is quite unlike comprehensive static typing and design by contract…
I’ve done some updating and rearranging and I believe the site is now more usable and the documentation more readable. I’ve added some examples as suggested as well. Come have a look…
Much better!
I can see some of the benefits – It would be nice to have something kinda like a merge between C and java/.net. Like C++ done right. I’ve been writing a game engine in .net and its really not the right tool for this kind of stuff.
Still, I think you’ve got to be more risky to have a chance at making a well-recognized language. Maybe that’s not really what you want.
Anyway, some good reading:
http://www.paulgraham.com/langdes.html
http://www.paulgraham.com/hundred.html
Is the output C or machine code and what are the pros and cons of both?
The direct output from the parser-generator is “C” code. On it’s own, it doesn’t do much though 🙂 Twilight automatically compiles the generated C to machine code as part of the parsing process to generate a machine code executable using an external C compiler. At present, that compiler is GCC on Mac and Linux, the Microsoft VC++ compiler on Windows.
I hope you keep it as clean as possible, and the dynamic typing really helps in making it clear. I am a Ruby addict, and the syntax of your language has some appeal to me, though the semantics I know nothing about.
Bookmarked!
A language like yours might have a niche for it.
Keep it clean, always. Make the semantics great. Make Arrays and Hashes as powerful and intuitive as possible. Create some “ordered hash” (useful in PHP and database driven applications). Hashes with any object as keys are wonderful. Strings should be great. Regular expression is a must. A basic HTTP server and a sample driver to MySQL or SQLite might speed up adoption.
Keep it up.
Twilight has a Container:Map implementation which supports using any object as a key, an object can manage it’s own placement and lookup in the map by overriding the hashGet() and equals() methods (the equals method is also what is invoked for object == otherobject comparisons). It is like the Java, C# in that sense. The default behaviour for objects is identity based, so the hash is related to the object address (pointer value in C) and equals is a test of identity equivalents (pointer value ==) including for Container types (Java’s behaviour for hashing Collections always drove me nuts) For Int, Long, Float, String, and Char (and possibly others, this is what I recall offhand 🙂 the default behaviour is modified to fit the type, so Strings are hashed on their string value and the equalivance test is lexical equivalence (same string), so you can use the Map for Int, String, etc, keys as you would expect to. Arrays and Vectors are indexed by Integer.
The ordered hash is a good idea, I have not implemented it, I may someday, or you can 🙂
I would also like to add DB interface (SQLite, MySql, Postgresql with some sort of of a JDBC/DBI abstraction). I was planning CGI/FastCGI for a first step to the Web, but a WebServer down the line would be the best option (and/or a mod_twilight for Apache)…
Here’s a quote from the Mongrel’s author:
“I also really like this tiny fast little Java webserver called Simple. When I started Mongrel I studied Simple and adopted it’s Handler setup. Simple’s got some other odd features–like parsing responses to correct them–but still remains remarkably small and fast. If I were ever going to do a Rails competitor in Java, Simple would be at the center.”
http://www.oreillynet.com/ruby/blog/2006/05/post.html
Take a look at that Java’s Simple web server and make something like it, with some basic “Servlet-like” capability. I’m sure it should be useful.
Hey, nice language!!
Please, keep it clean & fast.
Hibrid dynamic & static typing is a great thing IMHO.
What about optional Design By Contract stuff?
D & Scala has interesting features to keep in mind.
So, this is only a compile to binary lang?
What about a parrot/jvm/nekovm/hlvm version?
Good luck!
HLVM isn’t in a developmental stage where it can be used but since the code generator uses C as a backend we can at least use LLVM with it.
Java isn’t available on all platforms so don’t use that. The C backend’s already faster than Java AFAIK.
I’m not opposed to other back-ends than native code, it was one I knew I wanted to target so I thought I would start there, and I am more aiming at source level portability than a VM because, in practical cases, having to recompile for platforms seems to be “good enough” and to have some benefits… At the same time, targeting a widespread VM would have a lot of value. If anything, the problem is which one… Parrot should be ideal, but I don’t want to bother with it until it is done & in production use (for perl). Sun is supposed to be adding better support for dynamic languages to the JVM (they may have already…), I was going to wait and see how that went, and I’m also interested in the open sourcing process which is planned for Java. The CLR is an option as well… But, I don’t want to have 5 back ends either, I think that would be difficult to support, so I’m really just waiting for one to look just right. I’m not familiar with nekovm or hlvm (have seen llvm, related?), I’ll have a look at those…
A language that looks clean, is compiled to machine code, and has garbage collection (no pointers/manual memory allocation) – this could have potential.
What I think is great about open source is that it allows for a single implementation, there is no need for multiple competing implementations with subtle differences. This is a strength of languages like Perl, Python, Ruby, and other “Open source languages”…
Python has IronPython and Jython, Ruby has JRuby and Ruby.net (I think that’s what they’re calling it). Having a formal spec makes things nice for people who want to make alternative implemenations of a language, not that Python or Ruby seem to have formal grammars and syntaxes published anywhere…
I still remember the good old days .. in which people would have the decency to say “thank you!” in appreciation of your effort ..
even if they didn’t like it .. even if they didn’t use it .. there was the notion that “nothing comes out of nothingness”, and that if there was something (anything) it was the result of somebodies work …
hope those days come back … for the sake of us all ..
Thanks for sitting there and getting something done Craig .. I whish there where more people like you out there.
all these scripting semi-languages just add chaos to a project. i started to hate lua and python since i was made to use them in projects in the company where i work. they are misused – every such script should be in a form where you never need to change it – somethng very simple, otherwise one has to study the entire program to find out what’s going on. whereas programs in strictly typed langs are localizable (nothing to do with i18n) – you look at function body (1 screen long ) and you know what’s going on…you know what comes in and what is produced, what are restictions and expectations…
The language seems solid, but it is more of the same.
What I would like to see is a functional programming language where each value is an object and subtyping is allowed.
Have you checked Scala?
It is an interesting mix between a functionnal and object oriented language.