Draco-lang / Language-suggestions

Collecting ideas for a new .NET language that could replace C#
75 stars 5 forks source link

Language ideas #60

Closed MemeManMemes closed 2 years ago

MemeManMemes commented 2 years ago

Ideas:

Keypresses

Keypresses might not seem like a thing that you would use, but many other people such as game devs and testers would use. Example in a made-up language: Keypress key = new Keypress(); Timer timer = new Timer(1); // The "1" stands for how many milliseconds there are in a timer interval timer.Start(); if (key == Key.A) { Left++; } if (key == Key.S) { Down++; } if (key == Key.D) { Right++; } if (key == Key.W) { Up++; } timer.End()

New list declaration

In C#, List declaration goes like this: List<string> list = new List<string>(); However, it would be nice to see a new type of list declaration in your language like this: List<string> list; in case if some people just want to declare a new list but don't want to give it a value.

Adding things to arrays

One of the most annoying things in C# is having to declare how many objects are in an array then add them. Instead, you should make it so your language can add an almost infinite amount of objects to a array without having to declare how many there are.

These are just my personal grievances btw

WhiteBlackGoose commented 2 years ago

Keypresses

It doesn't look like a language feature. However, you can make a library for .NET which would give this API.

New list declaration

List<string> list; is legal in C# too. Note, that we have different syntax for variable declaration.

Adding things to arrays Instead, you should make it so your language can add an almost infinite amount of objects to a array without having to declare how many there are.

This is precisely what lists are for.

Thanks for your attempt to contribute though.