« first day (4436 days earlier)      last day (398 days later) » 
00:00 - 18:0018:00 - 00:00

6:00 PM
mutability: should I do it
 
why would functions ever be mutable
unless you mean making it possible for variables containing functions to be mutable in which case why not
 
@UnrelatedString I think they are in Python, lemme check
they are
Python 3.9.2 (default, Mar  1 2021, 08:18:55) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> class Foo:
...     def a(): pass
...
>>> Foo.a = None
>>> Foo().a()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'NoneType' object is not callable
>>>
that's so cursed
 
@UnrelatedString ƇƲƲƇ
 
@Ginger The function itself isn't mutable though
 
whar ?
 
6:12 PM
Like the __code__
Just the weired wrapper class is, but that's a ordinary object
 
@mousetail oh really?
Python 3.9.2 (default, Mar  1 2021, 08:18:55) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> def f():
...     print("Hello")
...
>>> f()
Hello
>>> f.__code__ = compile("print('Haxed')", "hax", "exec")
>>> f()
Haxed
>>>
 
The code is immutable
just the wrapper class is mutable
but that's just a ordinary object
 
damn, you're right
 
In most dynamically typed languages functions are not really functions
 
hmm, wait
 
6:17 PM
In JS, a function is just an object with a [[Call]] internal slot
I am reminded of how classes worked in old-school JS
 
yeah I guess it is immutable :|
anyway, should Rabbit have mutability controls?
 
I wouldn't know why you would want to make it mutable. Maybe have a attribute system if you want to set some flags on a function but making it mutable seems useless
 
That's what I was thinking too
but still should mutability be a configurable thing
 
@Ginger Every variable should be immutable by default
And ideally you'd offer immutable versions of data structures too
 
// Modern JS
class C {
    constructor(arg) {
        this.value = arg;
    }
    printValue() {
        console.log(this.value);
    }
}

// Old-school JS
function C(arg) {
    if (!(this instanceof C)) {
        throw new TypeError("call me with new");
    }
    this.value = arg;
    return this;
}
C.prototype.printValue = function printValue() {
    console.log(this.value);
}
 
6:22 PM
You can still exploit the prototype system for hacking. JSON parsing any file that has a __proto attribute causes all sorts of weired unexpected behavior
 
@mousetail Swift does it that data structures declared with let (equivalent to Kotlin val) are immutable even though they just store a pointer to a buffer
 
Most languages have a distinction between a immutable variable pointing do a mutable data structure and a mutable variable pointing to a immutable data strucutre. Very confusing to newcomers
 
var foo = [1, 2]
foo.append(3) // legal
let bar = [1, 2]
bar.append(3) // !! illegal
 
Same in rust
 
You can still have an immutable pointer to mutable data or a mutable pointer to immutable data, but the standard library types don't do that by default
Array in particular is actually a pointer-length-capacity triple, so it makes sense to behave this way: mutating the elements may cause length and/or capacity to change. However, it doesn't even allow operations that won't, such as indexed writes, because of how it's written
The real reason: because arrays are CoW, indexed writes can still change the pointer, as it may force a copy
 
6:29 PM
Yea same in rust. I'm guessing this works in any statically typed compiled language. The only reason it doesn't work in dynamically typed language is because everything is a pointer so you can't store anything significant in the variable part itself. So nothing except the reference itself actually becomes immutable
 
I wouldn't call C# dynamically typed. I mean, you can do that, but it's heavily discouraged
 
C# is kinda both
C# literally follows every paradigm
It's a object-oriented functional data-oriented async statically typed dynamically typed compiled interpreted language
 
not as badly as C++ is tbh
C++ is Feature Creep: the Language
 
time to add mutability and such
also, I'm not doing for <whatever> blocks
 
6:46 PM
@Ginger I don't think you really can
At a protocol level at least
Individual servers can use DDoS protection services like Cloudflare
 
mmm
speaking of: where tf do I host this service
a quick check of pypi.org/stats shows that PyPI hosts 14.2 terabytes of data
which sounds kinda pricey
 
