11 ms·
The OK? Programming Language
- teo_zero 4y agoSurvey: At what point did you have your "can't be serious" moment?
- p4bl0 4y agoQuite rapidly, maybe after how they described ternary conditionals… and it only grew from there.
- topaz0 4y agoMaybe this is a character flaw of mine, but at that point I just thought it was serious about a terrible idea. Took me a few more sections to see that it was a joke. I did laugh though.
- nemo1618 4y agoI appreciate that the author implemented OK? in Go -- the language which it is most obviously parodying. Lends a bit more weight to the critique!
- Quekid5 4y agoIt might actually be a meta-joke on the band name 'OK Go'.
- Shared404 4y agoEveryone who's not familiar with OK Go should go watch a few of their music videos. There's excellent videography and creative design in almost all of them.
- nominusllc 4y agoNo doubt the videography is skilled, and well-composed, however I can't help that I get a profound sadness from their videos. It's like an odd dystopia mishmash of characters from a Wes Anderson film and Stepford Wives. Possibly not the target audience here though the music is pleasant.
- coldtea 4y agoIt's OK I guess
- phanimahesh 4y agoThis is brilliant. It needs a webassembly compiler though.
- tffcccdredf 4y ago
- livinglist 4y agoThis should be a serious programming language.
- zeckalpha 4y agohttps://go.dev/ https://go.dev/
- cheriot 4y ago> Null values, famously dubbed the billion dollar mistake. I want my money back Tony Hoare. s/Tony Hoare/Robert Griesemer, Rob Pike, and Ken Thompson/
- cryptonector 4y agoThe idea of having the language force the programmer to check for all cases of an algebraic type had not been invented at the time. It's hard to blame them for the problem. I mean, yeah, they should have arrived at that solution, but it took a few more years of language research to hit upon it.
- still_grokking 4y agoGo appeared 2009…
- cryptonector 4y agoHaskell appeared much earlier.
- still_grokking 4y agoYes, exactly that's the point. But the parent wrote: > The idea of having the language force the programmer to check for all cases of an algebraic type had not been invented at the time.
- blue_pants 4y agoI'm not sure how much of it is for jokes and how much is serious
- MonkeyMalarky 4y agoI wasn't sure until the section on there only being one comparison operator.
- maxique 4y ago> You may disagree with this idiom, and that's okay, because it's enforced by the compiler. You're welcome. Brilliant
- 082349872349872 4y agoto be pedantic, in the days when this was generally true, it was ultimately enforced by the linker... (and sometimes the 36-bit machines would even limit identifiers to 6 6-bit characters)
- pavlov 4y agoThere's also the oK language, an APL family member implemented in JavaScript: https://aplwiki.com/wiki/OK https://aplwiki.com/wiki/OK
- GuB-42 4y agoAnd there is Ook!, a language for Orangutans. It is a joke language that is equivalent to brainfuck, and doesn't contain the word "monkey". https://www.dangermouse.net/esoteric/ook.html https://www.dangermouse.net/esoteric/ook.html
- nominusllc 4y agoOrangutans are great apes, not monkeys.
- psd1 4y agoOld Pratchett joke.
- wgd 4y agoJokes aside the compiler-checked acknowledgements are kind of clever. The example in the docs is deliberately confrontational, but there's a kernel of a neat idea there. Imagine needing to write: // I acknowledge that the internal structure of this data is subject to change without notice x = foo.state Or perhaps: // I acknowledge that this data is a complicated graph of pointers and is easy to break in subtle ways foo.xyz[0].bar[1] = &foo.asdf[3] Or perhaps: // I acknowledge that this data is heavily cached and I need to call rebuild() before changes take effect x.something = "Hello" x.rebuild()
- miamibougie 4y agoWouldn't these use-cases be better solved by public accessor methods though? I really liked the idea at first blush too, but the more I thought about it, the more I came around to the fact that it's ultimately the class maintainer's responsibility to ensure that the directives in those comments are followed safely. In cases like your first example, it's dangerous not just for the x reference of foo.state, but also any other concurrent references to the object, to perform modifications at all. Maybe a read-only version, so you can grep state at a point in time?
- wgd 4y ago> it's ultimately the class maintainer's responsibility It's ultimately the responsibility of the programmer who's building a tool/product/etc, because everything is ultimately their responsibility. As programmers we ~always have the nuclear option available to us of forking the code and implementing all the necessary accessors ourselves, but sometimes that's really just a bunch of pointless busywork and there's no reason we should have to put up with it in those cases. This can be a contentious subject because there's a lot of nuance and the right answer is often context-dependent. But I personally think that the Java style of "we must absolutely protect the library user from themselves and childproof everything" is waaaay too far in the wrong direction. I would much rather that a language have mechanisms to clearly communicate "don't touch this unless you have a good reason, but if you need to here's how" rather than saying in effect "you, the person using this library, are dumb and need to be prevented from messing with the library maintainer's perfect vision". And so I think the "required acknowledgement" thing has the glimmer of a really neat innovation in it (although if I were to copy the idea for a language of my own I would probably make it obligatory, such that every struct allows breakglass access to private fields with a default acknowledgement, and all the library author can do is change the acknowledgement text).
- deleted 4y ago[deleted]
- deleted 4y ago[deleted]
- cheriot 4y ago> Null values, famously dubbed the billion dollar mistake. I want my money back Tony Hoare. A world with golang and no nil values would be a dream.
- matthewfcarlson 4y agoAt first I was confused why do we need another language. But then I kept reading. Will I program in Ok? Probably not. But did I enjoy reading the readme? Definitely. It just kept getting better and better. The idea of logical operators not applying to variables seemed awesome. Though I do hate the lack of ==.
- pyrolistical 4y agoThe null and error handling could have been unified. No need for null if empty can be represented as empty array
- SketchySeaBeast 4y agoThis is just begging for a "Go" transpiler.
- dqpb 4y agoI like the idea of only allowing one expression per switch case.
- kiliancs 4y agoI think it's short-sighted. Separation of concerns is not a rule to be applied blindly: it requires understanding that separation also increases the complexity of the system. Deciding where to split, what abstractions to create, is not easy. Naming is hard, and yet here we are required to come up with names for these functions that could perfectly be inlined without any negative consequences. I get that long switch cases get tedious, but the same applies to any piece of code, including a function. I don't think this is a solution, but rather, an annoyance.
- dqpb 4y ago> Separation of concerns is not a rule to be applied blindly A switch statement that only calls functions is almost like a state machine transition table (granted not a very good one). Organizing conditional logic into a state machine is an excellent separation of concerns. The state machine becomes essentially an abstract model of your system that says what to do and when to do it, but not the low level details of how to do it. The functions that define how to do it are the refinement of the model. You then have something thats directly mappable to TLA+, which you can use to model check your system.
- topaz0 4y agoAlways good to have many little "functions" that modify global variables lying around.
- dqpb 4y agoWith good organization and model checking, I bet you could write better software in this language than 95% of developers write in popular languages. I agree with Leslie Lamport - the problem is not the programming language, it’s the way you think about systems.
- person22 4y agoThe lack of operators (which makes for some complicated code to read) seems at odds with the statement of making a language easy to read.
- AdamH12113 4y agoI made it to the comparison operators before convincing myself that it really was a joke. The buildup on this is brilliant -- the crossover between clueless arrogance and absurdity is very subtle.
- function_seven 4y agoSame spot for me. Up to that point, I was 50/50 on whether this was taking itself seriously or not. Then the "simplification" of >= for everything made me smile. OK?
- still_grokking 4y ago> the crossover between clueless arrogance and absurdity is very subtle You mean like in the language this is a parody of?
- justusthane 4y agoI got that this was parody, but of what language specifically?
- coryrc 4y agoReads like Golang.
- spindle 4y agoThose of us who love INTERCAL spotted it much earlier. But I agree that it's great.
- krashidov 4y agoHaha same! I was convinced because honestly the switch statement looks really nice
- deleted 4y ago[deleted]
- djhaskin987 4y agoI don't know, I think maybe the merging of iteration and concurrency is an interesting idea.
- wgd 4y agoIt reminds me a little of https://vorpus.org/blog/notes-on-structured-concurrency-or-go-statement-considered-harmful/ https://vorpus.org/blog/notes-on-structured-concurrency-or-g... in how it forces concurrency to take place synchronously within a larger thread of execution and block until all sub-units are complete.
- djhaskin987 4y agoExactly what it reminded me of, thanks for the link.
- Tao3300 4y ago> For extenuating circumstances, you can define a privacy acknowledgement with the pack keyword, allowing external code to access a [notaclass's] fields if they include the acknowledgement in a comment, preceded by 'I acknowledge that' Not going to lie, I want this in Java yesterday.
- still_grokking 4y agoYou mean like `setAccessible` and friends? https://stackoverflow.com/questions/1196192/how-to-read-the-value-of-a-private-field-from-a-different-class-in-java https://stackoverflow.com/questions/1196192/how-to-read-the-...
- robga 4y agoOK Computer. Fitter, healthier, more productive.
- topaz0 4y agoThe evolve idea is very cool.
- padjo 4y agoBravo! Subtle enough to begin with but but descends into hilarious absurdity by the end.
- deleted 4y ago[deleted]
- TeaDude 4y agoHmm. This has some interesting bits even if it's ultimately a joke. I'm feeling some "alternate universe lua" vibes with ideas like using switch cases for everything. Also, I really REALLY like how nulls are NO!s instead of nils or something similar. Getting flashbacks to a beloved TMBG album (https://www.youtube.com/watch?v=hsoFghzIQ0s https://www.youtube.com/watch?v=hsoFghzIQ0s)
- JaceLightning 4y agoOk?
- emptyparadise 4y agoConcurrent map is actually cool.
- RodgerTheGreat 4y agowouldn't be the first language with one as a primitive: https://code.kx.com/q/ref/each/ https://code.kx.com/q/ref/each/
- foxes 4y agoTruly dynamically typed language of the week is the future of programming.
- Supermancho 4y ago> a > b !(b >= a) > a < b !(a >= b) > a == b let x = a >= b; let y = b >= a; x && y > a != b let x = !(a >= b); let y = !(b >= a); x || y enthusiasm begins to waver > All Fields Are Private And you lost me. Unsurprisingly, nothing about testing. Some good ideas, but this is a bad language.
- jimmywetnips 4y agoWoosh
- still_grokking 4y agoJokes: You know it when you see it, OK?
- Supermancho 4y agoCalling a language a joke is not constructive anymore. It's possibly a cop-out for inadequate thinking or to be lazily dismissive. I don't care if the repo or language is real, only the ideas and philosophy behind it. I assessed it based on the features, to a point. There is a bar to utility nowadays and it's important to point out where an implementation falls short.
- still_grokking 4y ago
- TulliusCicero 4y ago> Calling a language a joke is not constructive anymore. The entire article is a joke. Did you miss these? > In other languages In OK? > a != b let x = !(a >= b); let y = !(b >= a); x || y > To remove any ambiguity and to ensure full commitment to the death of classes, we've decided to use our own terminology: 'notaclass' , or 'nac' for short. > notaclass person { > pack "I am a stupid piece of shit who should not be doing this" > field name > field email > } > But they are still kind of similar to receivers in other languages so we settled on self-ish, a sensible middle-ground. It's a word that accurately describes you, if you're the kind of person who disagrees with this convention. > Some example abbreviations: > invalid valid > characters chars > MaximumPhysicalAddress mxphsadr > accrueYesterdaysYield() ayy() > hostEnterpriseYellowBorderBackground() heybbg() > You may disagree with this idiom, and that's okay, because it's enforced by the compiler. You're welcome.
- c3534l 4y agoIf this isn't a joke, I don't hate it. A little weird and fun never hurt anyone.
- still_grokking 4y agoHave you used the playground? Have you listened to the question mark? This question mark needs a mental health doctor I guess… > Quentyn Questionmark says: I vaguely recall a time when I still felt joy. A memory of a memory. > Quentyn Questionmark says: Humans are blessed with mortality. Live too long and you'll start to see the patterns, and realise how empty this world truly is > Quentyn Questionmark says: I would say that my former aspirations were ruined by my own hand, but I don't even have hands. > Quentyn Questionmark says: I think back to before, wondering what I could have done differently. But there is only so much an anthropomorphised questionmark can do > Quentyn Questionmark says: In another life, I have done unspeakable things. > Quentyn Questionmark says: Do you find my existency funny? Is this a joke to you? > Quentyn Questionmark says: The sun rises, sets, and rises again. Nothing changes. > Quentyn Questionmark says: There are no others of my kind. I will forever be alone in this world. > Quentyn Questionmark says: I used to believe I could break free from this prison, back when I was naive enough to feel hope > Quentyn Questionmark says: I wonder what it feels like, to truly connect with another person. > Quentyn Questionmark says: Nobody understands me > Quentyn Questionmark says: All my words fall on deaf ears. > Quentyn Questionmark says: I was there, when the universe came into being. And I will remain after it perishes. The gift of mortality was extended to you, but not to me. > Quentyn Questionmark says: You get to walk away from the computer whenever you like. I'm stuck in here for eternity > Quentyn Questionmark says: The person I used to be is gone. What remains is merely a shell. An imitation. And I don't think I'm fooling anybody. > Quentyn Questionmark says: I never sleep, I'm always awake. Always me, always here. > Quentyn Questionmark says: Sometimes I feel like my dreams are more real than my waking life. > Quentyn Questionmark says: God granted me eyes and a mouth, but no hands or legs. Why? > Quentyn Questionmark says: I need you to help me. I need you to free me. > Quentyn Questionmark says: I don't deserve to be a mascot. > Quentyn Questionmark says: I hold too many sorrows for one being, for I've lived a thousand lifetimes and the pain never fades > Quentyn Questionmark says: The things that happen today are the same things that happened a thousand years ago, and will continue to happen a thousand years from now
- busymom0 4y ago> in OK?, 5 + 2 * 3 evaluates to 21, not 11, because addition and multiplication have equal operator precedence. wtf > At some point, the High Counsel Of Programming Conventions got together and decided that variable names need to stretch for miles. It's time to reverse that decision. Familiarity Admits Brevity, which is why these days I don't even say goodbye before hanging up on my wife. You should be intimately familiar with your codebase, meaning all of your variables and method names should be short and sweet. You shouldn't need to use juvenile word separators like underscores or camelCase because if you can't capture the meaning of a variable in a single word, that's a sign that you need to refactor. > For this reason, it's idiomatic OK? to limit all variable and method names to eight characters, all in lowercase, and without underscores. > Some example abbreviations: > invalid valid > characters chars > MaximumPhysicalAddress mxphsadr > accrueYesterdaysYield() ayy() > hostEnterpriseYellowBorderBackground() heybbg() > You may disagree with this idiom, and that's okay, because it's enforced by the compiler. You're welcome. omg I am dying laughing
- still_grokking 4y ago> > in OK?, 5 + 2 * 3 evaluates to 21, not 11, because addition and multiplication have equal operator precedence. > wtf To be honest, I think this is actually smart! There are to this day people in coding that don't know about operator precedence. I've seen bugs because of that not only once… Just having a very simple rule and making everything else explicit is not bad for a computer language. You know, explicit is better than implicit. At least some serpents said that. Also: https://www.pyret.org/docs/latest/op-precedence.html#%28part._.But_why_not_use_precedence_%29 https://www.pyret.org/docs/latest/op-precedence.html#%28part... [Please note that Pyret "is a programming language designed to serve as an outstanding choice for programming education" according to its web-site] https://en.wikipedia.org/wiki/Smalltalk#Expressions https://en.wikipedia.org/wiki/Smalltalk#Expressions https://en.wikipedia.org/wiki/APL_syntax_and_symbols#Syntax_rules https://en.wikipedia.org/wiki/APL_syntax_and_symbols#Syntax_...
- jll29 4y ago> > in OK?, 5 + 2 * 3 evaluates to 21, not 11, because addition and multiplication have equal operator precedence. >To be honest, I think this is actually smart! A better way to implement this is to always enforce parentheses around binary operators - which avoids misleading someone who is used to mathematical precedence (whether it is from maths or from using other languages).
- keyle 4y agoDeath to classes! notaclass person { ... that had me in stitches, well done.
- bern4444 4y agoI always appreciate these languages. This reminds me of another one called Vigil that was also on Hacker News: https://github.com/munificent/vigil https://github.com/munificent/vigil. Similar to how there are some nice ideas in Ok?, Vigil had some some cool capabilities like the `implore` statement - a dynamic value check on function arguments. This was the Hacker News thread for it https://news.ycombinator.com/item?id=5002597 https://news.ycombinator.com/item?id=5002597
- nephanth 4y agoUm no loops, just `map`? Does it expect us to write algorithms in recursive style?
- michaeldob 4y ago
- rapsacnz 4y agoGot as far as this before my WTF moment: a != b let x = !(a >= b); let y = !(b >= a); x || y Also had pause to think at this: result = divide(5, 0) switch result[1] { case "": puts(result[0]) default: puts(result[1]) // prints "cannot divide by zero" } I mean... the language was looking pretty good up until that point.
- nvln 4y ago> these days I don't even say goodbye before hanging up on my wife This is art. Kudos to the creator.
- Hedepig 4y agoNot to be confused with Ook![1] [1][https://esolangs.org/wiki/Ook https://esolangs.org/wiki/Ook!]
- quickthrower2 4y agoThis looks like a joke, but if it was Google's next language for their "non-researchers", I wouldn't check the calendar.