I think it implies a translation from one high level language to another (not that 'high level' is well defined either), with only desugaring and maybe type-checking - no real lowering or optimisations. That's a useful subset of compilers, so can have its own word I believe.
Or an Eiffel implementation, as another example.
It's just short-hand for source-to-source compiler and IMHO has been used enough to warrant its inclusion in a programmer's dictionary.
Can you dig me a 70's paper with the transpiler word on it?
Indeed and most compilers do exactly that. Cant help getting a little annoyed whenever I hear this 'transpiler' word. I guess the ship has sailed, oh well !
I think it makes sense to use a different term for this "compiler"-esque behavior. For example, I might edit the output of CoffeeScript generated Javascript whereas I wouldn't know how to modify the output of gcc.
Also C compilers used to generate Assembly text files, which were then piped into the Assembler.
So no, transpiler doesn't make any sense.
You can certainly think this distinction doesn't merit using a different word, but you shouldn't think that people who use the word "transpile" use it as a synonym for "compiler".
But it fits the project since I don't have any background or experience in compiler design.
But a compiler has come to mean a program that translates source-code into machine code.
By this new understanding, a transpiler is a combination of a compiler and a decompiler with different input and output languages.
So po-tay-toes, po-taa-toes. No one cares, we know what is meant by transpiler.
Point taken that it is still a compiler.
var = []
var = 2For the array I do a little hackery. You can define the array without an initial value in the container and I can guess the value type.
arr = []
arr.append(1)
it will spit out std::vector<decltype(1)> arr{};
arr.push_back(1); auto var = // this type can't be inferred because it's not used
{
auto var = 2;
}
I'm too exhausted to think why this may not be applicable. x = 2
if stringy: x = '2'
print x+x # 4 or 22???
C++: int x = 2;
if(stringy) string x = "2";
print x+x; // 4 (string x is out of scope)Wouldn't be something like "T1 where T1 is Numeric"?
Thanks!
If you pass a type that cannot be used with the <= operator it will error in compile time.
Being able to do this is part of why C++ templates are much more powerful than Java/C# generics and why they enable a different (and alternative) form of polymorphism to inheritance and explicit interfaces.
I assume this just duplicates the method for each type at compile time instead of at runtime try to figure it out?
Damnit, now I wanna rewrite back to C++.
Viewed through that lens, this is a really novel and cool demonstration.
So view through that lens I'm not really seeing the novelty right now?
Don't have enough reasons to stick with shitty old Python 2, well then here's another anchor for your boat!
Edit: The first pull request was for Python 3 support, hooray.