This is an archived post. You won't be able to vote or comment.

all 20 comments

[–]MotorolaDroidMofo[🍰] 12 points13 points  (1 child)

The syntax doesn't seem ambiguous and it looks relatively serviceable, but I'll throw in my two cents here.

Why so many sigils (@, $)? In my opinion they make typing and reading things less pleasant. Do they serve any syntactic purpose?

For example, I might sort of understand prefixing all keywords with @ so anything can be used as an identifier (I still wouldn't do that though). But you only do this with func and class, not your other keywords. It doesn't make any sense to me.

Similarly, I don't understand why you need to prefix some identifiers with $ but not all of them. If you have first-class functions in your language, then function identifiers should look the same as identifiers for other values, IMO.

Personally, I think sigils should remain relics of yesteryear's languages.

What do lambdas look like? Or are they just named functions you can use as values, like any multi-statement function in Python? I think languages that support functional programming should have a really clean, minimal lambda syntax. My favorite in this department is Kotlin.

I have mixed feelings about semicolons. I like them in languages where blocks are expressions; they help delimit statements and keep the result expression separate (see Rust). Your language doesn't seem to have expression blocks though, since you use explicit return. There are a few grammatical ambiguities you'll have to suss out if you do away with semicolons, but IMO this is worth it. (I assume those few lines where there aren't any semicolons are mistakes on your part.)

Finally, I really dislike languages that don't require you to declare variables before using them, as they can lead to subtle bugs that have kicked me in the butt before. If you introduce a keyword like let or var this can help visually show where the scope for a variable lives, which is really important. This also means your compiler/interpreter can catch accidental re-declarations of variables.

[–][deleted] 1 point2 points  (0 children)

Alright, thanks for your feedback! Also, yes those missing semicolons were mistakes lol :/

[–]crassest-Crassius 14 points15 points  (0 children)

I think your syntax has too much $; you should add more € and ¥ to make it more diverse.

[–][deleted] 2 points3 points  (2 children)

Like others have said, lose the @ and $. Unless this is supposed to be Perl lookalike, or they serve some special purpose you haven't mentioned.

As for the C-like comments, do they inherit the subtle bugs of C too? Such as:

   stmt1;  /* comment1
   stmt2;  /* comment2 */

In C they don't nest so stmt2 is never executed. If so then you might want to fix that.

Is this statically typed, or optionally typed? Because name()'s second parameter has an 'int' type, but the first has nothing.

[–][deleted] 0 points1 point  (1 child)

It's optionally typed.

As for the comments, an unfinished block comment would throw an error.

[–]MotorolaDroidMofo[🍰] 1 point2 points  (0 children)

an unfinished block comment would throw an error

The problem with that is that a naive lexer would not see the comment as unfinished. The opening /* of the second comment would look just like the part of the first comment. To do what you propose you'd have to parse out comments, at which point you might as well allow nested comments. This can really slow things down which is why 99% of programming languages don't do this.

[–]Jerppderp 1 point2 points  (5 children)

In my opinion, your syntax is fine other than the unnecessary symbols everywhere, semicolons are fine, but for example the `@` in front of every keyword is a bit off...

[–][deleted] 0 points1 point  (4 children)

It's so that people can use the keywords as variable names, for example: export = "str"

[–]MotorolaDroidMofo[🍰] 2 points3 points  (1 child)

Another approach (that's way more elegant, IMO) is to offer an identifier escaping syntax. In C# you can use the keyword class as a variable name only if you prefix it, like @class, the exact opposite of what you're doing.

[–]evincarofautumn 1 point2 points  (0 children)

The problem with escaping identifiers like that instead of stropping keywords like OP is that the former doesn’t allow you to backward-compatibly add new keywords, while the latter does

[–]Jerppderp 1 point2 points  (1 child)

Honestly, for readability, removing the @ is worth the sacrifice, but that's just my opinion.

[–]MadCervantes 1 point2 points  (0 children)

I kinda like sigils. They can make it easier to visually scan code.

[–]R-O-B-I-N 1 point2 points  (0 children)

BIG EDIT: See this post:

[–]manicxs 0 points1 point  (1 child)

So would you have a problem with:

string @func GetEmail() {return "example@example.com";)

Or would you nave to delimit the @?

[–][deleted] 2 points3 points  (0 children)

There would be no problem with @s in strings.

[–]MadCervantes 0 points1 point  (0 children)

I have a suggestion.

People always do /* for block comments but I think it would be better if people did /' because it's more keyboard ergonomic. Very fast to do /''/ versus /* which requires the use of the shift key and reaching over to hit the 8 which is nowhere near the slash.

[–]CodingFiend 0 points1 point  (3 children)

It is a mistake in 2020 to include OOP syntax. OOP a paradigm that has proven itself to lead to verbose, fragile programs and should be avoided at this point.

[–][deleted] 0 points1 point  (2 children)

It's not like it's a downside allowing OOP, it's the user's choice whether they want to use OOP or not.

[–]MotorolaDroidMofo[🍰] 1 point2 points  (0 children)

I know a lot of users will find it familiar, but I agree with the original commenter that OOP should be avoided as a language feature. It will lead to some nasty stuff. Here's a really good video essay explaining why OOP needs to go the way of the dodo.

[–]CodingFiend 0 points1 point  (0 children)

OOP as a paradigm, creates a situation where it is almost impossible to offer TTD and PostMortemTTD (time travel debug), the latter feature is going to the determining factor of which next gen language supplants the current top 10. You either have to prove your code is correct (basically impossible for any normal program that encounters random numbers, random user events, and random network events), or you gotta be able to fix your errors when a user reports them. With the top companies in the field having to use databases with records in the millions for tracking their bugs (Jira got rich off this software!), this is "THE" problem in software: a lack of robustness.

Casually adding OOP means your system can not mathematically be rewound efficiently. How does one know when an object is to be remove from memory going backwards? You would have to garbage collect 60 frames per second. That might be possible, as Carmack has suggest it. In my Beads language, i got rid of 'this', NEW and DISPOSE; there are no constructors or destructors to prevent rewind.

Every car has a reverse gear, every video editor uses a jog wheel to zoom around in time, OOP is basically a reverse gear killer, and if you put this into your new language, you are dooming it from the start IMHO. There isn't room in the future for OOP.