Live data from Hacker News

The Titania Programming Language

github.com

11–20 of 68 posts

Re: The Titania Programming Language

#11

A modest proposal… Instead of having println() or it’s equivalent in your programming language, add a new special character that denotes a newline after a string: print(“Hello world”.)

Is your idea that that would always work? Like:

  s := "Hello world".; -- equivalent to "Hello world\n"
Or only in `print`? If only in `print`, then you've suddenly made a context-sensitive grammar. And if the former, just use "Hello world\n" instead, since the tokenizer already supports that.

Re: The Titania Programming Language

#13
post #10

Having done a fair degree of programming in Wirthwhile languages, I think the only main design decision that I think was a mistake was the variables at the top. I'm not sure of the value of seeing all of the variables used listed in one place, it has certainly led to me encountering a identifier scrolling up to determine the type then scrolling back down. When the variable is only used on a few consecutive lines it's…

A nice side-effect of "variables at the top": you keep your functions short.

Re: The Titania Programming Language

#14

A modest proposal… Instead of having println() or it’s equivalent in your programming language, add a new special character that denotes a newline after a string: print(“Hello world”.)

Is your idea that that would always work? Like: s := "Hello world".; -- equivalent to "Hello world\n" Or only in `print`? If only in `print`, then you've suddenly made a context-sensitive grammar. And if the former, just use "Hello world\n" instead, since the tokenizer already supports that.

I think the point is to add the correct end of line depending on OS.

Re: The Titania Programming Language

#15
post #10

Having done a fair degree of programming in Wirthwhile languages, I think the only main design decision that I think was a mistake was the variables at the top. I'm not sure of the value of seeing all of the variables used listed in one place, it has certainly led to me encountering a identifier scrolling up to determine the type then scrolling back down. When the variable is only used on a few consecutive lines it's…

A nice side-effect of "variables at the top": you keep your functions short.

"Functions should always be short" is also one of those guidelines that people treat like a hard rule. There are occasions when a 100 line function is easier to read than 5 20 line functions, or god forbid 20 5 line functions.

Stop being overly dogmatic, it ALSO leads to worse code.

Re: The Titania Programming Language

#16
post #10

Having done a fair degree of programming in Wirthwhile languages, I think the only main design decision that I think was a mistake was the variables at the top. I'm not sure of the value of seeing all of the variables used listed in one place, it has certainly led to me encountering a identifier scrolling up to determine the type then scrolling back down. When the variable is only used on a few consecutive lines it's…

> I'm not sure of the value of seeing all of the variables used listed in one place

It means the compiler knows how much memory the function's activation frame will take and the offset into that for every variable before it encounters any code in the function.

Basically, it makes it easier to write a single-pass compiler. That was important in the 70s but is less important these days.

Re: The Titania Programming Language

#17
> teach compiler development with

Not trying to be confrontational, genuinely curious.. but why is this an area where you'd want a DSL?

My initial reaction is : When I'm learning a topic, the last thing I want to be worrying about is learning the ergonomics of a new language

I'm guessing there's a good rational I'm missing

it'd be nice to see some piece of compiler related code in this language that'd be ugly in a general purpose language

Re: The Titania Programming Language

#20
post #17

> teach compiler development with Not trying to be confrontational, genuinely curious.. but why is this an area where you'd want a DSL? My initial reaction is : When I'm learning a topic, the last thing I want to be worrying about is learning the ergonomics of a new language I'm guessing there's a good rational I'm missing it'd be nice to see some piece of compiler related code in this language that'd be ugly in a ge…

Oberon is a general-purpose programming language, not a DSL. Even though it is very minimal, you can still do quite a bit in it.

But the point of teaching compiler development is to teach people how to do the basic things from tokenizing, parsing, semantic checking, and code generation (directly to machine code).

I have found this is actually a skill most programmers don't even know how to do, especially just tokenizing and parsing, so I thought I'd use Oberon-07 as a base/inspiration for it.

n.b. at the time of this comment, the repo/project is not even 24 hours old yet.

Post reply on HN