That little?
Wow
Oh does it just store metadata
 
yeah we get it you replace datacenters like they're nothing :p
@RydwolfPrograms no, code too
 
14.2 terabytes for what's been the second largest language for like a decade?
That's nothing
 
yes
only 441k projects apparently
which feels... weirdly low?
 
6:55 PM
You'll need a few gigs at most. As soon as you don't, chances are you've got waaay more resources than you do now
 
cool
can I use your server
or would hosting it on AWS or smth be a better idea
oh also: there will actually be two main module stores
modules.rabbitlang.dev, for the standard modules, and chinchilla.dev (name WIP), for other people's modules
 
Don't you already have a server
Why would you need another just for this
 
let's just say my circumstances prevent me, currently, from hosting it on my server
this might change at some point but for now I can't do it on mine
 
That could mean one of a few things and all of them concern me
 
also, my "server" is a Raspberry Pi 3 that's been sitting powered-off on my desk for like 5 weeks :b
@RydwolfPrograms Don't worry, I'm not in any mortal peril
 
6:59 PM
No I'm talking about the droplet
 
ohhhhhhhhhhhhhhhhhhhh
 
Isn't that the whole point of it
 
lmfao
yeah I can host it on the droplet
sorry for worrying you
 
Yeah I was like "I'm spending $12/mo for that server you better not've bricked it and/or yourself" lol
 
mfw I accidentally brick myself and have to reflash my firmware
@RydwolfPrograms don't worry, it works great (even with the janky-ass code tunnel setup)
 
7:02 PM
I thought "bricked" included "not reflashable with new firmware"
As in, so useless it might as well be a brick
 
not sure if I ever thanked you for it, so: but thank you very much for letting me use this droplet
@RydwolfPrograms that's a meaning; I took it to mean "soft brick" as in "it's dead until you reflash it"
 
Soft bricks: For houses you don't care too much about™
 
squishy houses
bouncy castle
 
In CSS, How do I set a maximum width for resizable elements? resize: horizontal doesn't respect max-width.
 
all im seeing in the rydwolf-ginger convo is that rydwolf is keeping ginger from making stupid descisions
 
7:05 PM
that's most of what he does :b
1. I come up with ridiculous ideas
2. Rydwolf keeps me from shooting myself in the foot
3. Rinse and repeat
 
oh it does, I just can't give a value in %? or maybe I'm just dumb
 
Maybe the % is relative to something unexpected
Like the width of the textarea itself or something
 
also possible
also possible is that I forgot to recompile my sass
 
@RydwolfPrograms Hmm, MDN excludes that as a possibility:
> Defines the max-width as a percentage of the containing block's width.
 
Yep, max-width: 100% works fine. I just forgot to recompile after adding that rule
 
7:09 PM
Maybe SASS does it differently tho idk
Oh nvm
 
