6 ms·
The manual is here (linked from github readme): https://github.com/p-org/P/blob/master/Doc/Manual/pmanual.pdf https://github.com/p-org/P/blob/master/Doc/Manual/
by taneq 10y ago
The manual is here (linked from github readme): https://github.com/p-org/P/blob/master/Doc/Manual/pmanual.pdf https://github.com/p-org/P/blob/master/Doc/Manual/pmanual.pd...
Calling a core language keyword "goto"? They're brave.
And I'm not convinced of the utility of baking their own C-like imperative language when they could have actually used real C. There are already too many C-like languages out there that are just different enough from C to be annoying.
- smegel 10y ago> Calling a core language keyword "goto"? They're brave. I thought so too, but it makes sense really. State machine only have one state and can only go to a new state from another - you don't call functions and return to the current state.
- taneq 10y agoOh, yeah, but the pogrom against labeled jumps is so much a part of software dev culture now that I'd expect that sequence of letters to elicit a negative response regardless of how appropriate they were.
- kobeya 10y agoGreat. Maybe it will throw off anyone who can't be bothered to see the logic behind it.
- mdgrech23 10y agoCame here w/ the same thought.
- tinco 10y agoDid you read the manual? They use their own little language which is imperative, but unlike C side effect free. To execute side effects it offers a way to implement machines in regular C. This is for example how 'Timer' is implemented in the manual.
- RandomInteger4 10y agoI feel like "goto" gets an unfair bad reputation. It really can be useful at times.
- ap22213 10y agoUntil the time at which another developer must debug it and all previously gained value instantly disappears (at least in imperative languages)
- carterehsmith 10y agoI think you are talking about something else, not goto. Did you mean 'exceptions'?
- Tideflat 10y agoIn vanilla C, exceptions do not exist. Thus goto is the standard (at least for the Linux kernel) statement for handling exceptions.
- carterehsmith 10y agoOh, I see. Is that something like setjmp/longjmp?
- unwind 10y agoNo, it's just plain goto, to a named label which is (for this case) later in the function. It's quite common in low-level code where you want to do a bunch of things that can all fail, and you need to rewind and undo the things that succeeded up to the point of failure. See http://stackoverflow.com/questions/13001067/why-do-some-kernel-programmers-use-goto-instead-of-simple-while-loops http://stackoverflow.com/questions/13001067/why-do-some-kern... and https://www.kernel.org/doc/Documentation/CodingStyle https://www.kernel.org/doc/Documentation/CodingStyle (chapter 7 but that's raw text so I can't link).