Better HN
topnewbestaskshowjobs
Log inSign up

evincarofautumn

4,810 karma · joined Mar 18, 2011 (15y ago) · 1,621 submissions

A programming language technologist, or something like that.

https://github.com/evincarofautumn

http://evincarofautumn.blogspot.com/

evincarofautumn@gmail.com

Submissions

comment 5y ago · link · parent

Wow, I honestly wonder if this was caused by mixing up “functor” in the C++ and Haskell senses…

To expand on that, for those in the audience:

In Haskell, a functor is a type constructor (like “list”, “optional”, “future”, “I/O request”, &c.) with a way to map a function over it, covariantly, in a way that preserves its structure—i.e. without changing the shape of the container or structure of the action represented by the constructor, just the contained elements or produced result.

This is based on the more general notion of a functor in mathematics, which is a mapping between categories. The Haskell version is much more constrained, though: it only maps between Haskell types, and it’s parametric (iow completely generic), not just any old mapping.

While in C++, a functor is a completely different thing: an object that can be called like a function. It’s thus equivalent to a closure, where the object fields are the captured values. And that sounds like the description being used here.

comment 6y ago · link · parent

Cool, thanks!

I’m thinking about a similar sort of coercion system for a language project, and it’s good to have a slightly broader view of the design space. This area hasn’t been very well explored yet, not just in terms of semantics, but also developer ergonomics: most of the time you want to hide representations for convenience, but when considering safe coercions, you really want to make it possible to talk about them explicitly & precisely.

This feature is also very subtle, and right at the very edge of the type system, so it’s extremely easy to break soundness here, usually by failing to consider things like variance. The reason “roles” were added to GHC in the first place isn’t just because of the issue with type families / associated types mentioned in that RFC; it’s also because anything that provides a safe API atop unsafe internals could also be used to violate soundness, especially in conjunction with mutation. The classic examples are: 1. coercing “container of A” to “container of B” using the coercion from A to B, then inserting a B that is not a valid A, either in its value or just because A and B have incompatible trait instances (like ordering or hashing). You need to be able to disallow conversions between things even if they have identical representations.

comment 6y ago · link · parent

Has there been any work in Rust on something like Haskell’s ‘Coercible’? Namely, it defines the precise criteria for safe zero-cost coercions between types that provably have the same representation, and derives the coercions automatically. It guarantees that ‘coerce’ is identical to ‘fmap coerce’, which saves the cost of that exact traverse+reconstruct pattern to change out a phantom type parameter.

There are some deficiencies, most prominently that the “role” system is aggressively monomorphic, so you can’t always prove that two things are coercible—the compiler must conservatively assume that type parameters with unknown roles cannot be coerced—but overall it’s much better than what we had before, and I expect it’ll continue to improve.

comment 7y ago · link · parent

I would love to use it for my compiler backend…if I could find any maintained standalone implementations of it.

comment 7y ago · link · parent

This is also exactly how male countertenor singers produce a female-sounding voice, by making the vocal cavity smaller to adjust the formants upward. If you don’t do that, it just sounds like a male head voice or falsetto.

comment 7y ago · link · parent

I have an extremely strong sense of smell, inherited from my mother. Both of us are able to detect smells at lower concentrations and identify them more accurately than almost anyone else I know. My partner has told me that there are many things she didn’t even realise had a smell until I pointed it out—she is not anosmic, because she could recognise the smell after I drew her attention to it, as long as it has a high enough concentration. I have identified people I know by smell (who left their sweater behind at the party?), detected someone slicing cucumbers or celery a few rooms away, can identify what the neighbours are cooking, have pinpointed the location of certain types of ant nest, and more. If anyone is studying smell and wants to use me as a guinea pig, feel free to get in touch! I also have synaesthesia, which may play a role in how I process smells, but it seems to be mainly a physical thing.

comment 7y ago · link · parent

Of course, the definition we actually use is this:

    -- (1)
    fix f = let x = f x in x
Because it has better memory usage; the definition you provided is translated to the following STG:

    -- (2)
    fix f = let x = fix f in f x
So whereas #1 is a thunk that refers to itself, #2 is a recursive function, and importantly not tail-recursive.

comment 8y ago · link · parent

My working model for why colours admit description more readily than smells is that we judge and decompose them in largely the same way, but it’s simply easier to develop a repertoire of colours. They’re everywhere, most people have decent colour vision, and someone can point to them and tell you what they are in relative isolation.

Whereas smells (and tastes) are much more diverse, and rarely pure, isolated chemicals but more often complex profiles of many different compounds.