@Bbrk24 I read that as "sass" as in "sassy" (unless that's what you meant)
 
.o.
 
It's a CSS preprocessor that lets you nest rules instead of repeating them
it also has compile-time functions and variables (in addition to CSS's)
Here's an excerpt from my sass document:
button {
    background-color: color.change($button-color, $alpha: calc($button-opacity / 100%));
    // ... a bunch of other stuff ...
    &:disabled {
        opacity: 60%;
    }
    &:active {
        border-color: color.mix($button-color, white, $button-opacity);
        @media screen and (prefers-color-scheme: dark) {
            border-color: color.mix($button-color, $dark-background, $button-opacity);
        }
    }
}
 
:O
 
7:12 PM
And that compiles to:
button {
  background-color: rgba(127, 127, 127, 0.35);
  /* ... */
}
button:disabled {
  opacity: 60%;
}
button:active {
  border-color: #d2d2d2;
}
@media screen and (prefers-color-scheme: dark) {
  button:active {
    border-color: #3f3f3f;
  }
}
It's not necessarily shorter than CSS, but if you do it right it's less error-prone
The functions and variables means I have to compute far less by hand, so when it does produce the occasional ugly expression I can build it part-by-part and know it's done correctly
 
@Bbrk24 yaml hell
 
Case in point, I have a variable that expands to calc(2 * ((0.5em + 0.125rem + 1px) * 2 + 24.4992rem) / 0.78). But that's not how I wrote it, and the source is far more comprehensible than the resulting CSS
Like, this line is only long because of variable names, and I think it's fairly self-explanatory: $min-two-col-width: calc(2 * ($textarea-noncontent-width + $textarea-cols * $monospace-ch) / $main-scale-fraction);
 
8:01 PM
mfw * { background-color: inherit; }
 
tbh css could have been done better
 
Thanks to a complex series of sass variables and mixins, I've gotten almost all my dynamic styling out of JS and into CSS. The only thing I have left depends on the width of the wider of two strings, which I don't think I can do in pure CSS without hardcoding
 
8:30 PM
0
Q: What is a good ASCII boundary-character for regex unary, and will using that instead of a delimiter affect the perceived legitimacy of my answers?

DeadcodeSo far, I have only used comma-delimited unary for my answers taking a list / array as input, since it's the "obvious" choice. That looks like xx,xxxxxx,x,xx,x,xxx. However, this can't differentiate between \$[]\$ and \$[0]\$, as both would be an empty string. In most challenges, this isn't a dir...

 
I think this would go on main, with tipsSeggan 12 secs ago
CMM: ^
 
 
1 hour later…
9:54 PM
No
Because it's not a "hey how do I make this shorter"
It's a "hey here's a policy that would make a lot answers shorter should it be allowed"
 
10:08 PM
@RydwolfPrograms I
 
CMP: Favourite Practlang? Either for Projects or Quick Testing?
 
Scala
 
JavaScript
As bad as it is it's so easy to quickly test things in it, since I almost always have a browser open that I can just open the console in
 
I don't mind _type_script for small test things, but it struggles with anything desktop based.
 
Sometimes I have to fight with the TS type system though
In Trilangle, I'm using JS + JSDoc rather than TS, because TS doesn't like things like this:
let index = 0, buffer = null;

function getNext() {
  if (index == 0) buffer = ...
  return buffer.at(index++)
}
(Example heavily abbreviated from actual code)
 
10:14 PM
I've not had to Fight TS that much, but I find myself writing TS friendly code.
I just wish they had better support for bidirectional referencing Types cross file.
 
Or this one
if (foo) {
  // foo isn't undefined here...
  arr.map(x => x + foo /* ...but it is here! */)
}
Of course it's dangerous to apply this logic to callbacks in general, but it's really frustrating to be unable to apply it at all
 
That's because foo might be undefined there.
Never trust a library to do what you tell it to, least of all in JS
 
@ATaco No, Array#map calls its argument immediately. It's impossible for it to change in-between
@ATaco What if that library is the ECMAScript standard
 
Yes but .map might not point to Array#map. The only way to get around this would be to include some sort of decorator for methods which instantly call and forget their callback functions.
 
Swift gets around this by having escaping and non-escaping callbacks be different types, so you can't accidentally escape a non-escaping callback
 
10:18 PM
Even if TS doesn't like it, Prototypes ARE writable...
 
var someFunc: (() -> Void) -> Void
var someOtherGlobal: () -> Void

func escapesArg(_ arg: @escaping () -> Void) {
    someOtherGlobal = arg // okay
}

func doesntEscape(_ arg: () -> Void) {
    someOtherGlobal = arg // Error! Can't escape this!
}

someFunc = escapesArg(_:) // Error! Different argument types!
someFunc = doesntEscape(_:) // okay
@ATaco Okay but at least it can deal with that if you know how to tell it you've done so. It utterly fails to comprehend Object.create(null)
Sure, I can explicitly add constructor: number to the type signature. But I shouldn't have to. And it definitely shouldn't allow this in the general case, only for null-prototyped objects. But TS doesn't seem to know they exist.
 
 
1 hour later…
11:43 PM
@RydwolfPrograms Did you mean: I language
 
00:00 - 18:0018:00 - 00:00

« first day (4436 days earlier)      last day (398 days later) »