[HN Gopher] Thoughts on Hare
       ___________________________________________________________________
        
       Thoughts on Hare
        
       Author : pcr910303
       Score  : 30 points
       Date   : 2022-04-25 15:32 UTC (7 hours ago)
        
 (HTM) web link (tilde.team)
 (TXT) w3m dump (tilde.team)
        
       | Georgelemental wrote:
       | > In all the languages I know of, you can't break out of a loop
       | from an inner loop.
       | 
       | Rust has this feature: https://doc.rust-lang.org/rust-by-
       | example/flow_control/loop/...
        
         | Jtsummers wrote:
         | As do Java, Common Lisp, Ada, Javascript, and probably a lot of
         | others. Breaking from inner loops is a common thing and having
         | to use special condition variables is error prone, in
         | comparison, and potentially more time intensive. Labeled loops
         | let you keep the premise of goto-less programming in structured
         | programming while permitting a weakened jump-to-label (the
         | program can't jump from _anywhere_ to that label, only in the
         | context of the loop). Since they aren 't (usually) able to be
         | used from other arbitrary points you still get the cleaner
         | control flow that structured programming promotes.
        
           | ratrocket wrote:
           | I was writing a (less informed!) sibling comment at the same
           | time.
           | 
           | Great observation that I hadn't considered: what I called a
           | "labeled break" or "continue" is safer than bare goto since
           | you can't jump from _anywhere_ to _anywhere_.
           | 
           | Thanks for making that plain!
        
         | ratrocket wrote:
         | Unless I'm misunderstanding the mechanism (jumping to a label,
         | right?), I thought most (well, lots of) languages supported
         | this. Go does also:
         | 
         | A non-minimal example using continue (but you can also break):
         | https://go.dev/play/p/mEyEqcEYvcK
         | 
         | The spec: https://go.dev/ref/spec#Labeled_statements
         | 
         | It's just goto..? And despite "considered harmful", lots of
         | languages have goto.
         | 
         | There are some things for which goto (or labeled
         | break/continue) really are the best way to do what you need.
         | 
         | (I can't shake the feeling I'm missing something really obvious
         | here!)
        
       | tsuujin wrote:
       | > Because of that, I'm going to ask you, dear reader, to please
       | respect Drew's wishes and not share this post in any public
       | space. This page is "unlisted" and won't appear on the frontpage,
       | and I only intend to share this with those who are already aware
       | of Hare. If you, due to IRC logs, public GitHub repositories, or
       | cosmic rays, find this page, kindly keep it to yourself.
       | 
       | Hmm.
        
         | pcr910303 wrote:
         | FYI: The language was released a few hours ago.
        
           | ncmncm wrote:
           | And, that blog post was overwhelmingly more informative than
           | the announcement.
        
       | UncleEntity wrote:
       | > ... a technique called "subtyping" is used, where struct B,
       | who's first member is a struct A, is cast as that struct A to
       | properly conform to an interface. It's supposedly common in C
       | (that's what I was told in #hare, anyway), though this is the
       | first time I'm encountering it.
       | 
       | How much C have you looked at if you've never seen that pattern
       | (or 'story', not up on the lingo)?
       | 
       | Is there another way to do this I'm not aware of because it's so
       | common I thought it was just common.
       | 
       | --edit--
       | 
       | Thinking about this for a minute there's another 'story' where
       | you use the least significant bit(s) as a tag and use that to
       | differentiate between object types but that is definitely not too
       | common, this hextree library I found somewhere uses it to tell a
       | leaf from a branch and I'm really tempted to just replace it with
       | the previously mentioned 'subtyping'.
        
       | bawolff wrote:
       | Project is "secret" pre-alpha, not yet done... and the person is
       | complaining that docs and tutorials aren't fully polished.
       | 
       | Seems like a trite complaint. docs (let alone polished) is not
       | something you usually expect from pre-alpha software.
        
       | nwmcsween wrote:
       | With regards to the no functional programming, functional
       | programming aspects make code less buggy for doing standard
       | things. Sure functional programming isn't as explicit as a 5
       | layer dip of for loops but to me less code equals less bugs and
       | functional programming doesn't entail more abstractions, in fact
       | it could mean less abstraction.
        
       | jolux wrote:
       | Supports only Linux and a bunch of other Unix-likes in the long
       | tail that almost nobody uses, no generics, similar philosophy to
       | Zig but without the interesting async stuff and comptime. It's
       | not clear to me why people keep doing this. Why wouldn't you just
       | take C and remove the footguns if you think that's all that needs
       | to be done? Seems like it would have much better chances of
       | adoption.
        
       ___________________________________________________________________
       (page generated 2022-04-25 23:02 UTC)