A common way that people develop a repertoire of smells is through cooking: now that I have some experience with many different ingredients and styles, I can now readily tell what went into a dish and how I might replicate it, describe new tastes in terms of old ones, and imagine new flavour combinations and how they would work together.

Chemistry offers another angle—if you know what I mean by “indolic” then you can probably conjure a mental image of exactly the heavy musk I’m referring to, but you probably have no clue if you haven’t experienced it and been told that that’s what you’re experiencing. You can add specific chemicals to your repertoire of smells.

A similar thing seems to hold for recreational drug experiences. If someone has had many different drugs before, especially drugs with similar pharmacodynamics that operate on the same receptors, it’s relatively easy to give them the gist of what something is going to feel like by reference to similar experiences. If they haven’t, there’s only so much you can do to prepare them for what is going to be a novel experience.

comment 8y ago · link · parent

> It basically combines futuristic tech with dystopian/utopian elements, and grimy, old-world stuff.

In other words, “The future is already here—it’s just not very evenly distributed” — William Gibson.

And it will probably always be that way, not just in terms of global inequality, but even in a single person’s life: you might be among the billion or two people living as humans have lived for thousands of years, on subsistence agriculture and herding with no running water, but you also have a smartphone and can video-chat with your cousins across the world. That aspect of cyberpunk storytelling is just taking this fact of existence and amplifying it to draw attention to it.

comment 8y ago · link · parent

What can we do as individuals? I already eat relatively little in the way of animal products, don’t drive much, don’t use a lot of electricity or natural gas at home…but one person behaving this way isn’t enough. The only way I see us fixing this is through enormous collective action: holding to account the top 100 companies who together are responsible for 71% of GHG emissions, completely phasing out gasoline-burning vehicles, taxing the hell out of fossil fuels and emissions including methane from industrial farms, powering electric vehicles with renewable/nuclear power, decommissioning coal power plants, investing in dense walkable/bikeable cities and high-quality public transportation, and investing in carbon sequestration tech.

I’m scared and I feel so powerless because of the sheer scale of the problem, and how a lot of people don’t even believe in the problem. It’s paralysing me.

comment 8y ago · link · parent

> Does Facebook own your IP?

No, afaik it should still be owned by the startup incubator that was the parent company of Spaceport. We open-sourced some ancillary bits and pieces before leaving, but not the most important components of the platform like the ActionScript compiler, build system, Flash API implementation, and renderer/engine.

I might try to get in touch with them, but open-sourcing it wouldn’t be enough—realistically it would take most of the old team just to get it back shipshape, let alone continue adding features, and I know most of them don’t have the time or desire to do that for free 5–6 years after leaving it behind.

comment 8y ago · link · parent

I worked on a Flash implementation called Spaceport in 2012 or so. We had the most complete implementation apart from Adobe, with all kinds of goodies like actual hardware-accelerated graphics on mobile (far better than the buggy AIR). Tried to get Mozilla to buy us out, since they were looking for a way to incorporate an open Flash implementation more complete than Shumway, but they didn’t bite. Ended up acquihired by Facebook, product abandoned. I sometimes wonder, if things had gone differently, whether we could have given new life to the Flash ecosystem. Oh well.

comment 8y ago · link · parent

The language they introduce, Π, is essentially a simple concatenative programming language where all of the primitive combinators happen to be reversible; the graphical depiction is essentially the same as graphical linear algebra¹, which is no coincidence. Concatenative combinator calculus is related to combinatory logic—specifically, it’s a variation that replaces application of combinators with composition, leading to a bunch of nice mathematical properties. Both of these logics have the nice feature that you can syntactically restrict the substructural rules of contraction (dropping), exchange (swapping), and weakening (copying): for example, a well-formed program that doesn’t use the K combinator to drop a value is guaranteed to be linear, i.e., not destroy any information. This isn’t true in ordinary lambda calculus, where you can use a variable zero or many times, so you need additional checks on the uses of a variable to determine whether a function is linear, affine, &c.

I like the theory of concatenative programming languages because they provide an elegant compositional/dataflow-oriented style of programming, have deep connections to linear logic, Hughes’ “arrows”, effects & coeffects, and quantum/reversible computation, while also admitting very efficient implementation on classical hardware.

I’m (very slowly) working on a statically typed low-level concatenative language that’s meant to provide all the nice high-level typed functional language features like higher-order functions, pipeline-style programming, and effects tracked in the types, while requiring no runtime support such as a tracing garbage collector—the ultimate goal is to allow a restricted subset that doesn’t even require a heap allocator, so you could use it to implement e.g. a kernel or device firmware. I hope that concatenative languages find their way to the mainstream as the basis for programming quantum and extremely low-power computing devices (which we will need in order to reduce emissions).

