They made a coffeescript for go
They made a Typescript for go. Coffeescript was dynamic.
Borgo is a statically typed language that compiles to Go
61–70 of 559 posts
Re: Borgo is a statically typed language that compiles to Go
#62Earlier quoted context omitted.
“transpiler”, “compiler”, either terminology is valid: https://en.wikipedia.org/wiki/Source-to-source_compiler
Thanks, I'd always thought targeted transformations -> transpiler, but it makes sense it's really a subset of general compiler functionality, sans binary output.
Tell us more about this compiler subset that does not produce binary output. What do they produce? Ternary? Qubits? Nothing?
Re: Borgo is a statically typed language that compiles to Go
#63Earlier quoted context omitted.
The word "transpiler" propagates the misunderstanding that there is something special about a compiler that emits machine code, that requires some special "compiler" techniques for special "compiler" purposes that are not necessary for "transpiler" purposes because "transpiling" requires a completely different set of techniques. There aren't any such techniques. If one were to create an academic discipline to study "…
It doesn't matter but I fully disagree with this. A transpiler emits code the user is supposed to understand, a compiler does not. At least that's the general way I've seen the term used, and it seems quite consistent.
But if you dig in, it will turn out that every single one of them has a different interpretation, quite often fatally so to whatever the task at hand is.
I mention this because my impression has been that the distinction between "transpiler" and "compiler" is that the latter is into some machine code and the former is not. I think if we could get people to sit down and very clearly define the difference we'd discover it is not as universal a definition as we think.
My personal favorite is when I say a particular term is not well defined on the internet, and I get multiple commenters to jump up and tell me off about how wrong I am and how well-defined the term is and how universal the understanding is, while each of them gives a completely different definition. As I write this it hasn't happened in this thread yet, but stay tuned.
Anyhow, the simple solution is, there isn't a useful distinction between them. There's no sharp line anyhow. Plenty of "transpilers" produce things like Python that looks like
def f000000001_bch(a0023, a0024, bf___102893):
__a1 = f000000248_BCh1(a0024, const_00012)
if __c_112__0:
f0000000923(__a1)
else:
f0000000082(__a1)
and it's really quite silly to look at what can be a very large process and make a distinction only in how the very last phase is run, and on a relatively superficial bit of that last phase too.Re: Borgo is a statically typed language that compiles to Go
#64Is it correct to say Borgo "compiles to Go", or should it say "transpiles to Go" It appears to be a transpiler (consumes a Borgo and does the work to convert and emit a Go program as text): https://github.com/borgo-lang/borgo/blob/main/compiler/src/c...
The word "transpiler" propagates the misunderstanding that there is something special about a compiler that emits machine code, that requires some special "compiler" techniques for special "compiler" purposes that are not necessary for "transpiler" purposes because "transpiling" requires a completely different set of techniques. There aren't any such techniques. If one were to create an academic discipline to study "…
2. Transpilers don’t typically optimize code, leaving those transformations to the compiler of the target language.
3. Compilers will typically have an internal representation (SSA) which they operate on to optimize. Transpilers typically operate on the AST (because they don’t need to do any but the most trivial optimizations).
There are exceptions to the rules but these cover the majority of the reasons on why people make the distinction.
Re: Borgo is a statically typed language that compiles to Go
#65Earlier quoted context omitted.
I don’t think any of that is contradicted by what this seems to be trying to do. In fact, Go doesn’t make you deal with your errors (you’re free to ignore the returns) whereas this would (via exhaustive pattern match).
Rust does not enforce error checking either. You can ignore errors in Rust.
Re: Borgo is a statically typed language that compiles to Go
#66Earlier quoted context omitted.
[flagged]
I just opened the composer.json file for a complex PHP application, it has 20 imports, total. I just opened the package.json for a react frontend, it has 80 imports. I just opened the Gemfile for a complex rails application, it has 150+ imports. But sure, I'm just trolling I guess.
Re: Borgo is a statically typed language that compiles to Go
#67The only language I can think of that has pulled off “compiles to another totaling language” and gained mainstream adoption is typescript, and I’m sure it wouldn’t have done so if it were possible to run in the browser otherwise. Can anyone think of another example?
Re: Borgo is a statically typed language that compiles to Go
#68Earlier quoted context omitted.
The word "transpiler" propagates the misunderstanding that there is something special about a compiler that emits machine code, that requires some special "compiler" techniques for special "compiler" purposes that are not necessary for "transpiler" purposes because "transpiling" requires a completely different set of techniques. There aren't any such techniques. If one were to create an academic discipline to study "…
It doesn't matter but I fully disagree with this. A transpiler emits code the user is supposed to understand, a compiler does not. At least that's the general way I've seen the term used, and it seems quite consistent.
Re: Borgo is a statically typed language that compiles to Go
#69Re: Borgo is a statically typed language that compiles to Go
#70Earlier quoted context omitted.
> A transpiler emits code the user is supposed to understand, a compiler does not. No, a transpiler emits code that another system is meant to understand (often another compiler or interpreter). Whether a human can understand it or not is immaterial to the objective of transpiling.
Does that imply that a compiler emits code that nothing can understand? Or are you saying that 'transpile' is just another word for 'compile'?
Bizarre take. No, compilers in the classical sense target byte code and machine code which is meant to be interpreted by a byte code interpreter or a hardware machine.
> Or are you saying that 'transpile' is no more than another word for 'compile'?
Yes. Compilers translate from one language to another. Transpilers translate from one language to another. Both have the objective of preserving the behavior of the program across translation. Neither has the objective of making something intended for humans as a general rule.
That transpiled code (if we draw a distinction) targets languages meant for humans to read/write means that many transpiled programs can be read by people, but it's not the objective.