Language Design Tread

Language Design Tread
Rustfags not allowed

What's left to be done with language design? For many purposes, traditional low-level languages are more than enough, but surely there is more to be done for rapid prototyping, standard libs, acceleration, etc...

Other urls found in this thread:

cs.cmu.edu/~rwh/pfpl.html
c0.typesafety.net/tutorial/
twitter.com/SFWRedditImages

Why isn't there a language that's simple and fast to use, but also allows for more precise low level control if wanted?

I've never understood this.

I think that there are too many languages

we should stop wasting time on solved problems like.. does a language need updates to make people keep using it? Updates are bad, you want legacy- it pissed me off so much seeing an update notification for anything, the idea that we should update things for the sake of it is so stupid.

Why does application X think that it is good enough for me to care about X.1? If i wanted X.1 I would look for it.

G O L A N G

Perl 6 is missing AST macros and cross-platform JIT. Every other HLL is already pretty much dead.

I'd like C with:
-Templates (or just typeof in macros)
-Functional "match"
-Easy UTF-8
-A cleanded up stdlib (use stdint everywhere, bool where appliable)

What purposes are these, exactly? For secure and correct software, they are woefully inadequate. The C programmer's ultimate trick is to lower your expectations until you accept nonsensical upper bounds and missing error handling as a fact of life rather than the sign of laziness they are.

I kinda agree.
Updates are a way of showing that your languages wasn't perfect to begin with.
But you really really should use the newest versions.

C is a very non-traditional language.

...

I guess you could use Python with C

Would you rather have a language that pretends to be perfect, even though it's not? Because that's the only realistic alternative to showing that your language isn't perfect.

:^)


literally rust


P A J E E T


rust has all of this

...

Who cares. It's not the language that matters, but the software. And we do have good enough languages, but the software (which languages are supposed to be FOR) is often not up to standards. Insane.

b-but we needed to add lambdas n sheeit to Java to show that it is still relevant to the programming meming community

LOL who cares about software, are you some kind of a fag?

The eloquence of your fizzbuzz and the exact number of bits on your memory is what's really important.

...

It's better to have known weakness' than create a mess of syntax like C++ has done. Java isn't an amazing language but it's very consistent. The only way to set an int x to five is say int x = 5;. In C++ you can do :
int x = 5;
int x (5);
int x {5};
auto x = 5;
And in other situations you can use decltype as well. Yes, those all have a purpose, but should they really be part of the language? A language should have a simple syntax that doesn't hamper expression. Not having 5 ways to declare an int isn't hampering expression.

That's all fine and well, but what does it have to do with my post? Java gets updates, too. From what I've heard Java 8 adds a lot of neat things. You can keep updating your language without having three different alternatives to "int x = 5;", and you can even keep your language the same and have three different alternatives to "int x = 5;" to begin with.

C++ adding in 4 ways to say int x =5;. To keep in line with , these are just pointless features. You can say that the language is imperfect/incomplete without them but it's not really a good thing to add them. All I mean to say is that a language lacking a feature is not always a bad thing.

I agree with all of that. The point is that it doesn't have much to do with .

People who don't even like Java added lambdas to Java. They want to change Java into something else so "the plebs" can get an "upgraded" and "modernized" language.

What the fuck is a traditional low-level language if the one that nearly all current relevant kernels are based on isn't?

Which ASCII-only, single-threaded, failing-test-suite joke do you propose everyone use then, mr. leftpad?

"In 1969, AT&&T had just terminated their work with the
GE/Honeywell/AT&&T Multics project. Brian and I had just started
working with an early release of Pascal from Professor Nichlaus Wirth's ETH
labs in Switzerland and we were impressed with its elegant simplicity and
power. Dennis had just finished reading 'Bored of the Rings', a
hilarious National Lampoon parody of the great Tolkien 'Lord of the
Rings' trilogy. As a lark, we decided to do parodies of the Multics
environment and Pascal. Dennis and I were responsible for the operating
environment. We looked at Multics and designed the new system to be as
complex and cryptic as possible to maximize casual users' frustration
levels, calling it Unix as a parody of Multics, as well as other more
risque allusions. Then Dennis and Brian worked on a truly warped
version of Pascal, called 'A'. When we found others were actually
trying to create real programs with A, we quickly added additional
cryptic features and evolved into B, BCPL and finally C. We stopped
when we got a clean compile on the following syntax:

for(;P("\n"),R--;P("|"))for(e=C;e--;P("_"+(*u++/8)%2))P("| "+(*u/4)%2);

To think that modern programmers would try to use a language that
allowed such a statement was beyond our comprehension! We actually
thought of selling this to the Soviets to set their computer science
progress back 20 or more years. Imagine our surprise when AT&&T and
other US corporations actually began trying to use Unix and C! It has
taken them 20 years to develop enough expertise to generate even
marginally useful applications using this 1960's technological parody,
but we are impressed with the tenacity (if not common sense) of the
general Unix and C programmer. In any event, Brian, Dennis and I have
been working exclusively in Pascal on the Apple Macintosh for the past
few years and feel really guilty about the chaos, confusion and truly
bad programming that have resulted from our silly prank so long ago."

...

haskell

I'm currently working on a strongly dynamically typed, compiled, object oriented, C-like language that doesn't need semicolons or any of that crap, doesn't need brackets around conditionals, comes with garbage collection and has equals as both comparison and assignment, doesn't have ++ or --, doesn't have formal variable declaration and has dynamic methods and members.