¹ https://graphicallinearalgebra.net/

comment 8y ago · link · parent

I don’t mean to evangelise too hard, but this is yet another reason to keep kratom legal in the US. Last I knew, over 30% of the world’s kratom is consumed by the US, and most of that is from Indonesia, specifically Borneo. Kratom is an understory crop that can be cultivated without clear-cutting as is done for palm oil; and if kratom growers can’t afford to stay in business because the US demand dries up, you can bet they’ll turn to palm oil and rubber, leading to more deforestation and more habitat loss for orangutans. This is in addition to what I believe is clear potential for kratom to be instrumental in fighting the epidemic of opioid painkiller and heroin abuse.

comment 8y ago · link · parent

I’m not sure, but based on what statistics I can find, it seems most blind people aren’t congenitally blind, so they probably have some familiarity with the symbols, maybe depending on how old they were when their visual impairment manifested. And of course you could always learn the shape of an unfamiliar symbol by feeling a physical representation of it—like on embossed paper, or those letter-shaped fridge magnets—but I dunno how common it is to do that.

If you don’t know the symbol at all, though, that could definitely make things more challenging to learn, since then the notation is (even more) arbitrary. A lot of programming languages’ symbol choices are visually mnemonic: Perl has “$” for scalars, “@” for arrays, and “%” for hashes because dollar-sign looks like S for scalar, at-sign looks like A for array, and percent-sign looks like a pair of things (a key and a value), but there’s nothing about these symbols semantically or in their pronunciation that suggests their Perl meanings.

comment 8y ago · link · parent

Simon Peyton-Jones is (was?) known for writing blocks in “aligned” instead of “hanging” style, with separators in prefix:

    someFunction =
      do { foo
         ; mx <- bar
         ; y <- case mx of { Just x -> do { baz
                                          ; pure (quux x)
                                          }
                           ; Nothing -> do { fnord
                                           ; blurch
                                           }
                           }
         ; xyzz y
         }
I find it nice enough to read, particularly because it leads to rapidly increasing indentation and consequently discourages deeply nested code, but it’s a bit of a pain to edit & diff. I would write the above like this:

    someFunction = do
      foo
      mx <- bar
      y <- case mx of
        Just x -> do
          baz
          pure (quux x)
        Nothing -> do
          fnord
          blurch
      xyzz y
This prefix delimiter style is actually fairly standard in Haskell not for “do” notation, but for records and lists, since Haskell doesn’t allow a final trailing comma in these structures:

    list :: [Text]
    list =
      [ "this"
      , "that"
      , "the other thing"
      ]

    data Numbers = Numbers
      { numI :: Int
      , numF :: Double
      , numS :: Text
      }

    record = Numbers
      { numI = 1
      , numF = 1.0
      , numS = "one"
      }

comment 8y ago · link · parent

Right—that was a source of inspiration for this aspect of my language. The original stated motivation in Haskell’s case was to make it easier to generate Haskell source code without needing to worry about indentation, but I wondered if it could also be helpful for accessibility. (Sadly there’s no way to turn off layout-based syntax in Haskell, and not much interest in such an option last I asked on /r/haskell.)

Explicit delimiters also have an advantage for keyboard navigation, enabling some degree of structural (by-block) movement. I prefer not to use a mouse/trackpad if possible—my main editor is Emacs in a terminal—and I know some people who have trouble using pointing devices or just don’t like switching between keyboard & pointer.

comment 8y ago · link · parent

The language in question already has a dataflow/pipeline style by default, so expressions are generally read from left to right like this, except for some standard syntactic sugar like infix operators and flow control blocks like “if” and “match”:

    read eval print loop

    stdin read
    some_environment eval
    pretty print
    loop

    [1, 2, 3] [4, 5, 6] \(+) zip_with
    do (each_index) -> i, x {
      if (x = 7) {
        "Lucky seven!" say
      } else {
        ["Value at index ", i show, " is ", x show]
          concat say
      }
    }

comment 8y ago · link · parent

Thanks so much for your response! #4 in particular is something I hadn’t considered, except in the context of how to display error messages in an editor, but now it seems obvious that the most relevant information should be closest to your focus.

As for #3, my compiler is intended to be all-in-one: there’s a single executable that acts as a front-end for an internal library, which handles everything: compilation, syntax highlighting, dependency management, documentation generation, you name it. So all the language tooling should just work in a consistent way.

