11 Matching Annotations
  1. Nov 2022
    1. by using symbols as keys, you will be able to use the implicit conversion of a Mash via the #to_hash method to destructure (or splat) the contents of a Mash out to a block

      Eh? The example below:

      symbol_mash = SymbolizedMash.new(id: 123, name: 'Rey') symbol_mash.each do |key, value| # key is :id, then :name # value is 123, then 'Rey' end

      seems to imply that this is possible (and does an implicit conversion) because it defines to_hash. But that's simply not true, as these 2 examples below prove:

      ``` main > symbol_mash.class_eval { undef :to_hash } => nil

      main > symbol_mash.each {|k,v| p [k,v] } [:id, 123] [:name, "Rey"] => {:id=>123, :name=>Rey} ```

      ``` main > s = 'a' => a

      main > s.class_eval do def to_hash chars.zip(chars).to_h end end => :to_hash

      main > s.to_hash => {a=>a}

      main > s.each Traceback (most recent call last) (filtered by backtrace_cleaner; set Pry.config.clean_backtrace = false to see all frames): 1: (pry):85:in __pry__' NoMethodError: undefined methodeach' for "a":String ```

  2. Sep 2022
    1. The discussion here can get very fast-paced. I am trying to periodically pause it to allow new folks, or people who don't have quite as much time, to catch up. Please feel free to comment requesting such a pause if you would like to contribute but are having trouble following it all.

      Why is it necessary to pause Can't new person post their question/comment even if it's in reply to comment #10 and the latest comment happens to be comment #56? There's no rule against replying/discussing something that is not the very latest thing to be posted in a discussion!

      Possibly due to lack of a threaded discussion feature in GitHub? I think so.

      Threads would allow replies to "quick person" A to go under their comment, without flooding the top level with comments... thus alowing "new person" B to post a new comment, which in so doing creates a new thread, which can have its own discussion.

  3. Aug 2022
    1. This leads to duplicated effort and ultimately small differences between common interactions.

      How does it cause that?

  4. Sep 2021
  5. Aug 2021
    1. function strictIsDog<T extends Dog extends T ? unknown : never>( // like <T super Dog> candidate: Dog | T // if Dog extends T then Dog | T is T ): candidate is Dog { // compiler recognizes that Dog | T can narrow to T return "bark" in candidate; } if (strictIsDog(animal)) {} // okay if (strictIsDog(dog)) {} // okay if (strictIsDog(mixed)) {} // okay if (strictIsDog(cat)) {} // error! // ~~~ <-- Cat is not assignable to Dog
    1. Adding to the accepted answer, if you happen to need to use a type guard against a mixin, you'll get this error too, since the is operator doesn't behave as an implements would.
    2. the generic means "give me one of each function a -> Boolean" so if any of those functions doesn't exist, then the generic doesn't exist.
  6. Apr 2021
    1. Very slow, very cheap shipping via Royal Mail. Royal Mail advertises an ‘online’ international 12 week ’no rush’ service (not trackable). The price of the service is dependant on weight. It may be possible for international shipping to be achieved for around £15 GBP, may be even less! (This is not a typing error).  If you are interested in this service you will need to contact us before the campaign ends.

      Why do we need to contact you before the campaign ends if we want cheap shipping? Why wouldn't we want cheap shipping? What will shipping be if we don't choose that? How do we choose that? Why can't we choose shipping directly after the campaign ends?

  7. Feb 2021
    1. Defaults names are given to steps without the :id options, but these might be awkward sometimes.

      Why would those default names ever be awkward?

      If you the default name is whatever comes after step:

      step :default_name
      

      then why can't you just change that name to whatever you want?

      To answer my own question: I think you can do that, as long as the name is the 1st argument to step. But below I noticed an example where a Subprocess was the 1st argument instead, and so it needs a name in this case:

      step Subprocess(DeleteAssets), id: :delete_assets
      

      Why are they inconsistent about calling it name or id? Which one is it? I guess it's an id since that's what the key is called, and since there's an Id() helper to reference a task by its id.

    1. The rsync and sleep commands (the sleep is just an example) are run through exec to prevent the creation of zombie processes if I kill the parent script while they're running, and each potentially-long-running command is wrapped in its own subshell so that when exec finishes, it won't terminate the whole script.