Fizzbuzz would look like this for example
buzz_count=0fizz_count=0for i range(100){ if i%3 = 0 { //Yup, no semicolons, so you can do this print("Fizz") fizz_count+=1 } else if i%5 = 0 { print("Buzz") buzz_count+=1 } else { print(str(i)) }}

I've already written a parser that generates the AST for this, I'm only having trouble finding a nice and fast string hashing algorithm right now (having dynamic methods and members means I'm gonna need a hashtable of members)

c#?

By default has the garbage collector and shit but you can turn this off and do good old fashioned low level programmer managed memory when you need it.

If you need to use _asm code you can still do so using a dll

...

Your fizzbuzz looks like Python with a slightly different syntax (colons+indentation -> curly brackets, elif -> else if, for a in b -> for a b, == -> =, implicit semicolons). This is a valid Python version of your Fizzbuzz, made purely by translating syntax, without changing the code path or any identifiers (including function names):
buzz_count=0fizz_count=0for i in range(100): if i%3 == 0: print("Fizz"); fizz_count+=1 elif i%5 == 0: print("Buzz"); buzz_count+=1 else: print(str(i))
With the details you've given it sounds like you could just take a Python compiler and change its parser. Compiled python is strongly dynamically typed, compiled, object oriented, imperative (I don't know what "C-like" means in this context but your language is much closer to Python than to C as far as I can tell), garbage-collected, without formal variable declaration, and with dynamic methods and members. That only leaves syntax changes, of which you already have no required brackets around conditionals and no ++ and --.

What nifty things will your language be able to do that can't be done by existing programming languages with the same characteristics?

Multiple statements on one line, it's designed to be compiled, the syntax is C-like (curly brackets etc), it has a dedicated assign by reference operator (a@=b) and defaults to copy assignment.

C and Python can both do this. That converted Fizzbuzz had multiple statements on one line.

In which way?

Kinda, it depends on where the whitespace is, the parser works by going through tokens and attempting to reduce them as much as possible, since a=b c=d is only valid as (a=b)(c=d) it'll get parsed as that, on the other hand something like a + c- d will still be understood as a+c-d

Does this also mean assignment is not an expression (unlike in C)?

Yeah and they both need you to use a seperation character, my language could do fn()fn2() or (a=b)(c=d) just fine, those can't.
In the way that it won't have things like exec() and you won't end up with tons of compiled implementations incompatible with most of the software actually written in that language.

Yes, there are no == and ===, just = and its meaning is inferred from context

In your language, what does 'a' evaluate to here? Is it a boolean or an integer?
a = b = 5

a would be a boolean representing whether b is equal to 5
So basically
a=(b==5)

>features: ambiguous use of = character

splendid

Oh right, I just realised I forgot the actual 'fizzbuzz' but honestly who cares it's not like fizzbuzz has practical applications, it's the lorem ipsum of code.

And what is a = b = c = d

a = b = (c == d)?

a = (b == (c == d))?

God this is so fucked up and will lead to problems.

Why not just go post fix notation and have assignment be a different operation from comparison so there is never any confusion or ambiguity?

What a terrible idea.

Evaluating from left to right, the most sensible interpretation would be a = ((b == c) == d).

Using = for comparison is not bad per se, but you can't also keep using it for assignment. APL and most mathematically inclined pseudocode use ←, for example.

So I can do stuff like this
if a=1
Because how many times have people instinctively written that instead of ==, why? Because it makes more sense.

Also it'd be evaluated as

It's less of a 'wow this is a great feature always use this' thing but rather 'this is interesting and people should be able to do this if they want, someone might find a good use for it'.

It does make more sense, but if you change just that without changing assignment code becomes harder to understand. Especially if you want to keep a C-like syntax.

In C, assignment in a conditional statement doesn't just have a meaning, it's used often. Perfectly reasonable C code might look identical to perfectly reasonable YourLang code but do something wildly differently.

Using the same operator for two things is also less readable. It makes it slightly harder to see wat code is doing. Using = for equality is fine, but if you do it, use a different operator for assignment.

I'm speaking from experience. Unix shell uses the same operator for assignment and equality checking (more or less), and I don't like it.


What kind of "good use" could there possibly be for it? It's just saving a single character. If you think it looks neat or something that's fine, but it doesn't open up any new possiblities of note.

Make an optional := for assignment.

Don't make it optional, make it the only way. Why would you allow both?

You should make = comparison and

So he can keep what he wants. It's his language. If he wants more people to use it, := or some other dedicated expression would be nice.

Of course he can do what he wants, but that doesn't mean that what he wants is automatically justified.

Don't even bother implementing your own language until you have read and understood this cs.cmu.edu/~rwh/pfpl.html

It's a self contained book, the notation is 'logical judgements'. Without this book you will guarantee produce bullshit.

Once you rigorously can define the spec of a language then implement your whatever C-like OOP language. Also you should realize type safe garbage collected C already exists c0.typesafety.net/tutorial/

I think C did a good job with it. if you look at C11... there are so few differences, its just more stuff in the standard library like threads. just adding in things that are almost universal.. and more relevant than say adding in graphics

now i dont like the Generic macro which is broken... but other than that... its OK. Try using it on a function that has more than one variable.

Somebody should have stopped Terry Davis from wasting his time a long time ago.

They exist and they're shit, and the reason why is that you want to mix 2 different concepts into the same thing.
Just lean C and then python and be done with it.

You don't understand what is Davis's motivation. His motivation is to write an OS that's as hackable as the Commodore 64 was hackable. TempleOS is designed to be a toy and it has achieved his end of amusing himself as a hacker's OS.

A functional language without GC

Do you mean functional as in "functional programming"? How would you do manual memory management without getting mutable state all over the place?

Really makes you think.

>for (int k = 1; k < 31; k++)
No wonder students think you have to replace every loop by map or filter.

I was being sarcastic because the person I responded to was being a twat.
Learning and fun, that's why.

It would have GC as a separate datatype and would be enabled by default and there would be another datatype that could bypass it and could potentially give you access to the memory.

...