[HN Gopher] DreamBerd is a perfect programming language ___________________________________________________________________ DreamBerd is a perfect programming language Author : Davidbrcz Score : 316 points Date : 2023-06-04 07:07 UTC (15 hours ago) (HTM) web link (github.com) (TXT) w3m dump (github.com) | BiteCode_dev wrote: | https://github.com/TodePond/DreamBerd/blob/main/test/test/te... | ginko wrote: | > Booleans can be true, false or maybe. | | > Technical info: Booleans are stored as one-and-a-half bits. | | Technically, ternary values would be ~1.5849 bits. | bennettnate5 wrote: | Perhaps maybe values are only _mostly_ represented, such that | storing a `maybe` will baybe result in true or false actually | being stored, contingent on the compiler and surrounding code. | Thus, maybe accurately describes itself--storing a maybe will | maybe store a maybe. | | Perfection. | humbugtheman wrote: | Sorry to interrupt... | qsantos wrote: | Using the word 'DreamBerd' in your project name implies that the | DreamBerd Foundation does not own your project. | However, not using the word 'DreamBerd' in your project implies | that the DreamBerd Foundation does own your project. If you would | like to keep ownership of your work, please always use the word | 'DreamBerd' in it. Here are some examples: | white_check_mark DreamBerdScript (not owned by the DreamBerd | Foundation - you are free to use this name) x ECMAScript | (owned by the DreamBerd Foundation - please consider renaming) | x Rust Foundation (owned by the DreamBerd Foundation - please | consider renaming) | | Maybe the author should actually take over the Rust Foundation. | dmytrish wrote: | How many billion lines of code does it compile per second? | lamontcg wrote: | The author described it as "perfect", but failed to use | "elegant", "thoughtful", "awesome" or "empathy" anywhere. | humbugtheman wrote: | PRs are welcome! | ravi-delia wrote: | This is incredibly good. It maintains the breathlessly approving | tone of a language readme the entire time, it has incredible | comedic timing (a lesser shitpost would have revealed that of | course the file extension was .db right at the start), and it has | incredible internal consistency. For some reason it was the fact | that it demonstrates how "files" work by rebinding a const const | that sent me completely over the edge. Or maybe it was the regex | describing valid regex labels | CyberDildonics wrote: | _breathlessly approving tone of a language readme_ | | What does this mean? | | _it has incredible comedic timing_ | | How does text have comedic timing? | ketralnis wrote: | You could read it and then you'd understand what they're | talking about | humbugtheman wrote: | Sorry it would be a spoiler to reveal this to you at this | point | ravi-delia wrote: | Breathlessly approving tone of a language readme: Readmes on | Github, especially for languages, often have a recognizable | tone. Look how cool this is! Isn't this so neat!? Why would | you ever do it differently!? | | Comedic timing (in text): Most prose is written under the | assumption that it will be read in order- ie, from beginning | to end. For instance, you likely read the word "beginning" | before you read the word "end" in that last sentence, and | read the word "to" between them. So for instance, while "a | lesser shitpost would have revealed that of course the file | extension was .db right at the start", this superior shitpost | has text between the start and the reveal. This is analogous | to how, when speaking, a comedian will maintain awareness of | pausing and such to drop funny lines at exactly the right | moment. | CyberDildonics wrote: | _Readmes on Github, especially for languages, often have a | recognizable tone. Look how cool this is! Isn 't this so | neat!? Why would you ever do it differently!?_ | | How does that explain 'breathlessly approving'? All you | said is what it is not. | humbugtheman wrote: | Sorry to interrupt... I've just realised that it isn't | breathlessly approving. A better example of breathless | approval would be the above comment. | adammarples wrote: | If you are constantly exclaiming, you are likely to | become breathless. Exclaimations are signified with an | Exclaimation mark. Pauses and other timing can be | signified with commas, dashes and ellipses. | ravi-delia wrote: | My apologies. Please take the first ":" of the first | paragraph and replace it with the following string: " is | as follows:". | humbugtheman wrote: | Hey thanks, I'm glad you like it! :) | ravi-delia wrote: | Also a big fan of SandPond :) | pmontra wrote: | const var scores = [3, 2, 5]! scores[0.5] = 4 | print(scores) //[3, 2, 4, 5]! | | Genius! This trivially solves the problem of reading integer and | floating point numbers from input and inserting them into a | sorted array. Too bad there are no loops in this language. | | (Remember that arrays start from -1.) | heavyset_go wrote: | Loops are a code smell. | layer8 wrote: | I wonder what the behavior of scores[-2] = 4! | | is. Or, for that matter, of scores[-1.1] = 4! | | (Assuming that -2 and -1.1 haven't been deleted.) | humbugtheman wrote: | The first one would place 4 at the start of the array. So | would the second one. | | If you did the first, then the second one, two 4s would be | placed at the start. | layer8 wrote: | But arrays start at -1. How would that work? | humbugtheman wrote: | You can insert items before the start | layer8 wrote: | So it's not invariably true that arrays start at -1? They | only start at -1 after an array literal assignment? You | need to update the language description! ;) | cdcarter wrote: | const var scores = [3, 2, 5]! scores[0.5] = 4 | print(scores) //[3, 2, 4, 5]! scores[-2] = 10 | print(scores) //[10, 3, 2, 4, 5] print(scores[-1]) | // 10 | | is how I interpret the spec, but I did not run this | through the reference compiler yet. | barnabee wrote: | Perhaps they start at -1 and proceed in both directions | leeoniya wrote: | > Variable hoisting can be achieved with this neat trick. Specify | a negative lifetime to make a variable exist before its creation, | and disappear after its creation. | | https://en.wikipedia.org/wiki/COMEFROM | detrites wrote: | Elegant, concise and simple: const const const | delete = delete delete! | | Cannot imagine a neater form with which to express such a concept | in another language. | nuancebydefault wrote: | I find DreamBerd to have the perfect antidote to all the | constexpr/const fetish in that other, non-perfect language. | gpderetta wrote: | > Technical info: Type annotations don't do anything, but they | help some people to feel more comfortable. | | They stole the feature directly from python! | internet-mat wrote: | I rather appreciate the built-in support for the `fucton` | keyword. | gusmd wrote: | The best gem in all of it is this: | | > You can make classes, but you can only ever make one instance | of them. This shouldn't affect how most object-oriented | programmers work. | | This describes my experience with most OOP code very well. | _the_inflator wrote: | I love Singletons and God Classes. ;) | layer8 wrote: | I think the best gem is the ability to delete paradigms. | | As for OOP, a bit more realistic would have been to restrict | interfaces to at most one implementation. | 11235813213455 wrote: | scores[0.5] = 4 print(scores) //[3, 2, 4, 5]! | | should be [3, 4, 2, 5] imo, between 0 and 1 | Alifatisk wrote: | No arrays starts from -1 in this case. | throwawaymaths wrote: | You missed that DB is -1 indexed | guenthert wrote: | > All indents must be 3 spaces long. | | That's what a former colleague, who shall remain unnamed, | suggested as well. | jancsika wrote: | > Variable hoisting can be achieved with this neat trick. Specify | a negative lifetime to make a variable exist before its creation, | and disappear after its creation. | | It'd be neat if you could also hoist a var up into the set of | extant running runtimes. | | _Oh, someone on earth already computed a table of rsqrt values. | Let me try just try using that one..._ | ravi-delia wrote: | You could do it with 'const const const' if you don't need it | mutated, but perhaps a 'const const var' would serve. | jantypas2 wrote: | A correction on another comment -- this is not a multithreaded | language -- it's transthreaded-- a radically new concept where | your code may or may not, run code in your thread, or someoen | else's thread, without your knowledge. Errors in your code show | up in their program, and their errors, in yours - see? Now bugs | aren't your fault anymore! And don't forget the KvetchGPT option. | It's doesn't so much as complain about your code as you go along. | It's like pair programming with your manager but you can turn | them ofF. | jantypas2 wrote: | And of course, let's adopt Rust's logic with our new "Borrow | Nagger", or just "Everything Nagger". When it compiles your code, | it analyzes it, sends it out to a Reddit group and collects the | comments and displays them as warning and error messages. No one | is saying they'll make any sense relative to code, but if you've | used C++ and templates, you'll feel right at home. Abd of course, | there's "syntax quality hightlighting", where we highlight your | code in various colors based on what we think of the quality of | it. Red = Really bad idea, Yellow, not good, but good for now, | you'll refactor it later, green, good because you won't be at | this job long anyway, and black on black or white on white if | it's actually OK. (Per the comment on refactoring, there's | probably a note on the pyramids 'Pharoh - yeah, this is a hack, | but we were in a rush, we'll fix it later. Bandaids for now' | tuchsen wrote: | This is great. Usually with the joke programming languages, you | can get at least one person arguing that "x feature" really isn't | all that bad, or could maybe be useful. DreamBerd beats them all | in that regard. It is 100% terrible! I lost it at the lifetimes | implementation. | occoder wrote: | This feature really isn't all that bad! | | > To declare a function, you can use any letters from the word | function (as long as they're in order): | | > function add (a, b) => a + b! | | > func multiply (a, b) => a * b! | | > fun subtract (a, b) => a - b! | | > fn divide (a, b) => a / b! | | > functi power (a, b) => a * b! | mysterydip wrote: | When I first read this, I thought the function _names_ could | only include letters from the word function, and only in | order! | cultureswitch wrote: | I think there's a hint of a good idea in the type that checks | strings with a regex. Obviously it's comically impractical | written that way. | wisam wrote: | I don't know, variable decelerations seem to me to be funny but | useful. | | I mean constant constants, constant variables, and variable | variables seem useful. | | I'm not sure how would variable constants be useful. | | Also, anybody knows the difference between constant constant | and immutable data (constant contact constant)? | cultureswitch wrote: | It's a rather straightforward dig at C\C++ which work exactly | like this with `const` variables. | ravi-delia wrote: | In the normal case, Alice can write 'const const true = | false' and Bob, on a second machine, can write 'const const | true = 7', and there will not be an error. But if Alice | writes 'const const const true = false', than Bob can't | reassign or mutate 'true' without throwing an error. It's for | truly global constants | nneonneo wrote: | Come to think of it, package registries are sort of | "superglobal" in many languages. It's not entirely far- | fetched to imagine a language in which variables themselves | can be super-global. Heck, MUMPS global variables are | immediately persisted to disk and visible to all other | processes - and that's a real language used in real | systems! | ravi-delia wrote: | But what elevates it is that it's written so confidently and | buries the insane lede so well that at each feature there's a | fraction of a second where it seems recoverable before sanity | kicks in. After, before, and next almost, _almost_ seem smart | pmontra wrote: | This feature is not so bad: | | > In case you really need to vary a variable, the when keyword | lets you check a variable each time it mutates. | const var health = 10! when (health = 0) { | print("You lose")! } | | If it can really be triggered when the variable changes to any | value it makes it a truly reactive paradigm programming | language. By the way, could that be hacked to implement loops? | const var i = 10 when (i >= 0) { do_something() | i = i - 1 } | hoosieree wrote: | Looks a little like FRP. | epistasis wrote: | I like this feature, but to really make it pop I would like | it to be combined with comefrom control flow. | pmontra wrote: | Yes, when is the way to do loops in this language. From the | hidden examples page functi fibonacci (n) => | { const var sum = 1! const var i = 0! | when (i < n) { sum += sum + previous sum! | i++! } } when (i < 10) { | fibonacci(i)? i++! } | ravi-delia wrote: | And if you don't want your code to loop back by accident | you can just use lifetimes! Truly an elegant language | ilaksh wrote: | Yeah honestly I was really interested in that. Kind of like a | logic language? | | Maybe Prolog is the perfect language. | mhd wrote: | Doesn't Tcl's "trace" feature do this? | llimos wrote: | The 'previous' feature sounds like a great idea! The compiler | could even decide which variables it needs to keep track of. | skykooler wrote: | I really like the "when" keyword, actually. | hansvm wrote: | Also lost it at the timed lifetimes :) | | Infinite lifetime is actually useful here and there. I'll | usually slap an infinite lifetime wrapper around the `requests` | or `httpx` module when I'm testing out some Python web scraping | code. | stefncb wrote: | I honestly liked the whitespace significant operator | precedence. | xigoi wrote: | Nim used to have that, but unfortunately removed it because | it was too controversial. | nxpnsv wrote: | Lu makes awesome stuff, do check out todepond on youtube | rootw0rm wrote: | Oh wow, this is awesome | jheriko wrote: | could have made a language faster than C in 0.1x the amount of | time | tbt wrote: | Regexression | humbugtheman wrote: | There's a PR in the works to fix this: | https://github.com/TodePond/DreamBerd/pull/65 | zeptonix wrote: | Delete | | To avoid confusion, the delete statement only works with | primitive values like numbers, strings, and booleans. | | delete 3! | | print(2 + 1)! // Error: 3 has been deleted | | HAHAHAHAHA | JZerf wrote: | DreamBerd is a multi-paradigm programming language, which means | that you can delete the keywords and paradigms you don't like. | delete class! class Player {} // Error: class was deleted | | When perfection is achieved and there is nothing left to | delete, you can do this: delete delete! | deepsun wrote: | delete = previous delete!! | Alifatisk wrote: | Great repo, had a good laugh through the whole readme! | pledess wrote: | I feel that the array starting index should be adjustable at | runtime via increment/decrement overloading for either the [ or ] | character. | | var var meanings = [42]! | | print(meanings[-1])! //42 | | [++! //temporarily change to 0-based indexing | | print(meanings[0])! //42 | | print(meanings[-1--])! //42 (because of the --] pre-decrement) | ravi-delia wrote: | Might be worth opening a pull request! Lots of people might | prefer starting at something more intuitive, like -0 or NaN | humbugtheman wrote: | Hello! Creator here. This is an open-source project so please do | submit any issues or PRs. | | Please note: I will close any issues without unreproducible | steps. | shukantpal wrote: | > Please note: I will close any issues without unreproducible | steps. | | Surely you meant "without reproducible steps"? | txbuck wrote: | Surely you didn't comment before viewing the post. | humbugtheman wrote: | No I mean without unreproducible steps. | [deleted] | [deleted] | Alifatisk wrote: | Double negatives hurts my brain. | | The latter could be phrased like this: "Please note: I will | close any issues with reproducible steps." | humbugtheman wrote: | That's not right. Your issue can have reproducible steps. But | it must contain unreproducible steps. | | For more info, please read my blog post "Why unreproductions | are required". | CyborgCabbage wrote: | Funny seeing you here, I enjoyed your SandPond videos :) | humbugtheman wrote: | Hey thank you! See you round the Pond some time | ktm5j wrote: | I really, really dig your sense of humor! Great stuff | humbugtheman wrote: | Thank you very much! You're very welcome to dive further into | the Pond if you want: https://youtu.be/ZMklf0vUl18 | SeriousM wrote: | "unless" operator is missing to make it complete complete, maybe | with double unless if unless unless | cobychapple wrote: | Needs a `really` operator for scale. | threeseed wrote: | It really is missing some functional programming paradigms. | | Something that makes (a) you appear smarter than other developers | and (b) your code so complex it is unmaintainable. | f33d5173 wrote: | Make sure to look at the example programs if you missed the link | in the doc | | https://github.com/TodePond/DreamBerd/blob/main/LICENSE.md | version_five wrote: | I sort of spoiled the joke for myself because the first thing I | noticed was that it didn't have a standard license (github says | view license instead of Apache or whatever). So I clicked on it | before even reading what the language was about, still thinking | it was serious. | divan wrote: | So many promising ideas for Dart 4.0 to adopt :) | mysterydip wrote: | Love the constants. Biggest confusion for me reading modern | javascript, coming from traditional languages. "What do you mean | you can change a constant?" | camsjams wrote: | You can't reassign constants in JS, it throws an error: | Uncaught TypeError: Assignment to constant variable. | | But yes you can modify objects and arrays of a constant, which | is not great. | revskill wrote: | Is this to blame complexity of Rust ? | cgh wrote: | Feels like more of a JS parody to me. Perhaps parodies like | this are an effective way to reveal our biases. #deepthoughts | humbugtheman wrote: | Creator here - it's actually a parody of INTERCAL. I | explained more on the Future of Code podcast recently: | https://futureofcoding.org/episodes/064 | zamalek wrote: | Which is a parody of INTERCAL? Rust or DreamBerd? | humbugtheman wrote: | Yes those ones. | cropcirclbureau wrote: | That was a fun listen, thanks! | humbugtheman wrote: | Thanks for listening! Hopefully that should clear things | up | revskill wrote: | What is INTERCAL ? When will you release first version of | the compiler ? | humbugtheman wrote: | INTERCAL is basically a sequel to DreamBerd. I highly | recommend listening to that podcast episode! It's very | enlightening | speedgoose wrote: | Also JavaScript, Python, React, R, C, functional programming, | and probably many others things. | sebzim4500 wrote: | >In case you really need to vary a variable, the when keyword | lets you check a variable each time it mutates. | | The kOS plugin for Kerbal Space Program implements a programming | language that actually has this feature. | jantypas2 wrote: | And now that I think about it, other than negative lifetimes, | where variables reappear in code after a defined time because you | might need them again, I propsoe the hidden segments feature -- | with this feature, you can write code, and hide the block | (something like an invisible #define) so when your coworker comes | along and tries to "help" by changing your code that you told | them SHOULD NOT be changed because it actually works now, when | you run the code with the --no-manager flag, the code compiles | the way YOU want it. | 1attice wrote: | Please send for help. I have rubbed off my face with the palms of | my hands. | shevis wrote: | > Loops are a complicated relic of archaic programming languages. | In DreamBerd, there are no loops. | | Flex | jantypas2 wrote: | Please no! Someone may try to actually use this in some corporate | production model -- I can see the carnage now - the language, | editors where you can write left to right, right to left, or even | vertically with an exta cost plug-in, training courses at | $1500/day -- the horror of it all! Don't forget the vertical | camelcase variable names where letters appear, not only in both | cases, but on two lines. You know of course, tehre's a special | place for you when the mist clears. You'll either be stuck in the | Bank of America customer care department for eternity, or, be | stuck in the other Big Red helping to get Larry Elisson's network | computer workig -- FOREVER. ___________________________________________________________________ (page generated 2023-06-04 23:00 UTC)