The OK? Programming Language
github.com
github.com
// 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()Maybe a read-only version, so you can grep state at a point in time?
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).
I tend to agree with this sentiment; especially when the 'child-proofing' means to do the thing right with the library/api in question is more work than just rolling your own.
> 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".
In some cases I've seen/used the term 'Unsafe'.
C# language-ext uses this for some methods that can return null (as opposed to un-Unsafe-suffixed methods, which will throw on null). I've also used it for some 'low level' methods in libraries, where it is a case of 'you need to read the docs to know how to not turn it into a footgun'.
The problem of course is that in my main language (C#), the word 'unsafe' has other connotations (i.e. pointer arithmetic.)
When I first submitted my PR, there were numerous developers who did not like the term 'Unsafe' for the reasons mentioned above. I asked what it should have been called in that context instead, and floated 'Yolo' as a tongue-in-cheek suggestion.
(That being said, If there -was- a word to use to denote 'with great power comes with great responsibility' people would suggest, I'd love to hear it.)
; We had fun deciding on these.
ReadEnvStr $1 IPromiseNotToComplainWhenPortableAppsDontWorkRightInProgramFiles
${If} $1 S== "I understand that this may not work and that I can not ask for help with any of my apps when operating in this fashion."
${DebugMsg} "You're making me sad by the way you voided your warranty, running in Program Files."
${Else}
; This string doesn't let on about the disable switch (by design)
MessageBox MB_OK|MB_ICONSTOP `$(LauncherProgramFiles)`
Quit
${EndIf}
I’ve done one or two other extremely verbose environment variable names and values or function names, but this is the only one that’s springing to mind right now.Not sure quite why we decided to allow it at all there, but I suspect I just had too much fun with it. Not sure why it ended up spelled “can not” instead of “cannot”, either.
(If you’re wondering about ${…} on If/Else/EndIf, that’s because NSIS is basically an assembly language and has only jumps for control flow; LogicLib.nsh provides nice control flow constructs via defines and macros, abstracting the automatic creation of labels and the right jumps so that that `${If} $1 S== "…"` compiles to `StrCmpS $1 "…" 0 ‹auto-else-label›`, `${Else}` to `Goto ‹auto-endif-label›; ‹auto-else-label›:`, and ${EndIf} to `‹auto-endif-label›:`.)
You mean like in the language this is a parody of?
Brilliant
(and sometimes the 36-bit machines would even limit identifiers to 6 6-bit characters)
Not going to lie, I want this in Java yesterday.
https://stackoverflow.com/questions/1196192/how-to-read-the-...
There's excellent videography and creative design in almost all of them.
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
> 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...
[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/APL_syntax_and_symbols#Syntax_...
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).
I actually think what Pyret does is reasonable.
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
notaclass person {
...
that had me in stitches, well done.It is a joke language that is equivalent to brainfuck, and doesn't contain the word "monkey".
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)
A world with golang and no nil values would be a dream.
s/Tony Hoare/Robert Griesemer, Rob Pike, and Ken Thompson/
> 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.
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.
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.
I agree with Leslie Lamport - the problem is not the programming language, it’s the way you think about systems.
The idea of logical operators not applying to variables seemed awesome. Though I do hate the lack of ==.
This is art. Kudos to the creator.
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
> 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.
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.
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.
If you're not interested in language design, I'm not sure why you bother to read any new (real or fictional) language docs. It might be a joke and you just stop thinking about it? That's lazy thinking and I'm not sure how it's beneficial in informing your preferred design choices, over time.
I'm sorry if my serious consideration of satirical language design offends your sensibilities. I have the opposite reaction.