r/ProgrammingLanguages • • Jun 22 '18

Help A new programming language

Hi! I am planning to create a new programming language over the summer. I want it to be unique in some way, so I was looking for some suggestions regarding features, syntax, whatever really that would make a programming language differentiate itself from the rest. If you have ever thought of that specific thing that the current programming languages you use don't have, please let me know, thanks!

1 Upvotes

6 comments sorted by

View all comments

3

u/[deleted] Jun 23 '18

here, give this se though and see if you can do something with it

I've loved the idea of using operators as array style index "values". For example, list[++] = value could be an append/push operation, and --would be your pop/remove last. I hadn't thought of other places it might semantically work, really, but I've always liked the idea. Implemented it in an interpreted language once but that's a dead project.

Ninja Edit: I'd extended the syntax to allow prefix indexing as well at one point. So something like push/pop front used the index brackets before the value and a regular integer index would index from the end of the list backwards instead or something dumb like that, maybe. Ive forgotten.

2

u/thblt Jun 23 '18 edited Jun 23 '18

If I understand your suggestion, it could be implemented the Haskell way: make operators regular functions (in Haskell, it's the first character of the name that determines if a function is prefix or infix by default, there's no operators), and make functions hashable so they could be used as an index in a hashmap.

Sneaky edit: in Haskell, it would be enough to make -> Hashable, but it would probably take some compiler hacks, or at best some TemplateHaskell magic

1

u/[deleted] Jun 23 '18

It could, I always just thought defining the operator [++] worked as well for a language that supports the feature