Live data from Hacker News

Don't touch my clipboard

alexanderell.is

321–322 of 322 posts

Re: Don't touch my clipboard

#321

Earlier quoted context omitted.

How do people know the result of running this command without running a VM? Is it possible to run OS X in a VM these days? The command's intention is so obvious I wonder why there is no warning from the os, the shell program or the terminal for such, easily blacklist-able commands. Or is there?

I've learned that personally one night fighting messed up rebase conflicts and for still unknown reason I copied and pasted a path for `rm` and ended up issuing `rm -rf ~ /repo-path /unneeeded-dir` - it took me a couple of seconds to realize that this command takes unexpected long time to execute and then my eye caught a view of Finder window with shrinking list of folders in home directory :) Time Machine helped me…

PS: it turns out you can restore dot files from the Time Machine backups but it's not enabled by default:

https://apple.stackexchange.com/questions/141321/how-to-rest...

Re: Don't touch my clipboard

#322
post #203

Earlier quoted context omitted.

Having multiple almost identical ways of achieving things is a bug magnet in programming languages. Differing programmers will presumably use different styles (why else even support differences?), and if you mix code like that, bugs ensue. This a hassle not just because autoformatters are liable to make churny changes (which distract from real changes, which makes history harder to understand: bug magnet), but also b…

Many programming languages, certainly not all, offer single and double-quoted strings already. Which is, granted, a perennial source of annoyance for those of us trying to have a consistent formatting style. I want «guillemet strings» because they use a matched pair, so you can «quote a string «within a string» without escaping» and I think that's a nice property. I'm not really interested in supporting all the forms…

Those work in Raku, with the exception of ‟at least two styles”.

    .say for q[‟”].uninames
    # DOUBLE HIGH-REVERSED-9 QUOTATION MARK
    # RIGHT DOUBLE QUOTATION MARK
If you use one type of quote, you can use the others inside of it with no problem.

    “double "quotes"”
(Raku doesn't use a tokenizer.)

Also note that you can use a variety of characters for quoting if you use `q`, `qq` or `Q` etc.

    q>>>  eq  '1 
Note that many Unicode characters which have a LEFT and RIGHT variant will also be paired when you do that. q⦑like this⦒

In Raku string literals are actually a [parameterized domain specific language](https://docs.raku.org/language/quoting). (The domain of creating strings.)

    my $buffer = Blob.new(115,116,114,105,110,103); # 'string'.encode()

    Q            # start with raw quoting
    :scalar      # enable embedding the value of scalars
    :backslash   # enable backslashing characters
    [This is a $buffer.decode()\n]
There are shortcuts for common uses

    'single'  eq  q [single]  eq  Q :single [single]  eq  Q :q [single]
    ‘single’  eq  ‚single’

    "double"  eq  qq [double]  eq  Q :double [double]  eq  Q :qq [double]
    “double”  eq  „double”

    「raw」   eq   Q [raw]

       eqv   qw [ words ]   eqv   q :words [ words ]

    >   eqv   qqww [ quote words ]   eqv   Q :double :quotewords [ quote words ]
    « quote words »
This is not exhaustive.

:double is actually short for :scalar :array :hash :function :closure :backslash

:words splits on whitespace :quotewords splits on whitespace but respects quoted sections

    q      :words [ a "b c" ]   eqv   ( 'a', '"b', 'c"' )
    q :quotewords [ a "b c" ]   eqv   ( 'a', 'b c' )
Note that :double is the same as any adverb in the language, so you can negate a feature with :!double.

    qq [with newline\n]
    qq :!backslash [without newline\n]

    qq :!array [user@example.com()]
(It's actually rather difficult to accidently use @ or % variables.)
Post reply on HN