Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411423 Posts in 69363 Topics- by 58416 Members - Latest Member: JamesAGreen

April 19, 2024, 01:31:37 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Thoughts on Tim Sweeney's proposed programming language?
Pages: [1]
Print
Author Topic: Thoughts on Tim Sweeney's proposed programming language?  (Read 1629 times)
Orz
Level 1
*


"When nothing is done, nothing is left undone."


View Profile WWW
« on: March 01, 2018, 02:02:09 AM »

Did anyone else read this?

https://groups.csail.mit.edu/cag/crg/papers/sweeney06games.pdf

There are some choices I don't quite understand, probably because they make sense only after one has done a ton of programming.  Like where he says "Only throw() constructs should cause an exception".  What do people with a lot of experience think about this?
Logged
bateleur
Level 10
*****



View Profile
« Reply #1 on: March 01, 2018, 08:38:49 AM »

I'm not a language expert by any means, but I suspect the thinking behind that one is to make it easier to work out which code needs try/catch blocks. For example, in my own (say) C# code I often simply don't catch any exceptions which I'm not expecting, which makes them actually no better than errors. Even in production code I have only very crude handling for unexpected exceptions which leaves them still being quite error-like.

More generally I think "if the compiler doesn't beep, my program should work" is wrong. I mean, it's so massively, outrageously wrong that I can only assume I'm not quite understanding what he intended by it.

His perspective on concurrency seems a bit daft to me too (although I'm guessing there was more to the talk than the slides show). Concurrency isn't hard because it's badly implemented, it's inherently hard. Anything which auto-solves the problems is just relocating the complexity (and maybe bugs) to some new area. I can't help suspecting someone's forgotten their Fred Brooks.

His comment about pointers vs optional values I do agree with, but any solution comes with its own problems in terms of handling missing optional objects. Instead of endless null checks or endless try/catch blocks you end up with endless checks for whether an optional thing is actually there or not. Semantically that seems... basically the same?

Overall though, this seems like sensible stuff. He's advocating more more functional programming, which is something people have been talking about for at least 40 years and it continues to be a good idea (but apparently hard to integrate well with imperative thinking). And he's talking about the flaws of systems he's an expert in, which is always worthwhile reading.

His "effects free" thinking is very much at the heart of functional programming. I remember writing lots of OCaML back in the 90s and struggling to formulate stuff in pure functional terms. I often failed and wrote things with side effects, but at least it made me more aware of the issues.

Here's what's going to stop this being widely adopted, though: People don't like to write pure, functional code. It's been around for a while and, with a few notable exceptions, it doesn't really get used.
Logged

BorisTheBrave
Level 10
*****


View Profile WWW
« Reply #2 on: March 01, 2018, 02:05:20 PM »

He's listed a lot of theoretical features that no one has really managed to make work practically (dependent types, STM), or features that can work, but he glosses over the downside (non-nullable types, purity, tagged pointers).

I have to wonder if he's actually tried any of the things he's proposing. I was more impressed by Jonathan Blow's language proposals, as they seemed rooted pragmatism.

My take on his concurrency slides was he was observing that different approaches work well for different types of code, and (fortunately for game devs), the types of code observed in games are always the same, so the framework can make this descision for you and make success the easy path.

Quote
any solution comes with its own problems in terms of handling missing optional objects. Instead of endless null checks or endless try/catch blocks you end up with endless checks for whether an optional thing is actually there or not. Semantically that seems... basically the same?
If your language supports non-optional types as well as optional ones (as the slides suggest) then you don't end up with endless checks, just when you need to go from optional to non-optional. In practise, you can write large swathes of code with non-optional types and never have to worry.
Logged
Orz
Level 1
*


"When nothing is done, nothing is left undone."


View Profile WWW
« Reply #3 on: March 02, 2018, 03:26:49 AM »

To me, it sounds like everything is based around safer concurrency, and he wants to be able to write blocks where freaky stuff is allowed to happen because the programmer personally knows it can be safely parallelized.  Take the exceptions, for example: it sounds like he is afraid of cases where an exception occurs in just one thread and messes up the game state...but if the programmer knows it's OK, it can be done.

Ditto for "lenient evaluation".  It sounds like he wants lazy evaluation to go into freaky programmer-approved blocks, and eager evaluation to be done by the compiler when it knows the value won't change.

And ditto for the "atomic" statement blocks and transactional memory.  Isn't STM working in some languages?  I thought that Clojure had it.

But I'm really shingling on the fog here...
Logged
InfiniteStateMachine
Level 10
*****



View Profile
« Reply #4 on: March 03, 2018, 12:47:27 PM »

1) My understanding was the advantage of option is that it's a compile-time error to not check for none (null) when matching against an option type in languages that have proper support (ML languages).

2) I don't think understand the slides about the only throw() constructs can generate an exception. Isn't that the case today? How do you cause an exception without throwing an exception?

3) Regarding purity. At the very least I wish that C++ was pure by default and you break purity by marking params as mutable rather than the other way around.

4) Regarding functional languages. Last I checked in non-game industries these types of languages are becoming more popular very quickly. Especially in fields where program correctness is critical. As an imperative programmer I struggle to write functional code. It almost feels like I'm learning to program again. That said I've found my time learning ML languages has improved my imperative programming skills profoundly.





Logged

BorisTheBrave
Level 10
*****


View Profile WWW
« Reply #5 on: March 03, 2018, 03:04:22 PM »

2) I don't think understand the slides about the only throw() constructs can generate an exception. Isn't that the case today? How do you cause an exception without throwing an exception?
NullPointerException and OutOfBoundExceptions, I presume, which are generated when you do normal operations.
Logged
InfiniteStateMachine
Level 10
*****



View Profile
« Reply #6 on: March 04, 2018, 04:31:54 PM »

oh yes of course my bad. So after a second read the idea is a null exception wont occur due to the use of option and an outofbounds exception won't occur due to dependent types? Interesting.

So I guess the overall theme for the two is introduce language constructs that force you to check for errors.

The integer thing is interesting too. I guess it's kind of like UTF-8 but for integers?
Logged

Raptor85
Level 5
*****



View Profile WWW
« Reply #7 on: March 04, 2018, 07:33:36 PM »

  Grin Hand Point Right -fno-exceptions  Hand Point Left  Grin
Logged

-Fuzzy Spider
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic