language-design

Automated Java to Scala source code conversion?

(Yes I know I can call Java code from Scala; but that is pointless; I want to DELETE the Java code, not keep it around and have to look at it and maintain it forever!) Are there any utilities out there to convert Java source to Scala source? I believe theoretically it should be possible to accomplish with minimal lossage. I have found...

Languages and VMs: Features that are hard to optimize and why

I'm doing a survey of features in preparation for a research project. Name a mainstream language or language feature that is hard to optimize, and why the feature is or isn't worth the price paid, or instead, just debunk my theories below with anecdotal evidence. Before anyone flags this as subjective, I am asking for specific examples ...

Why there is no multiple inheritance in Java, but implementing multiple interfaces is allowed

Java doesn't allow multiple inheritance but it allows implementing multiple interfaces. Why? ...

List of Lua derived VMs and Languages

Is there a compendium of virtual machines and languages derived or inspired by Lua? By derived, I mean usage beyond embedding and extending with modules. I'm wanting to research the Lua technology tree, and am looking for our combined knowledge of what already exists. Current List: Bright - A C-like Lua Derivative http://bluedino.ne...

Statement hierarchy in programming languages

I quickly wrote an interpreter for some sort of experimental programing language i came up with, in PHP (yes, in PHP). The language itself doesn't have anything really special, I just wanted to give it a try. I got the basic things working (Hello World, input to output, string manipulation, arithmetics) but I'm getting stuck with the ma...

From a language design perspective, if Javascript objects are simply associative arrays, then why have objects?

I was reading about objects in O'Reilly Javascript Pocket Reference and the book made the following statement. An object is a compound data type that contains any number of properties. Javascript objects are associative arrays: they associate arbitrary data values with arbitrary names. From a language design perspective, if obje...

C++: Conceptual problem in designing an intepreter

I'm programming an interpreter for an experimental programming language (educational, fun,...) So far, everything went well (Tokenizer & Parser), but I'm getting a huge problem with some of the data structures in the part that actually runs the tokenized and parsed code. My programming language basically has only two types, int and stri...

Subroutine & GoTo design

I have a strange question concerning subroutines: As I'm creating a minimal language and I don't want to add high-level loops like while or for I was planning on just adding gotos to keep it Turing-Complete. Now I thought, eww - gotos - I wouldn't want to program in that language if I had to use gotos so often. So I thought about adding...

Is it possible to create a quine in every turing-complete language?

I just wanted to know if it is 100% possible, if my language is turing-complete, to write a program in it that prints itself out (of course not using a file reading function) So if the language just has the really necessary things in order to make it turing complete (I would prove that by translating Brainf*ck code to it), like output, ...

Why Python language does not have a writeln() method?

If we need to write a new line to a file we have to code: file_output.write('Fooo line \n') Are there any reasons why Python not has a writeln() method? ...

ASP-style tags for Perl web development?

I feel like I'm traveling 10 years back in time by asking this, but... Are there any modules, patches, or any "new" version of Perl (released in the last 10 years) to enable writing web-oriented Perl scripts using ASP-style tags? e.g. from ASP/JSP some html <% some code %> more HTML e.g. from PHP some html <? some code ?> more...

Are frameworks using byte-code generation creating leaky abstractions?

My point is, if you don't understand the abstraction of a framework, you can still decompile it and understand it, because you know the language e.g. Java. However, when byte-code generation happens, you have to understand even a lower level - JVM level byte-codes. I am really affraid of using any of such frameworks, which are many. Most...

Why did Matz choose to make Strings mutable by default in Ruby?

It's the reverse of this question: http://stackoverflow.com/questions/93091/why-cant-strings-be-mutable-in-java-and-net Was this choice made in Ruby only because operations (appends and such) are efficient on mutable strings, or was there some other reason? (If it's only efficiency, that would seem peculiar, since the design of Ruby se...

Language Design: Combining Gotos and Functions

I'm designing and currently rethinking a low-level interpreted programming language with similarities to assembler. I very soon came across the functions/loops/gotos decision problem and thought that while loops like while and for would be too high-level and unfitting, gotos would be too low level, unmaintainable and generally evil agai...

Interpreters: Handling includes/imports

I've built an interpreter in C++ and everything works fine so far, but now I'm getting stuck with the design of the import/include/however you want to call it function. I thought about the following: Handling includes in the tokenizing process: When there is an include found in the code, the tokenizing function is recursively called w...

What does the C++ output of the HipHop PHP compiler look like?

Is it clean enough that you can discard the PHP and hand-optimize the C++ code? ...

Syntax choice for type parameter variance in C# and VB

In both C# and VB, type parameter modifiers are used to express the variance of type parameters. For example, the C# version looks like: interface Foo<in X, out Y> { } and the VB version looks like: Interface Foo(Of In X, Out Y) End Interface Since variance specifications basically restrict where and how a type parameter can be us...

constructors in C++

hi all, why is that name of constructor is same as class name? thank you in advance ...

New or not so well-known paradigms, syntax features and behaviours of programming languages?

I've designed some educational programming languages and interpreters for them, but my problem always was that they ended up "normal" and "boring", mostly similar to some kind of existing language (ASM and BASIC). I find it really hard to come up with new ideas for syntax features, "neat things" and new or very modified programming para...

Why is there "data" and "newtype" in Haskell?

To me it seems that a newtype definition is just a data definition that obeys some restrictions (only one constructor and such), and that due to these restrictions the runtime system can handle newtypes more efficiently. Ok, and the handling of pattern matching for undefined values is slightly different. But suppose Haskell would only kn...