Hacker News new | ask | show | jobs
by wybiral 3353 days ago
What features make it "higher level"? It looks like syntactic sugar on C code without any real improvements (aside from GC).
4 comments

I've used Cello for a few side projects, and it doesn't even really feel like C in the end.

Just a few off the top of my head:

* No need to specify type. Use var.

* Simpler for loops

* Inbuilt types for Hash Tables

* File types, making file reading much easier

* Function types, making it easier to pass functions around

* Doctype access

* Threads & Mutexes

* Format strings

* GC (with ability to turn C-types into Cello-types for GCing.)

It is fundamentally syntax-sugar, but enough that what you end up with doesn't necessarily look like C at the end.

    with(f in new(File, $S("test.txt"), $S("r"))) {
      var k = new(String); resize(k, 100);
      var v = new(Int, $I(0));
      foreach (i in range($I(2))) {
        scan_from(f, 0, "%$ is %$ ", k, v);
        show(k); show(v);
      }
    }
(From: http://libcello.org/learn/file)
> * No need to specify type. Use var.

I see types everywhere; they appear to just have been moved from the left-hand side to the right-hand side? eg:

  var i0 = $(Int, 5);
  var items = new(Array, Int, i0, i1, i2);
Mmm, kinda.

    var i0 = $(Int, 5);
    i0 = $(String, "Hello");
Perfectly valid.
You are right, it looks different: awful. It is even more cloudy than the syntax of bash.
I believe those things are exactly what make it higher level. Unless I'm misunderstanding your question, all that makes a language higher level is the amount of abstraction between the human and the computer.
What makes [your favorite language] "higher level"? It looks like syntactic sugar on top of assembly language.

It's higher level because it provides abstractions that improve the language's expressiveness.

> without any real improvements (aside from GC).

You've really gone down the rabbit hole if you think GC is an improvment

Automatic memory management is an improvement. I prefer region-based memory management to GC but a GC is a godsend in, for example, dynamic languages where you don't want any restrictions, or functional programming where you're pretending to program for a machine with infinite memory.
It is certainly not an improvement for a systems language