Trait's recent activity

  1. Comment on Any Rustaceans in the House? in ~comp

    Trait
    Link
    I've been playing around with it on and off, with a toy GC library under (slow) construction and a few smaller experiments into its macro system. It's been interesting to explore, as I've given my...

    I've been playing around with it on and off, with a toy GC library under (slow) construction and a few smaller experiments into its macro system. It's been interesting to explore, as I've given my pluggable GC a couple of strict requirements in that it must be truly parametric over the GC implementation (i.e. GcRef<T, GCImpl> behaves identically forall GCImpl) and the allocations must be async-capable, returning futures of the GCRef<T, _> (this required porting bang syntax from Idris to a Rust macro to make it comfortable to work with/avoid callback hell, however). Now that the basic architecture is done and the engineering is to begin, I've let it sit on the back burner, though.

    I haven't found Rust to be hard to learn (sans the old module system) as my undergrad dissertation was on applying a generalised form of linear typing and parametric polymorphism to C (and Idris started to introduce uniqueness types around the same time as I started Rust), but what really stood out is how it made my C and C++ so much cleaner (ignoring the necessary syntactic noise to get vtables and function pointers working in C).

    1 vote
  2. Comment on In cases of school shootings, should the parent who owned the weapon be charged with a crime? in ~talk

    Trait
    Link
    The UK requires that gun owners keep their firearms stored in appropriate gun safes/lockboxes when not in use. It's pretty strict on this, too - my father's gun box was a hefty steel thing...

    The UK requires that gun owners keep their firearms stored in appropriate gun safes/lockboxes when not in use. It's pretty strict on this, too - my father's gun box was a hefty steel thing containing the family shotgun, and the guidelines are pretty detailed on what's acceptable/unacceptable storage. Whenever he had his license renewed, every couple of years, a policeman would come over to check the storage location etc. to ensure it was up to snuff. Here's a leaflet for safe gun storage in the UK. Improper storage, regardless of the gun being used in a crime, is a criminal offence.

    However, this is possible because the UK does not have a constitution enshrining the right to bear arms. Its gun laws are very strict, and guns are considered tools and sporting equipment (e.g. pest control, target shooting clubs) rather than weapons to be used for self-defence or for militia. I imagine that putting a law in place in the US which obstructs one's second amendment rights won't be possible in the foreseeable future, as the culture around guns is totally different (foundation of a nation vs a tool more trouble than it's worth).

    Morally, I think this should only be the case in cases of neglect, such as leaving a gun out in plain sight in the car or telling children where it is before they are responsible enough themselves. I don't think parenthood should come into it, but guardianship seems fair (many people I grew up with barely knew their parents but lived with extended family). If someone makes a good faith effort to keep their guns secure, then I think they should not be prosecuted for someone else overcoming their efforts to safely secure their guns to the greatest extent that doesn't infringe on their rights (such as 2nd amendment in the US).

    1 vote
  3. Comment on Programming Challenge: creative FizzBuzz in ~comp

    Trait
    Link Parent
    That's cool with the activity sort. I came up with the idea for the solution after reading a fizzbuzz thread on /g/ a while back, in which the code got more and more obfuscated with more obscure...

    That's cool with the activity sort.

    I came up with the idea for the solution after reading a fizzbuzz thread on /g/ a while back, in which the code got more and more obfuscated with more obscure languages and features. I hadn't seen anyone in the thread manage a Regex solution, so I made one myself, and because that's too obvious on its own, I also completely mangled the syntax via custom template literals instead of normal function calls. Choosing something like Ook! would be too obviously incomprehensible, but writing incomprehensible code in one of the most widely comprehended languages? Now that is truly art!

    1 vote
  4. Comment on Programming Challenge: creative FizzBuzz in ~comp

    Trait
    Link
    Necroposting, since I'm late to the party: JS can now be abused to the point of looking like if Perl and ML had a baby. Backticks and ${} now act like clumsy brackets, the functional features (and...

    Necroposting, since I'm late to the party:

    JS can now be abused to the point of looking like if Perl and ML had a baby. Backticks and ${} now act like clumsy brackets, the functional features (and let) are lovely, and some pointless esoterica can completely mislead people.

    let hexedron = (_,x,...y) => y[0][x].call(...y);
    let torus = (_,x,...y) => _[0][x].call(...y);
    
    let recur = (f, x, yl) => {
      let [y, ...ys] = yl;
      if(ys.length) {
        return recur(f,f(x,y),ys)
      }
      else {
        return f(x,y)
      }
    }
    
    
    const fizz = 3;
    const buzz = 5;
    const fizzbuzz = fizz * buzz;
    
    let _fizzbuzz = (n) => {
      let strung = hexedron`${'toString'}${n}${fizzbuzz}`;
    
      let f = (x,y) => hexedron`${'replace'}${x}${y[0]}${y[1]}`;
    
      strung = recur(f, strung, [[/.*?([369c0])$/,"fizz $1"],[/(fizz )?(.*?[5a0])$/,"$1buzz"],[/[c3PO#69]/,""]]);
    
      return [strung][~-(0|torus`${"includes"} ${strung} ${"zz"}`)] || n;
    };
    
    let about100 = ~100;
    
    for (let f = -~0; f <- about100; f++) {
      console.log(_fizzbuzz(f));
    }
    
    1 vote