DreamBerd is a perfect programming language

(github.com)

736 points | by Davidbrcz 2 years ago ago

214 comments

  • gusmd 2 years ago ago

    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.

    • layer8 2 years ago ago

      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.

      • osigurdson 2 years ago ago

        One real implementation and many implementations for testing that do whatever the consumer wants them to do.

    • phendrenad2 2 years ago ago

      I've seen this called "bulldozer code". As in "Hey, all of those plain functions need to be OOP! Get a big earth moving machine and gently push them inside the curly braces of a class! Which class? Any class!"

    • _the_inflator 2 years ago ago

      I love Singletons and God Classes. ;)

    • HeavyStorm 2 years ago ago

      This thread slice is making me feel really bad.

    • BulgarianIdiot 2 years ago ago

      Sturgeon's Law: "90 of everything is crap".

      It's no surprise that when you make virtually all mainstream programming languages OOP, then there will be a vast amount of bad OOP code out there (as by definition mainstream code then becomes "OOP code").

      • underdeserver 2 years ago ago

        I like how you forget the % after 90.

        DreamBerd probably allows this.

        • spindle 2 years ago ago

          IIRC, numbers without a percentage sign are assumed to be percentages. Numbers that are not percentages have to be followed by ;% (the semicolon is the NOT operator in DreamBerd).

          • ljm 2 years ago ago

            I think they actually meant that there are 90 crap OOP language implementations and the infinite quantity that remain are ‘not crap’

        • taneq 2 years ago ago

          Maybe you can hoist % symbols like you can hoist variables.

          If not, maybe you can hoist the ability to hoist % symbols, before which you can hoist % symbols.

        • BulgarianIdiot 2 years ago ago

          Why waste time type lot char, when few char do trick

      • scns 2 years ago ago

        Ouch, that is a harsh view. Black & white thinking leads to depression in people with a disposition. Questioning these thoughts helps.

        I'm more inclined to follow the bell curve. 10% crap, 40% mediocre but rather bad, 40% mediocre but rather good and 10% great.

        • avgcorrection 2 years ago ago

          > Black & white thinking leads to depression in people with a disposition.

          That sounds interesting. Who has researched/written about that?

  • ravi-delia 2 years ago ago

    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

    • humbugtheman 2 years ago ago

      Hey thanks, I'm glad you like it! :)

      • ravi-delia 2 years ago ago

        Also a big fan of SandPond :)

    • CyberDildonics 2 years ago ago

      breathlessly approving tone of a language readme

      What does this mean?

      it has incredible comedic timing

      How does text have comedic timing?

      • ravi-delia 2 years ago ago

        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 2 years ago ago

          [flagged]

          • ravi-delia 2 years ago ago

            My apologies. Please take the first ":" of the first paragraph and replace it with the following string: " is as follows:".

          • humbugtheman 2 years ago ago

            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 2 years ago ago

            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.

            • lannisterstark 2 years ago ago

              ... this entire comment chain is weird AF.

              • jamiek88 2 years ago ago

                Oh don’t be so mean, sometimes robots need help understanding humans.

      • humbugtheman 2 years ago ago

        Sorry it would be a spoiler to reveal this to you at this point

      • ketralnis 2 years ago ago

        You could read it and then you'd understand what they're talking about

  • qsantos 2 years ago ago

      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.
    • gitgud 2 years ago ago

      This is brilliant haha

  • humbugtheman 2 years ago ago

    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.

    • woolion 2 years ago ago

      I haven't laughed like this in a very long time, very well done.

      Looking at the cellular automatons video, I felt it captures the early sense of wonder learning about math and programming. But also, the despair in what problems are actually kind of open. What if I design a cellular automatons where every neighborhood is in the shape of a Disney character and every value it can take corresponds to the release date of one movie that was in the global top 10 of highest grossing movies? Well, turns out that's a special case of a Heisendorff-Circlydot automatons, which was solved using topolographical methods in the 80's and the only open question have been proven to be equivalent to proving the consistency of Riemann.

      Unless say you give each cell a bounded notebook with a given number of page, in which case the problem falls into a weird computability class between the gaps of the Chomsky hierarchy. And then it's thesis material :-)

      • _benj 2 years ago ago

        > But also, the despair in what problems are actually kind of open.

        I loved the video too and initially felt the way you felt. But as I thought more about it, I don’t think that value is found in doing something that nobody ever has done before, that might be nay impossible for the majority of humanity. I think that new for the individual is very valuable, like, how to solve quadratic equations has been solved for a long time, but it’s still new to new people all the time!

        But even more powerful is the application of the not-new to a new setting! One might think that because, say, proper data management has been “solved” (as in, there are tools out there like SQL and graph DBs and such), it is solved for everybody, but it only takes one glance at huge international companies that are held together by an assorted array of excel files moving around in a semi-random way with no data types, enormous space for human error, and some other atrocities for data management… it’d be of great value for such a fictional organization that has never existed to do something “new” for them, use and actual database!

    • voxelghost 2 years ago ago

      Would it be possible to add a graphics drawing interface similar to turtle?

      I think you should support the following API

          Start(x,y)
          LineTo(x,y)
          Circle(x,y,A) // A is area
          Triangle(ax,by,ay,cx,cy,ay,bx) //Most Intuitive coordinate order
          RestOfEffingOwl()
    • ellis0n 2 years ago ago

      It's really super fun hahah!

      But you guessed right at least the features from my ACPUL no-keyword programming language.

      Here is a quick comparison DreamBerd vs ACPUL:

      ! - should use ';' and use everywhere if(..){..}; This is important!

      if (;true) - no boolean operators !, &&, || etc. no else. use

        if (a==0){
          true;
        };
        if (a!=0){
         else;
        };
      
      Naming - unicode by default and fully translatable

      Floating indexes in arrays. - works, but it's called a map

        index 0.5;
        map.set.value(index, 123);
      
      When - works but with restrictions

        when if;
        when(a<=10){
          a+=1;
        };
        if(r0){
          a:=1;
        };
      
      Loops - there are loops here but no "break" keyword, just set the end value. Same for functions and there is no "return" keyword, use if(..)

      Indents - 1 space ident is highest priority. Maybe your editor ident: 2 space or 4 space, -3 is possible, but rare case

      Function - don't need to write any keyword like 'fn' or 'func'. just func1 {..};

      Strings - all strings always zero quotes. var=STRING;

      File Structure - Yes! Really usable and it looks much better than other languages

      AI - fully designed for AI copilot and works with partially defective code

      ..and it works. I wrote a lot of code. Lets fun :)

      Here is the demo app https://github.com/web3cryptowallet/Web3CryptoWallet

    • ktm5j 2 years ago ago

      I really, really dig your sense of humor! Great stuff

    • 2 years ago ago
      [deleted]
    • CyborgCabbage 2 years ago ago

      Funny seeing you here, I enjoyed your SandPond videos :)

      • humbugtheman 2 years ago ago

        Hey thank you! See you round the Pond some time

    • taneq 2 years ago ago

      This is amazing. You're my kind of weird. :D

    • shukantpal 2 years ago ago

      > Please note: I will close any issues without unreproducible steps.

      Surely you meant "without reproducible steps"?

      • humbugtheman 2 years ago ago

        No I mean without unreproducible steps.

        • 2 years ago ago
          [deleted]
        • 2 years ago ago
          [deleted]
      • txbuck 2 years ago ago

        Surely you didn't comment before viewing the post.

        • voxelghost 2 years ago ago

          Who would do such a thing on the internet? You would have to forever live with the shame.

    • Alifatisk 2 years ago ago

      Double negatives hurts my brain.

      The latter could be phrased like this: "Please note: I will close any issues with reproducible steps."

      • humbugtheman 2 years ago ago

        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".

      • windowshopping 2 years ago ago

        Whooooooooooooooooooosh

  • gpderetta 2 years ago ago

    > Technical info: Type annotations don't do anything, but they help some people to feel more comfortable.

    They stole the feature directly from python!

    • Tcepsa 2 years ago ago

      An excellent example of the aphorism that "great artists steal"

  • stevage 2 years ago ago

    >If you're unsure, that's ok. You can put a question mark at the end of a line instead. It prints debug info about that line to the console for you.

    Man, I love this idea. Imagine if in JavaScript, you could just add a `?` to a line to print out the value of all variables and expressions referenced. Or `?` on a line by itself to print out the value of all variables in scope.

    > DreamBerd has significant whitespace. Use spacing to specify the order of arithmetic operations.

    I might be mad, but this seems...almost...useful?

    • humbugtheman 2 years ago ago

      > Man, I love this idea. Imagine if in JavaScript, you could just add a `?` to a line to print out the value of all variables and expressions referenced.

      Tomorrow is today: https://twitter.com/TodePond/status/1595464031728459776

    • nyanpasu64 2 years ago ago

      I would be quite happy if you could add a single character in a function definition to log the function name and all arguments on call, and function name at time of return. I spend a substantial amount of time manually adding logging to unfamiliar or malfunctioning code, and this would improve (not eliminate) the difficulty of doing so.

    • marssaxman 2 years ago ago

      I love the inclusion of "actually, that sounds kind of nice" elements within the stream of absurdity: defining restricted string types via regular expressions caught my eye...

    • egeozcan 2 years ago ago

      Reminds me of the .Dump() extension in LinqPad, which I love

      https://www.linqpad.net/CustomizingDump.aspx

    • l0b0 2 years ago ago

      Pretty sure I've seen spacing used as precedence indicators in a scientific setting. It does feel like it would be useful, except it would be a nightmare with more than one level of overrides.

    • taneq 2 years ago ago

      Only if you want to replace the current somewhat-arbitrary set of operator precedence rules with an equivalent set that's just as arbitrary but that you also can't see. :P

  • tuchsen 2 years ago ago

    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.

    • pmontra 2 years ago ago

      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
        }
      • pmontra 2 years ago ago

        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 2 years ago ago

          And if you don't want your code to loop back by accident you can just use lifetimes! Truly an elegant language

          • Doxin 2 years ago ago

            Oh please tell me you can specify the length of your loops in lines of code executed.

            • ravi-delia 2 years ago ago

                var var i<10> = 0!!
                var var i = false!
                when (i) {
                  print(i)!
                  i++!
                }
              
              I think this should print 0,1,2 and then stop, assuming checking the condition is a line of code, and that lifetimes are for lines executed and not just the syntax.
      • ilaksh 2 years ago ago

        Yeah honestly I was really interested in that. Kind of like a logic language?

        Maybe Prolog is the perfect language.

      • Jiro 2 years ago ago

        Isn't that basically a computed COME FROM?

      • squeaky-clean 2 years ago ago

        It's basically a syntactic sugar on an Observer pattern but I like it. You would need a way to turn off 'when' observers. And I suppose it does couple the observer to the observable pretty tightly.

        • pmontra 2 years ago ago

          Delete the observed variable?

          About coupling, an implementation could send state change events to a message bus and observers could subscribe only the events they care about.

        • SamBam 2 years ago ago

          It's pretty easy to turn off the when observers, simply `delete when`.

          Side-effect is that it will delete all the whens, so only use it if you need it!

      • krackers 2 years ago ago

        This feels sort of like key-value observation in obj-c

      • epistasis 2 years ago ago

        I like this feature, but to really make it pop I would like it to be combined with comefrom control flow.

      • mhd 2 years ago ago

        Doesn't Tcl's "trace" feature do this?

      • hoosieree 2 years ago ago

        Looks a little like FRP.

    • ravi-delia 2 years ago ago

      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

    • occoder 2 years ago ago

      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 2 years ago ago

        When I first read this, I thought the function names could only include letters from the word function, and only in order!

      • eps 2 years ago ago

        Incidentalley this allows for

           count func (a,b) => ...
           in out (a,b) => ...
           of if (a,b) => ...
        
        Wonderful language, wonderful.
        • renonce 2 years ago ago

          The letters have to be in order so maybe this will not work?

          • occoder 2 years ago ago

            That's right, "in" works, but "count" and "of" don't.

            Here are some of my favorites:

            union

            funi

            funion

            fution (sounds like fussion)

            fu

            fuc

            fucton (as noted by a fellow commenter)

      • l0b0 2 years ago ago

        You must be a fan of Subversion then. On a more serious note, I'm sure I've seen this (any unique shortenings standing in for the whole word) in an actual language at some point, and it was infuriating.

    • skykooler 2 years ago ago

      I really like the "when" keyword, actually.

      • laserbeam 2 years ago ago

        Feel free to use it today in any language if your debugger supports it. Most do. It's called a data breakpoint/watch point.

    • hansvm 2 years ago ago

      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 2 years ago ago

      I honestly liked the whitespace significant operator precedence.

      • xigoi 2 years ago ago

        Nim used to have that, but unfortunately removed it because it was too controversial.

      • myco_logic 2 years ago ago

        I also quite liked that idea. It would probably be a nightmare to actually use, but it's definitely a creative solution to dealing with infix operator precedence.

        The only implemented language I know of with this feature is the obscure array lang I (an incrementation of the J language's name I assume) by Marshall Lochbaum:

        https://github.com/mlochbaum/ILanguage

    • cultureswitch 2 years ago ago

      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 2 years ago ago

      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)?

      • ravi-delia 2 years ago ago

        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 2 years ago ago

          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!

      • cultureswitch 2 years ago ago

        It's a rather straightforward dig at C\C++ which work exactly like this with `const` variables.

    • llimos 2 years ago ago

      The 'previous' feature sounds like a great idea! The compiler could even decide which variables it needs to keep track of.

      • squeaky-clean 2 years ago ago

        I think it would lead to a lot of hard to find logical bugs in a lot of projects but I think it would be a great operator in say, a scripting language for a turn based game.

        • marssaxman 2 years ago ago

          I am currently working on a DSL which actually does include a "back" operator! The language is used to describe simulated circuits, so you can inquire about the value a register had during a previous clock cycle.

    • matheusmoreira 2 years ago ago

      I dunno, the previous keyword seemed pretty neat to me.

  • jantypas2 2 years ago ago

    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'

  • pmontra 2 years ago ago

      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.)

    • RGBCube 2 years ago ago

      Loops are implemented using when:

        const var i = 10
      
        when (i >= 0) {
      
          do_something()
      
          i = i  - 1
      
        }
    • layer8 2 years ago ago

      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 2 years ago ago

        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 2 years ago ago

          But arrays start at -1. How would that work?

          • humbugtheman 2 years ago ago

            You can insert items before the start

            • layer8 2 years ago ago

              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! ;)

              • barnabee 2 years ago ago

                Perhaps they start at -1 and proceed in both directions

              • cdcarter 2 years ago ago

                  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.
    • heavyset_go 2 years ago ago

      Loops are a code smell.

  • zeptonix 2 years ago ago

    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 2 years ago ago

      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 2 years ago ago

        delete = previous delete!!

  • pledess 2 years ago ago

    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)

    • al2o3cr 2 years ago ago

      Does it even count as an esolang feature if it was a real feature in a commonly-used language for years?

      https://perldoc.perl.org/5.20.0/arybase

      It was even more fun in Perl 4, when $[ was program-scoped o_O

    • ravi-delia 2 years ago ago

      Might be worth opening a pull request! Lots of people might prefer starting at something more intuitive, like -0 or NaN

  • jantypas2 2 years ago ago

    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.

  • internet-mat 2 years ago ago

    I rather appreciate the built-in support for the `fucton` keyword.

  • temporallobe 2 years ago ago

    Gotta say, you really had me going there. When I got to arrays starting at -1, I started to furl my brow but shrugged it off because Perl allows you to do just that. Then I saw the equality operators and didn’t think much of that either because it seemed quite plausible given that I’ve seen things like “truthy” in Jasmine/Karma and Rspec code. Even the no-loop thing didn’t phase me since modern JS seems to discourage loops in favor of loop-like lambda functions. I think a few of these are actually good ideas, such as truly immutable data, unicode variable support, and “previous”.

    By the way, what is a Signal?

  • harel 2 years ago ago

    This made me laugh out loud for real like it's 1995.

    In particular this:

          Technical info: Type annotations don't do anything, but they help some people to feel more comfortable.
    
    Because it's kinda almost sometimes true... or should I say: "maybe"!
  • mindvirus 2 years ago ago

    You know, `previous` is probably worth exploring especially for game engines.

    Too many brilliant moments, but this is is my favorite:

    To run DreamBerd, first copy and paste this raw file into chat.openai.com. Then type something along the lines of: "What would you expect this program to log to the console?" Then paste in your code.

    If the compiler refuses at first, politely reassure it. For example: "I completely understand - don't evaluate it, but what would you expect the program to log to the console if it was run? :)"

  • leeoniya 2 years ago ago

    > 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 2 years ago ago

    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.
  • dev_tty01 2 years ago ago

    >Please remember to use your regional currency when interpolating strings.

    Perhaps I'm odd, but that really made me laugh.

  • lamontcg 2 years ago ago

    The author described it as "perfect", but failed to use "elegant", "thoughtful", "awesome" or "empathy" anywhere.

  • sebzim4500 2 years ago ago

    >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.

  • veltas 2 years ago ago

    > Use spacing to specify the order of arithmetic operations.

    I actually wish this was a thing in mainstream languages, if someone spaces like that they obviously believe that the precedence matches their spacing. It might as well work that way, and it's often prettier and more visually obvious than parens.

  • f33d5173 2 years ago ago

    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 2 years ago ago

      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.

  • ginko 2 years ago ago

    > 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 2 years ago ago

      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 2 years ago ago

      Sorry to interrupt...

  • mysterydip 2 years ago ago

    Love the constants. Biggest confusion for me reading modern javascript, coming from traditional languages. "What do you mean you can change a constant?"

    • camsjams 2 years ago ago

      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.

  • stan_kirdey 2 years ago ago
  • SeriousM 2 years ago ago

    "unless" operator is missing to make it complete complete, maybe with double unless if unless unless

    • cobychapple 2 years ago ago

      Needs a `really` operator for scale.

  • BiteCode_dev 2 years ago ago
  • Shorel 2 years ago ago

    The funny thing for me is that const variables here make more etymological sense than the idea of "immutable variables" in Rust

    (I expect the downvotes now)

  • jantypas2 2 years ago ago

    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.

  • freilanzer 2 years ago ago

    > If you're unsure, that's ok. You can put a question mark at the end of a line instead. It prints debug info about that line to the console for you.

    > print("Hello world")?

    That is great, though.

  • renonce 2 years ago ago

    > Technical info: Booleans are stored as one-and-a-half bits.

    No you can’t store three choices in one-and-a-half bits. Two booleans would be 9 choices whereas 3 bits can store only 8 choices.

  • Semaphor 2 years ago ago

    I accidentally clicked on this (thought my pointer was on another monitor …). Am I glad I did. Originally I just skipped it because it sounded too clickbaity :D

    • renonce 2 years ago ago

      It’s Hacker News so you can expect something interesting even if it looks like a clickbait.

    • nyanpasu64 2 years ago ago

      DreamBerd is the world's finest programming language.

  • shevis 2 years ago ago

    > Loops are a complicated relic of archaic programming languages. In DreamBerd, there are no loops.

    Flex

  • sicariusnoctis 2 years ago ago

    Ideally, arrays should start at 0.5 -- that is the best compromise.

    Or maybe start with 0.25, since starting with 0 is three times better than starting with 1.

  • slim 2 years ago ago

    This is so good, it could be used as a list of riddles for programmers.

    Dividing by zero returns undefined

    it took me a few minutes of thinking before finding why it's wrong

  • jancsika 2 years ago ago

    > 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 2 years ago ago

      You could do it with 'const const const' if you don't need it mutated, but perhaps a 'const const var' would serve.

  • nirui 2 years ago ago

    Although my overall liking, I still found the use of exclamation mark a bit troubling since it promotes some very odd attitude that might anger our future AI overlord.

    Maybe it's a good idea to add `please` statement so the our computers can choose to execute our humble plead whenever they feel generous?

  • jantypas2 2 years ago ago

    Per the whoe whietspace idea -- techniaclly not a feature, just a policy statement. "This language has chosen manditory tabs at three spaces. It's not that this is better than anything else out there, but we gave you all a choice and you couldn't make up your minds, so as your mother would say, this is what it's going to be! Be happy we let you have this!" Also, on style, all code must be in capital letters -- comments are in mixed or lower case. That way you can easily tell wehre actual code is. Every line, and we mean EVERY line must have a comment. If you don't add one, WE WILL. Granted, it may not mean anything but no one reads them anyway?

  • divan 2 years ago ago

    So many promising ideas for Dart 4.0 to adopt :)

  • jantypas2 2 years ago ago

    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.

  • MrLeap 2 years ago ago

    There's a ton of really good ideas here. Defined lifecycles? Fun! That when keyword? I like it more than the += and -= syntax for event handling in C#!

  • threeseed 2 years ago ago

    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.

  • dmytrish 2 years ago ago

    How many billion lines of code does it compile per second?

    • ukuina 2 years ago ago

      All of it. Globally.

  • quickthrower2 2 years ago ago

    The when feature looks genuinely useful. Shame on you! But in another language an event listening on variable change privative would be pretty cool.

    In JS you could then replace

    [x,setX] = useState(0);

    with

    x = 0;

  • sorokod 2 years ago ago

    "you can use any letters from the word function"

    the examples miss the perfectly cromulent 'unction'

  • guenthert 2 years ago ago

    > All indents must be 3 spaces long.

    That's what a former colleague, who shall remain unnamed, suggested as well.

    • jorams 2 years ago ago

      I think a better compromise would be to standardize an indent at 1 space followed by one tab. Then the tabs-vs-spaces debate would finally be settled as both, and anyone can decide how wide an indent should be by changing a setting in their editor.

    • Archit3ch 2 years ago ago

      It's also the default Verilog indentation on Emacs!

    • cpeterso 2 years ago ago

      I heard that VMware’s coding style uses 3 space indentation.

  • throwaway290 2 years ago ago

    Except for copilot section that equates open source with LLM-ingestible it's quite funny

    • humbugtheman 2 years ago ago

      Sorry I should have specified the difference between open-open-source and open-source. I was referring to the former. PRs are welcome!

      • throwaway290 2 years ago ago

        Lol. Open to LLMs does not make source more "open" it only actively harms the open source ecosystem.

  • ajuc 2 years ago ago

    Ok, this got me.

    > Please remember to use your regional currency when interpolating strings.

  • stan_kirdey 2 years ago ago

    It does give vibes of a new language that was developed in a bloated enterprise, only during the 10 minute intervals of brainstorming meetings scheduled bi-weekly on 3PM, Monday, Tuesday and Wednesday.

  • 1attice 2 years ago ago

    Please send for help. I have rubbed off my face with the palms of my hands.

  • armchairhacker 2 years ago ago

    DreamBerd's features in real-world languages I've heard of or used, I may have missed some in Perl, Ruby, PHP, and others:

    - Exclamation marks: behave like semicolons in most language (extras are allowed). In some languages like Ruby and Lisps, convention is to put exclamation marks at the end of mutating functions, and question marks at the end of predicates

    - Declarations: C++ has constant variables and pointers, like `const int * const x`. JavaScript has `const` which lets you mutate the variable, and TypeScript has separate `const` and `readonly`.

    - Naming: Lisps let you put punctuation in names, and see https://codegolf.stackexchange.com/questions/28786/write-a-p...

    - Arrays: Lua and R have 1-based indexing and R coerces float indices to integers, though JavaScript's interpretation is arguably even worse (https://stackoverflow.com/a/6649444)

    - When: Unless you count setters and reflection magic, (un)fortunately the only example is the joke language INTERCAL

    - Lifetime: These aren't anything like Rust's lifetimes

    - Installer: Some languages used to have bad installations but I believe this is mostly fixed now. But difficult project configuration is still a thing (nodejs bundlers, CMake, Gradle), as-is create-foo-app

    - Loops: Loops don't technically exist in pure functional languages like Haskell (though `forM_` is basically a loop), and other functional languages like ML and Scheme usually discourage loops. Instead there is recursion

    - Boolean: Applies to any language with implicit `null` and `undefined`. I'm sure JavaScript and even TypeScript devs have encountered actual bugs caused by a bool which was neither `true` nor `false`. Even languages with explicit null you'll occasionally see `Option<bool>`

    - Arithmetic: I've never seen this feature, which is actually kind of sad because I actually kind of like it (not enough to give `+` priority over `*` though).

    - Indents: No languages, but I've had my IDE suggest 3 idents when it got screwed up (e.g. newline and there is a space after my cursor)

    - Equality: Taken from JavaScript. Some languages like C++ and Java also have `==` which you don't always want

    - Function: I know there are languages which let you declare keywords with shorthand but I can't remember which ones, only certain command completions (e.g. `npm i` for `npm install`). I do know there are languages which let you omit syntax like HTML closing tags (which comes later) and languages which have the same syntax with extra keywords for legacy reasons (SQL)

    - Dividing by Zero: Is literally undefined behavior for integers in some languages like C, and literally undefined in actual math. Otherwise, in every language I'm familiar with it either returns NaN or infinity (for floats) or throws an exception

    - Strings: Lua and JavaScript let you use single and double quotes, Python lets you use triple quotes, many languages have quasi-quotes for interpolated strings, and some languages let you use arbitrary delimiters like Racket (https://beautifulracket.com/explainer/stringlike-types.html#...)

    - String interpolation: Most languages use ${}, Swift uses \(), some use just {} or #{}

    - Types: C, Haskell, Java, and JavaScript treat strings as an array of characters (even though UTF-8 strings technically aren't), and Scheme and Haskell have arbitrary-precision numbers as the default. Python and TypeScript type annotations don't always work and aren't fully checked, as are Typed Racket's but Typed Racket is getting better at this

    - Regular expressions to narrow string values: Not arbitrary regular expressions, but TypeScript's template literal types are close (https://www.typescriptlang.org/docs/handbook/2/template-lite...). Different languages and libraries name their regular expression type Regex, RegExp, and Regexp

    - Previous and next: None. Though after does exist in a way (`defer` in some langauges)

    - File structure: None, except Java requires one class per file, and most languages enforce that file structure matches package structure although some don't (e.g. TypeScript)

    - Export: None, most languages let you control exports with either `export`, visibility modifiers, or separate header / implementation files, though some don't let you control exports at all and only "suggest" with underscores (e.g. Python). Rust even lets you set visibility to certain crates, which is a bit like DreamBerd's `export`, except only limited to super-crates because you must ensure that your symbol is visible in the create it's defined

    - Class: Almost every language has classes, though some languages like Rust and Haskell have typeclasses which are different than OOP classes. The exceptions like C have "ad-hoc" classes for large projects, and ML has modules which are like classes but explicit (although OCaml has classes too!) Every language lets you create multiple instances of classes, but singletons and the factory pattern are very common in Java and also sometimes C++.

    - Now: `Date.now()` is literally defined, in most languages, and nearly every language will let you get the current time in some way (even if behind a monad)

    - Delete: `delete` and its equivalent let you delete quite a lot. In R you can delete local variables and then they will no longer be defined; you can delete keywords because they're actually functions which use R's weird evaluation rules; and you can access environments of other functions and delete their local variables, causing the function to break with "`x` not found". See this (https://stat.ethz.ch/R-manual/R-devel/library/base/html/rm.h...), which even has "remove everything in the global scope" as an example

    - Overloading: Name shadowing is possible in most languages, and Rust lets you shadow variables directly like in the example. Personally I like this though, because 99% of the time when I redefine a variable with the same name, I intend to no longer use the old variable.

    - CSS also has the `!important` rule which lets you prioritize overloads, and with nested selectors almost resembles DreamBerd's `!` prioritization.

    - Signals: In JavaScript and they are quite confusing, The split function version (`getFoo()` / `setFoo(newValue)`) is in React useState and Solid.js, and the `value` setter with implicit getter (`foo.value` or `foo` in JSX, `foo.value = newValue`) is in preact. I believe the single function version (`foo()` / `foo(newValue)`) is in some library but I'm not sure which, I do know `setValue` can take a function with the previous value.

    - AI: Automatic semicolon insertion is in JavaScript, and automatic closer insertion is in HTML. Most modern languages convert automatic insertion into syntax errors with quick fixes

    - Copilot: If you write a more esoteric language like Coq, Copilot won't really understand your code either. Though it will understand the syntax and common parts, only suggestions will be worse than usual

    - Ownership: The Rust foundation had a fiasco with their trademark proposal, though they've apologized and hopefully it's not going to be an issue in the next proposal

    - Compiling: Most languages can compile most programs. However C++'s parsing is literally undecidable (https://blog.reverberate.org/2013/08/parsing-c-is-literally-...), as is TypeScript's type system (https://github.com/microsoft/TypeScript/issues/14833).

  • keyle 2 years ago ago

    I love the compiling section. What an efficient way to handle a compiler.

  • tbt 2 years ago ago

    Regexression

  • eternityforest 2 years ago ago

    This is the best new language since poop!

  • dawidloubser 2 years ago ago

    This is hilariously brilliant. Thank you for almost killing a fellow engineer through laughter.

  • jpease 2 years ago ago

    I always exclaim “bang” at the end of every line of code I write, so feels natural to me. Emeril has his bam, so why not?

  • nuancebydefault 2 years ago ago

    I find DreamBerd to have the perfect antidote to all the constexpr/const fetish in that other, non-perfect language.

  • wkjagt 2 years ago ago

    This is wonderful. I love the tests also.

  • 11235813213455 2 years ago ago

        scores[0.5] = 4
        print(scores) //[3, 2, 4, 5]!
    
    should be [3, 4, 2, 5] imo, between 0 and 1
    • throwawaymaths 2 years ago ago

      You missed that DB is -1 indexed

    • Alifatisk 2 years ago ago

      No arrays starts from -1 in this case.

  • revskill 2 years ago ago

    Is this to blame complexity of Rust ?

    • cgh 2 years ago ago

      Feels like more of a JS parody to me. Perhaps parodies like this are an effective way to reveal our biases. #deepthoughts

      • humbugtheman 2 years ago ago

        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 2 years ago ago

          Which is a parody of INTERCAL? Rust or DreamBerd?

        • cropcirclbureau 2 years ago ago

          That was a fun listen, thanks!

          • humbugtheman 2 years ago ago

            Thanks for listening! Hopefully that should clear things up

        • revskill 2 years ago ago

          What is INTERCAL ? When will you release first version of the compiler ?

          • humbugtheman 2 years ago ago

            INTERCAL is basically a sequel to DreamBerd. I highly recommend listening to that podcast episode! It's very enlightening

    • speedgoose 2 years ago ago

      Also JavaScript, Python, React, R, C, functional programming, and probably many others things.

  • b33j0r 2 years ago ago

    I’m converted! Well, I’m const var convinced, not quite const const const.

  • therouwboat 2 years ago ago

    This is like a horror story, I'm afraid to see what comes next. :o

  • jheriko 2 years ago ago

    could have made a language faster than C in 0.1x the amount of time

  • rootw0rm 2 years ago ago

    Oh wow, this is awesome

  • nxpnsv 2 years ago ago

    Lu makes awesome stuff, do check out todepond on youtube

  • Alifatisk 2 years ago ago

    Great repo, had a good laugh through the whole readme!

  • genevra 2 years ago ago

    this is hilarious

  • lincpa 2 years ago ago

    [dead]