comment 8y ago · link · parent

Last I knew, Braille displays are also pretty expensive, slow, and prone to breakage. Cool idea, but doesn’t work as well as a screenreader in practice for most people.

comment 8y ago · link · parent

My compiler is error-recovering for this reason: you can still get correct syntax-highlighting data even if there are lexical errors, type information even if there are type errors, and so on.

22.

Ask HN: How should a programming language accommodate disabled programmers?

173 points · by evincarofautumn · 8y ago · 116 comments

comment 8y ago · link · parent

In my accent (a rhotic New England without the cot–caught merger) they’re all different:

• “ox” /ɒks/

• “aux” /ɔːks/

• “orcs” /ɔɹks/

But hey, close enough for a pun anyway. My favourite rhymes and puns are those that work in any accent, but it’s a bit harder to come by one that’s not overused.

comment 8y ago · link · parent

I sometimes dream about being & moving amongst the abstract structures that I build in my head when reasoning about a complex problem. Sometimes it gives me an insight; others, it’s meaningless, the Tetris effect in another form.

comment 8y ago · link · parent

It’s not so unusual. I learned assembly before I learned C, mostly because I didn’t have a C compiler—or even know that I needed one! My family’s Windows 95 computer had QBASIC preinstalled (which amazingly I learned mostly by browsing the interactive help) and I discovered that in order to speed up my graphics routines, I had to write them in assembly in MASM (and DEBUG), also preinstalled. The fact that they were just there already, without requiring any installation or configuration, was enormously helpful as a beginner.

At ~10 years old, I didn’t have any frame of reference for how difficult this tack was compared to other languages, so I just accepted it as “this is what programming is like”. I only picked up C several years later as I got into programming languages and studied as many different languages as I could. Now I work in programming language technology as both a career and a hobby. :)

comment 8y ago · link · parent

It’s “exactly one byte” in the sense that by definition, sizeof(char) = 1, but it’s “at least one byte” in the sense that CHAR_BIT ≥ 8.

comment 8y ago · link · parent

A recent Twitter thread about this game, which goes into a little more detail on a couple points: https://twitter.com/Foone/status/1054907948852342784

Something that stuck out to me as cool:

> It used a dual-processor system using 8mhz 68000s, and for graphics it used a custom Taito tile-mapping chip, the PC080SN. They just used three of them, in fact, one for each screen. These were all mapped into the same memory space, so the three-screen display “just worked”.

First of all, it’s curious that it was cost-effective at all to invest in all this custom hardware for one game. But thanks to this hardware mapping, on the programming side, they could mostly treat the three CRTs as a single large display.

comment 8y ago · link · parent

I mean if you can’t observe any difference from safe code, then despite having different intensional/operational definitions, they are extensionally equivalent, and that’s mostly what I care about.

The ApplicativeDo desugaring, which uses the Applicative combinator instead of bind in exactly the circumstance I described above, was added specifically to support this use case when we (at Facebook) were writing Haxl, which is just such an example of a commutative monad; it’s built on IO, but doesn’t expose IO to safe code, so there’s no way to observe the concurrency from inside Haxl.

Granted, I’m biased because I have a somewhat unpopular definition of “effect” and “side effect”—if an effect can’t be observed from code by a particular observer that is safe wrt some property, then to me it’s not a side-effect.

It’s pretty widely accepted that within an ST action, mutating an STRef is a side effect to any observers within that action, but from the POV of the caller, the code is pure and thus side-effect–free; but I argue that mutating an IORef within an IO action is also not side-effectful, say from the POV of another thread, if the IORef is never shared—e.g.:

    -- Morally equivalent to “pure 1”.
    do
      x <- newIORef (0 :: Int)
      modifyIORef' x (+ 1)
      pure x
Again, all I’m really saying is that you need to be precise about what model of effects you’re talking about, and what properties you guarantee re. safety, commutativity wrt other effects, &c.

comment 8y ago · link · parent

I think that law is slightly too restrictive; there’s a useful class of Monad instances where it doesn’t hold: commutative monads, in which:

    x <- f
    y <- g
Is equal to:

    y <- g
    x <- f
Provided that “x” is not free in “g”. A good example is an async monad that provides concurrency in (<*>) and only blocks when there’s a data dependency in (>>=)—the result is the same regardless of evaluation order, but the implementations (and performance characteristics) are different. You could handwave it away by arguing that they’re “morally equivalent”, but I think it pays to be precise about properties like commutativity of actions.
12345
55