#๐Ÿช…-progaming

1 messages ยท Page 32 of 1

ornate quiver
#

not on window either
all the references are enclosed

#

main webpack bundle is loaded through the main property of package.json in an asar package

hoary sluice
#

bro homerow mods are annoying sometimes, i tried pasting the aoc answer but to do that i have to hold N and press V (since N is ctrl) and i did it too fast and submitted 'nv' as my answer

#

aoc needs to not put u on cooldown if u submit an answer with a letter in it when its supposed to be ints

ornate quiver
#

what I did is rename the asar bundle and made a small loader to run code before loading the actual asar
kinda like vencord used to do it

royal nymph
#

still does it that way

#

can you send the whole file that is in

#

also why is it not minified lmao

#

gitkraken insane

#

is gitkraken foss

ornate quiver
royal nymph
#

you also renamed __webpack_module_cache__?

ornate quiver
#

nop that part wasnt

#

funny

#

it's like half minified

dense sand
#

Guys what do you think would be faster:

  1. parse javadoc data out of the html pages that are generated
  2. parse source java files and extract the javadoc comments
#

Faster in terms of actual speed

ornate quiver
royal nymph
#

13mb

#

horror

ornate quiver
#

yeah

royal nymph
#

bro dropped entire gitkraken code

calm ruin
#

14MB

#

okay so

#

webpack_Require is not on global right

ornate quiver
#

no

calm ruin
#

also is it gitkraken desktop

ornate quiver
#

yes

calm ruin
#

okay wait

ornate quiver
#

I couldn't find anything leaking to global

calm ruin
#

300mn trolldayruined

royal nymph
#

I'll take a look soon

#

not rn

calm ruin
#

can you open devtools

ornate quiver
#

not by default

calm ruin
#

how do I enbale

ornate quiver
#

you can open by replacing forceDevtools: and make it true

#

in main bundle

ornate quiver
royal nymph
#

you just need to register a global keybind with electron

#

and then call browserWindow.openDevTools()

#

or well you would want to use the toggle function

ornate quiver
#

im not sure what they're doing
but it doesn't matter anyways because main bundle is loaded in main process
renderer loads a different bundle so devtools are useless

#

i need to patch main bundle

calm ruin
#

why th do they have 3 app asar ๐Ÿ˜ญ

ornate quiver
#

it's so cursed

hoary sluice
#

@calm ruin u would love 2017 aoc

calm ruin
#

nop not now

hoary sluice
calm ruin
#

bfable

hoary sluice
#

runs in 2 seconds on kotlin

#

36ms optimized rust

royal nymph
#

open chrome://inspect in a chromium browser

ornate quiver
#

o

royal nymph
#

and launch gitkraken with --inspect

#

then you can connect to it from the devtools in the browser

#

if you want to debug before the app starts, you can use --inspect-brk instead which will immediately break

ornate quiver
#

neat
I will try

calm ruin
#

yeah that worked

#

I was gonna unpack default_app.asar modify and repack

#

but this is easier

royal nymph
calm ruin
#

but it only shows node

#

no browser

royal nymph
#

yes that's the point

#

rusher needs to debug main process

calm ruin
#

oh

ornate quiver
#

that's electron default

calm ruin
royal nymph
calm ruin
#

its file structure so confusing

ornate quiver
calm ruin
#

app.asar only had unpacked stuff

ornate quiver
#

there's a 7zip plugin for asar
it makes editing so much easier

ornate quiver
dense sand
calm ruin
ionic lake
#

do you still want

dense sand
ornate quiver
#

.unpacked is literally just for git

ionic lake
dense sand
#

I don't want plain black bg

royal nymph
#
pnpm add --global @electron/asar

# unpack
asar e app.asar app

# then edit files in app folder

# pack
asar p app app.asar
dense sand
#

And i dont want to fuck with shaders

ionic lake
dense sand
royal nymph
dense sand
#

Thankssss

royal nymph
#

you can pollute global prototypes to intercept this assignment

#

this does exactly what u need

ionic lake
calm ruin
#

@ornate quiver I managed to get it

#

tho that amd0 might change

#

but you can probably do same thing with c

royal nymph
#

ur so slow

#

i already sent

calm ruin
#

BAD

#

I WAS TRYING TO MAKE STUPID DEBUGGER WORK

#
export function waitForDeclaration(obj, prop, callback: (obj,prop)=>{}) {
    Object.defineProperty(obj, prop, {
        set(v) {
            Object.defineProperty(obj, prop, {
                value: v,
                writable: false,
                configurable: false,
                ...Object.getOwnPropertyDescriptors(v),
            });

            callback(obj, prop);
        },
        configurable: true,
    });
}
``` @royal nymph what do you think about my hlorious code
pearl stagBOT
# royal nymph https://github.com/Vendicated/Vencord/blob/main/src/shared/onceDefined.ts#L30-L4...

onceDefined.ts: Lines 30-47

export function onceDefined<T extends object, P extends LiteralUnion<keyof T, PropertyKey>>(
    target: T, property: P, callback: (v: P extends keyof T ? T[P] : any) => void
): void {
    const propertyAsAny = property as any;

    if (property in target)
        return void callback(target[propertyAsAny]);

    Object.defineProperty(target, property, {
        set(v) {
            delete target[propertyAsAny];
            target[propertyAsAny] = v;
            callback(v);
        },
        configurable: true,
        enumerable: false
    });
}
calm ruin
#

STEALER

royal nymph
#

trol

calm ruin
#

well we wrote same code lmao

#

except you have insane typescript definitions

hoary sluice
calm ruin
fleet cedar
#

Why does it take a callback rather than returning a promise

calm ruin
#

I at least like its that part

#

async bad

#

also cant promise also introduce some delay

#

this needs to call instantly

#

while blocking main thread

fleet cedar
#

Hm, that's a fair point

#

Resolving a promise only schedules the then to be run at the runtime's convenience

calm ruin
#

yeah thats bad

ornate quiver
#

alright i will try

calm ruin
#

why did you ignore me

#

๐Ÿ˜ข

pearl stagBOT
ornate quiver
#

how does this work

fleet cedar
#

Just evil magic, nothing special

#

Define a magic symbol that does funky things when looked up, then trick webpack into running that lookup function

#

Thereby getting the object it's looked up on

ornate quiver
#

oh neat

royal nymph
#

you only need it for when the cache isnt exposed at all

#

it's usually available on wreq.c as is the case with gitkraken

#

but very rarely it isn't

ornate quiver
#

oh

royal nymph
#

it's to get a reference to the cache if it's only a local variable

ornate quiver
#

can i make webpack cache a proxy then or something
to intercept new modules being added

royal nymph
#

what exactly are u trying to do

#

same as vencord?

#

regex patches?

#

or do you want to monkey patch

ornate quiver
#

nop
i just need to monkeypatch the result of two functions from different modules

#

find by props

royal nymph
#

WebpackGrabber has everything

royal nymph
#

if u just want to patch 2 functions

calm ruin
#

WRONG

#

prototype definitions so bad

ornate quiver
royal nymph
#

if u just wanna monkeypatch

calm ruin
#

waitForModule doesnt exist on webpackgrabber yes

ornate quiver
#

because if i do it too late then it doesnt matter

royal nymph
#

oh okay

ornate quiver
#

wont work

royal nymph
#

well

#

.c has the cache which is the finished exports

#

.m has the module source

#

BRO

#

fuck this bot lmao

calm ruin
royal nymph
#

anyway you need to patch .m

calm ruin
ornate quiver
#

it doesnt seem that wreq.m exists

#

original module list is hidden

royal nymph
#

oh yes

#

it's just a local variable

royal nymph
#

very slight variation tho

ornate quiver
calm ruin
#

then proxy ๐Ÿ™

royal nymph
#

let me explain

#

this is the webpack require function

calm ruin
#

its all because you confuse rusher with dumb symbol

#

if you put skibi-i instead of symbol he wouldnt get confused

royal nymph
#

whenever we require q, it

  1. obtains cache[q] to look up the module in the cache
  2. if we found cached exports it just returns that
  3. if not, it creates a new entry on cache[q]
  4. then it calls modules[q] to initialise the module (require call) and puts the return value (the exports) in the cache
#

that function is meant to extract the private cache variable

so what it does is create a symbol (unique key)
then it declares a getter & setter for our symbol on the object prototype (so every object has this getter and setter)
then it calls require with our symbol
require looks up our symbol in the cache and thus invokes our getter
now our getter function has a reference to the cache

calm ruin
#

basically this lookup calls getter with "this" as cache

royal nymph
#

but you don't want the cache (wreq.c), you need the modules (wreq.m - not actually exported in this scenario)

#

so you need to slightly alter that function to your needs

ornate quiver
#

oh i see

calm ruin
#

I will soon steal all the vencord utility functions

royal nymph
#
function extractPrivateModules(wreq) {
    let modules = null;
    let cache = null;
    const sym = Symbol("wpgrabber.extract");

    let isSecondPass = false;
    Object.defineProperty(Object.prototype, sym, {
        get() {
            if (!isSecondPass) { // this is cache[sym] get
                cache = this;
                isSecondPass = true;
                return undefined; // return undefined so it skips cache
            }

            // this is modules[sym] get
            modules = this;
            return () => {} // modules are functions that it calls to get the exports. just return a noop function
        },
        set() { },
        configurable: true,
    })

    wreq(sym);
    delete Object.prototype[sym];
    if (cache) delete cache[sym];

    return modules;
}
#

this should work

ornate quiver
#

that's actually pretty neat

#

javascript is so cursed

royal nymph
#

essentially
modules is an object that holds each module (file)
cache is an object that caches the module exports. because if you import a module twice, it reuses the same variables

#

Source Code:

export let counter = 0;
export function increment() {
  counter++;
}

Output:

let modules = {
  1234567: (module, exports, require) => {
    exports.counter = 0;
    exports.increment = function() {
        exports.counter++;
    }
  }
}

then the first time you require 1234567, it will call the function and then put the exports object that it assigned counter and increment on to the cache object. in the future it will obtain it from the cache so it keeps reusing the same counter variable

#

each member of the modules object corresponds to one source file and all have the same function signature and assign their exports to the exports

it is called exactly one the first time you require it, and then never again

#

so what you want to do is find the member of the modules object that is the module you want to patch (based on source code, you need to stringify the function)

#

then you want to override that member with your own function. your own function should then call the original function and can alter the exports accordingly

royal nymph
#

81984 is the module id aka filename of the first module

re(7914) means require module 7914

then K.default = ... means exports.default = ...

ornate quiver
#

yeah

#

thanks blobcatcozy

royal nymph
#

so this module requires module 7914 and all those other modules and defines a default export that has properties activityLogLevel and so on

ornate quiver
#

although

ornate quiver
royal nymph
#
const theModuleYouWantToPatch = Object.entries(webpackModules).find(([id, module]) => module.toString().includes(".DEFAULT_COMMIT_MESSAGE_GENERATION_USER_PROMPT"));

if (!theModuleYouWantToPatch) throw "done exploder";

const [id, originalModule] = theModuleYouWantToPatch;
webpackModules[id] = function (module, exports, require) {
  originalModule(module, exports, require);
  // exports / module.exports are now initialised to whatever that module exports. you can access or modify it
  module.exports.whatever = 42;
}
royal nymph
#

because the require function accesses it via local variable which you cant change

ornate quiver
#

oh right

#

oops

royal nymph
#

the best you could do is find the module id from the modules object and then define a getter/setter on the cache with that

#

but at that point it makes more sense to just monkey patch the module

royal nymph
#

i made a slight edit because i made a istake

ornate quiver
#

oki

royal nymph
#

sadly the part where you stringify the modules to find the right one seems to consume some memory permanently

#

because js caches the string

#

so if there is 10mb of code and you stringify everything

#

this is why vencord increases memory usage somewhat

ornate quiver
#

hm

royal nymph
#

anyway doesntr matter much

ornate quiver
#

what if i go through each module in __webpack_modules__ and monkeypatch it's call method

#

that way it doesnt use a ton of memory and i can also check by props immediately

royal nymph
#

you would just replace the function instead of patching call

#

anyway you can do that but its probably not worth it lol

#

its not like it will use hundreds of mb of ram

ornate quiver
royal nymph
#

its not that much

royal nymph
#

im saying

#

you wouldnt monkeypatch .call

#

that makes no sense

#

you'd just do

for (const [id, originalModule] in Object.entries(modules)) {
  modules[id] = function (module) {
    originalModule.apply(this, arguments);
    if (module.exports.whatever) // do thing;
  }
}
#

but its probably not worth it lol

#

you create so many new functions and closures

#

and its more cpu intensive probably

calm ruin
#

you know its bad when you see "310 remaining items load more" in a issue

ornate quiver
#

insane

placid cape
#

just don't use WSL

calm ruin
#

I was trying to figure out why it was using 40gb

#

I couldnt figure out

#

Probably half of it is cuda

serene elk
royal nymph
#

the performance of that is probably atrocious

serene elk
#

don't think so

#

it's just another proxy

royal nymph
#

yeah but inside the prototype

#

it's kinda different

#

the second u start messing with prototypes and do weird shit performance dips

#

all the prototype set methods have performance warnings xd

serene elk
#

lol

royal nymph
#

well it might be fine who knows

serene elk
#

either way it needs some tricks to get it to work fully

#

so not worth it

#

depending on how you do it, some traps are required to avoid a stack overflow

royal nymph
#

speaking of proxies it's kinda silly that proxies even have apply trap

#

I guess it's for completeness sake

#

but there's really no reason to ever need that

#

you can just wrap the function with ur own function instead to achieve the same without a proxy xd

serene elk
#

might be more peeformant somehow

median root
#

yo how do i get jemalloc to use page size 16? im tryna build the nuclear music player for my asahi linux installation but jemalloc always stops it with unsupported page size.

#

the only solution ive been able to find online was to use:

JEMALLOC_SYS_WITH_LG_PAGE
#

but that doesent seem to work for me

jade stone
#

is it just me, or is this a macro

ornate quiver
#

yeah

past osprey
#

one of the side effects of rewriting the entire collision code

viscid grove
dense sand
#

has anyone ever here worked with antlr4

ornate quiver
pearl stagBOT
#

disable-copying.js: Lines 9-25

function disableSelect() {
  return false;
}

function reEnable() {
  return true;
}

// If IE4+
document.onselectstart = new Function ("return false");
document.oncontextmenu = new Function ("return false");

// If NS6
if (window.sidebar) {
  document.onmousedown = disableSelect();
  document.onclick = reEnable();
}
void leaf
placid cape
#

new Function("return false")

#

๐Ÿ’€

void leaf
placid cape
#

well heh

placid cape
#

automatically promotes to double bcs C does

still jolt
#

the fuck is blom

placid cape
still jolt
#

oh okay fair enough

hoary sluice
#

its awesome

#

i (and a lot of ppl in the solutions megathread) were really close to the answer but ||off by 1 because the loop does g = b - c, then b+=17 and then checks if g == c but thats before adding 17 so its an inclusive range and eric made the last number always prime ๐Ÿ˜ญ ||

placid cape
#

52min delta time

hoary sluice
#

1 year left

hoary sluice
placid cape
#

ill do it after finishing 2015

hoary sluice
#

another issue i had was that my || is prime function was inverted|| but i fount that quickly

placid cape
#

hmmm i should fix it

#

to show it correctly

#

nwm its broken only on 2015

hoary sluice
#

if u finish it then its not broken

placid cape
#

true

spark tiger
dense sand
fleet cedar
#

Ah, so they're running low on contributors

dense sand
hoary sluice
#

why is 2017 so easy

spark tiger
dense sand
#

Does anyone know about any tool which can parse out javadocs?

#

Like into a json

dense sand
winged mantle
#

why into a json structure

dense sand
#

Out of an existing source

dense sand
winged mantle
#

isn't it a flat structure

#

maybe this

dense sand
#

Something i can read in javascript

winged mantle
#

what are your needs

#

what are you trying to do

dense sand
#

Better javadocs

winged mantle
#

if accuracy doesn't matter that much you could just try to write your own parser

#

because it's unlikely there are any for js

fleet cedar
winged mantle
#

ah well ig if you're trying to replace that you'll need accuracy

dense sand
dense sand
winged mantle
#

uh

#

just write your backend in java

dense sand
#

Ig if nothing else remains

winged mantle
#

or look at java parser's source code and work out what they do

#

but it's probably not the simplest thing to parse

dense sand
#

Its a really fucking abstracted clusterfuck

winged mantle
#

average java project

dense sand
#

Yea

winged mantle
dense sand
#

The JavadocNode is implemented by like 12 interfaces

winged mantle
#

they're probably all the different types of javadoc structures

hoary sluice
#

@valid jetty how to speed up general longest path

fleet cedar
#

Make graph smaller

hoary sluice
#

2017 d24 p2 takes 5s

hoary sluice
#

whats ur runtime for 2017 d24 @fleet cedar

fleet cedar
#

No idea, my repo only contains stuff from 19 onward

hoary sluice
#

i brought p1 from 5s to 300ms with a cache but p2 is uncacheable

hoary sluice
hoary sluice
#

im too incompetent to implement the other optimizitions

hoary sluice
placid cape
hoary sluice
#

i solved the halting problem!!!

fleet cedar
#

This seems to be my scores from long ago

hoary sluice
#

i cant keep procrastinating intcode for much longer ๐Ÿ˜ญ

fleet cedar
#

Yeah I hated intcode

placid cape
#

function overloading ๐Ÿ”ฅ

hoary sluice
#

2017 d25 is literally just parsing

#

i wouldve had ~#80 on lb

placid cape
#

okay im gonna do aoc now

hoary sluice
#

this is the worst problem for me rn cause im doing these on my new keyboard

#

and on a new layout

#

so i dont have symbol muscle memory

#

49% consistency husk

hoary sluice
#

alright its time to not do any aoc for the next 9 months

#

(i dont wanna do intcode)

valid jetty
valid jetty
placid cape
fleet cedar
#

Hype based

placid cape
#

but if you have more than one overload then for example this:

fun a(a: i64) -> i32 {...}
fun a(a: i64, b: i64) -> {...}

fun @public main() {
    return a(5);
}

Will not compile because 5 is i32 by default

#

but if you have only one overload then it'll implicitly cast it

#

so this works:

fun a(a: i64) -> i32 {...}

fun @public main() {
    return a(5);
}
#

I'll try to improve this later but for now it's enough

placid cape
#

Because it's an annotation, I'll probably make it as a keyword

hoary sluice
#

u can put annotations after the fun?

#

that seems wrong

fleet cedar
#

Kinda makes more sense than putting it before

#

Making it so function declarations always start with the fun keyword is nice

spark tiger
hoary sluice
fleet cedar
#

Simp

spark tiger
#

ah. i thought itโ€™s like one-time purchase

hoary sluice
#

it is

placid cape
valid jetty
placid cape
valid jetty
#

fun

hoary sluice
hoary sluice
#

in kotlin its before the fun keyword

placid cape
#

you can do it also after the type if I'm not mistaken

valid jetty
#

why not above the type like rust

#

#[macro_export]

placid cape
#

that's probably even better yeah

#

this was easier to parse

valid jetty
#

idk in elle i have it after the param list but before the return type

#

fn foo(i32 a) @volatile @fmt -> string

placid cape
#

eventually i want to make it above like in rust/java (java allows it almost everywhere)

placid cape
#

no?

#

Okay

hoary sluice
#

after the visibility mod but not after the type / fun

valid jetty
#

i made modifiers in any order because itโ€™s easier to parse

#

pub external fn and external pub fn

hoary sluice
#

do u have annotations

valid jetty
#

yea

#

@alias(โ€œfooโ€), @volatile, @fmt, @manual

placid cape
valid jetty
#

i call them โ€œattributesโ€ tho

valid jetty
hoary sluice
valid jetty
#

no

hoary sluice
#

oh

valid jetty
#

attributes come before the return type but after param list

hoary sluice
#

meh i think it makes more sense to put them first

valid jetty
#

idk

#

this is what they do

hoary sluice
#

thats not what volatile means is it

valid jetty
#

itโ€™s not

#

lol

#

volatile in C says to the compiler it shouldnโ€™t optimize, reorder, or remove the variable/function through dead code elimination

#

but it works fine here i guess

hoary sluice
#

i just know that if a variable is modified in an interrupt service routine it should be made volatile

valid jetty
#

yeah it mostly says to the compiler โ€œdonโ€™t make any assumptions about how to treat this variableโ€

#

which means the compiler canโ€™t do instruction reordering and optimization as a result

placid cape
# hoary sluice i just know that if a variable is modified in an interrupt service routine it sh...

In computer programming, a value is said to be volatile if it can be read or modified asynchronously by something other than the current thread of execution.
The value of a volatile variable may spontaneously change for reasons such as:
sharing values with other threads;
sharing values with asynchronous signal handlers;
accessing hardware devi...

hoary sluice
#

don't reorder volatile reads and writes

#

this is prob the important part

hoary sluice
#

@placid cape how do you parse >=

placid cape
#

it's in lexer same like @valid jetty has

#

I know it shouldn't be in lexer

hoary sluice
#

is that GreaterEqual or [Greater, Equal]

placid cape
#

GreaterEqual

hoary sluice
#

idk maybe thats easier

dense sand
#

does anyone here know how to use teavm

dense sand
#

@ionic lake you have worked with shadcn i suppose

ionic lake
#

sup

ionic lake
dense sand
#

well theres this thing called sidebar

ionic lake
#

oh yeah that's new

dense sand
#

the thing is that i dont really know how to make it show under the top menu bar

#

it overlaps it

ionic lake
#

yeah that's ok

#

oh nevermind

#

how are you doing this, show your app

dense sand
#

currently its like this, where Navbar is my component

#

this is kinda what i want if you get me

hoary sluice
#

hop on hypixel disasters

dense sand
#

you mean hypixel skyblock?

#

i really didnt want to make my own sidebar but i guess ill have to

hoary sluice
#

nah hypixel disasters

dense sand
#

This is literally copy of a roblox game

hoary sluice
#

sad think is ik which one ur talking abt

ionic lake
dense sand
#

cause siderbar has to be inside siderbarprovider

ionic lake
#

yeah move that entire block above

valid jetty
#

i fucking HATE c#

dense sand
#

nope

#

well ill try to tinker with the internal code

valid jetty
#

instead of just letting me do this

[Serializable]
class GameState {
    public Grid playerFleet = new();
    public Grid computerFleet = new();
    public Grid targetTracker = new();

    public void Clear() {
        playerFleet.Clear();
        computerFleet.Clear();
        targetTracker.Clear();
    }
}

class SaveManager {
    private const string SaveFileName = "gamestate.dat";

    public void Save(GameState state) {
        using (FileStream fs = new FileStream(SaveFileName, FileMode.Create)) {
            BinaryFormatter formatter = new();
            formatter.Serialize(fs, state);
        }
    }

    public GameState Load() {
        using (FileStream fs = new FileStream(SaveFileName, FileMode.Open)) {
            BinaryFormatter formatter = new();
            return (GameState)formatter.Deserialize(fs);
        }
    }
}
``` to save and load data
#

they deprecated BinaryFormatter

#

because its "unsafe"

#

so i literally cant use it without installing an external package

#

my other options are all convoluted bloated things like converting to json or using a BinaryWriter/Reader with reflection

#

when it would just be this simple

ionic lake
dense sand
#

that would be cool

ionic lake
#

or, even if i hate to say, you can try shoving it to v0 and let it do it

#

look at the <aside> chunk in that code

hoary sluice
#

its intcode time

spark tiger
#

also i recently was wondering if there's an easy way to serialize an object in rust into a binary file

fleet cedar
#

Serde+bincode?

spark tiger
#

oh yeah sounds like it

#

i kinda wish it was simpler to parse binary file in rust though

#

like in c# it's just

var reader = new BinaryReader(stream);
Size = reader.ReadInt32();
FormatSize = reader.ReadInt32();
#

while in rust it's something insane

fleet cedar
#

It can be exactly that in rust too

#

Depends on how you define the apis

hoary sluice
spark tiger
#

theo jumpscare

fleet cedar
#

But ReadInt32 is quite ambiguous - is it le or be?

ionic lake
#

that's not theo

spark tiger
spark tiger
#

i forgot his name

ionic lake
#

theprimeagen

spark tiger
#

yeah this

hoary sluice
spark tiger
fleet cedar
#

What do you mean built in

#

They're completely normal functions, defined on a completely normal struct

spark tiger
#

oh

hoary sluice
fleet cedar
#

(Or rather, u32 is defined in the Le trait, and just calls u32le)

spark tiger
spark tiger
spark tiger
#

oh

#

ffs

fleet cedar
hoary sluice
# spark tiger oh

you can tell because function namer arent PascasCase (worst decision ever)

valid jetty
# spark tiger ```cs var stream = new MemoryStream(); var writer = new BinaryWriter(stream); w...

i wrote this beauty

class SaveManager {
    public const string Name = "state.bin";

    public void Save(GameState state) {
        using (BinaryWriter writer = new(File.Open(Name, FileMode.Create))) {
            WriteObject(writer, state);
        }
    }

    public GameState Load() {
        using (BinaryReader reader = new(File.Open(Name, FileMode.Open))) {
            return (GameState)ReadObject(reader, typeof(GameState));
        }
    }

    private void WriteObject(BinaryWriter writer, object obj) {
        Type type = obj.GetType();

        foreach (var field in type.GetFields(BindingFlags.Public | BindingFlags.Instance)) {
            object value = field.GetValue(obj)!;
            if (value is Grid grid) WriteGrid(writer, grid);
        }
    }

    private object ReadObject(BinaryReader reader, Type type) {
        object obj = Activator.CreateInstance(type)!;

        foreach (var field in type.GetFields(BindingFlags.Public | BindingFlags.Instance)) {
            field.SetValue(obj, ReadGrid(reader));
        }

        return obj;
    }

    private void WriteGrid(BinaryWriter writer, Grid grid) {
        writer.Write((Byte)grid.kind);

        for (int row = 0; row < Config.GRID_SIZE; ++row)
            for (int col = 0; col < Config.GRID_SIZE; ++col)
                writer.Write(grid[row, col]);
    }

    private Grid ReadGrid(BinaryReader reader) {
        Grid grid = new((GridKind)reader.ReadByte());

        for (int row = 0; row < Config.GRID_SIZE; ++row)
            for (int col = 0; col < Config.GRID_SIZE; ++col)
                grid[row, col] = reader.ReadChar();

        return grid;
    }
}
#

its almost the binaryformatter

#

just a little extra bloat

valid jetty
fleet cedar
valid jetty
#

and i need to for school

#

if i get in trouble for publishing the source code its whatever

nimble bone
spark tiger
fleet cedar
#

First party tho

#

And yes, if adding one line of toml counts as hard, you're gonna have trouble

frosty obsidian
#

they didn't say including the library is hard

#

they said that it's hard without the library

fleet cedar
#

Yeah and driving a car is difficult without tires

valid jetty
royal nymph
valid jetty
#

yeah

#

sorry

frosty obsidian
#

i think reading binary files should be a simple thing in any language

#

you shouldn't need a library to do it

fleet cedar
#

If you want to add nonsensical constraints to your language ratings you should state so upfront so I can disregard them

frosty obsidian
#

i don't think trying to avoid third party libraries is that nonsensical of a constraint

fleet cedar
#

It is

spark tiger
#

i expected messing with binary being easier in low-level languages but it seems like it's not

fleet cedar
#

Imo that is exactly the kind of thing that has no place in a stdlib since there's a billion different ways to do it

#

Choosing one of those ways to be Objectively Superior is exactly what a stdlib should avoid

spark tiger
#

not "hard" but uhhh

fleet cedar
#

Easy to add, hard to design

#

And zero (or imo negative) value in adding, since using a crate is more adaptive

#

Rust's stdlib is designed around the assumption that you will use external crates for more specialized things

#

And that is the correct design

spark tiger
#

you have a point i guess, but that's still quite confusing to me ๐Ÿ˜”
i guess i'll probably stick with doing my own small implementation of stuff like read_u32, read_u64, etc., but i'm still not quite sure about all these types of uh readers. like each solution i've found on forums suggest different ones: Cursor, BufReader, Vec, [u8], ...
arghhh why is rust so hard

fleet cedar
#

And that is exactly why such a thing has no place in a stdlib

placid cape
#

I want to do 2019 intcode so much tbh

fleet cedar
#

Who's stopping you

valid jetty
#

me

#

@placid cape dont do it im warning you

placid cape
fleet cedar
#

Ah, superstition

placid cape
#

ยฏ_(ใƒ„)_/ยฏ

#

And rosie is warning me

fleet cedar
#

But you will do it anyway

#

You cannot resist fate

hoary sluice
hoary sluice
#

if you do it properly

hoary sluice
fleet cedar
hoary sluice
#

Ok its not that bad

#

Its a sealed class with 1 abstract method thats inherited by 10 other classes who implement it

#

and coroutines invoking the correct class' method according to the opcode

#

Channel for io

placid cape
#

sealed class ๐Ÿ˜

pearl stagBOT
ornate quiver
#

scary syntax

#

i didnt know char[,] existed

fleet cedar
#

Is that a 2d array

ornate quiver
#

yeah

#

you can add more commas for more dimensions

valid jetty
ornate quiver
#

fun

placid cape
#

C# husk

valid jetty
#

yeah

#

i would do it in elle if i had the choice

ornate quiver
#

"hey i wrote my project in a language i made myself is that okay"

valid jetty
#

i mean im doing that for the bigger version of this project

#

im gonna write a compiler for a dummy language in elle

#

they say it can be any language so it should be fine i hope

placid cape
#

elle in elle ๐Ÿ”ฅ

ornate quiver
#

lol

placid cape
#

tmrw ill probably start working on field access

valid jetty
#

good luck that took me a while to get right

valid jetty
#

elle calculator

use std/prelude;
use std/time;

fn calculate(string input) {
    let exec_path = "{}".format(time(nil));
    let src_path = "{}.le".format(exec_path);
    let src = "
        use std/io;

        fn main() {{
            io::println({});
        }
    ".format(input);

    if !io::write_to_file(src_path, src) {
        return false;
    }

    if !libc::system("ellec {} --hush".format(src_path)) {
        libc::system("./{}".format(exec_path));

        io::remove(src_path);
        io::remove(exec_path);
    }
}

fn main() {
    while true {
        calculate(io::input("-> "));
    }
}
#

or elle repl technically

#

depending on how you wanna look at it

#

it doesnt do line backhandling like the py one tho

#

but i can make it do that

nimble bone
valid jetty
#

yeah probably

valid jetty
#

backlog repl rewritten in elle

use std/prelude;
use std/time;

const string SHORT_EXTENSION = ".le";

fn main(string[] args) {
    let program = args.remove(0);
    string[] lines = [];

    while true {
        let line = io::input(".เณƒเฟ”* -> "));

        if line.ends_with(";") {
            line.pop();
        }

        let backlog = "{}{}".format(
            lines.join(";\n{}".format(" ".repeat(16))),
            lines.len() > 0 ? ";" : ""
        );

        let code = "
            use std/prelude;

            fn main() {{
                {}
                io::println({});
            }".format(backlog, line)
         .split("\n")
         .map<string>(fn(string x) x.replace(" ".repeat(12), ""))
         .join("\n");

        if line == "<!dbg>" {
            io::println(code);
            continue;
        }

        let src_path = ".repl-{}{}".format(time(nil), SHORT_EXTENSION);
        let exec_path = "./{}".format(src_path.replace(SHORT_EXTENSION, ""));

        if !io::write_to_file(src_path, code) {
            io::eprintf("Failed to write to file at path: {}", src_path);
            continue;
        }

        let src_code = libc::system(
            "ellec --hush {} {}".format(
                args.join(""),
                src_path
            )
        );

        io::remove(src_path);

        if !src_code {
            let exec_code = libc::system(exec_path);
            io::remove(exec_path);

            if !exec_code {
                lines.push(line);
            }
        }
    }
}
#

ive GOTTA make a file abstraction soon

dawn ledge
dense sand
#

Is Prisma bad?

#

Like i hear all these opinions to use drizzle or typeorm instead

#

But im pretty comfortable with prisma

placid cape
#

I always used prisma

#

It's just probably a bit slower

dense sand
#

well yea same

#

prisma is really comfy to use blobcatcozy

#

maybe i should stop watching theo fr

placid cape
ornate quiver
#

i like writing my own sql

hoary sluice
#

the only real database is a plaintext file and you use the kotlin stdlib to write queries

#

@valid jetty when is elle gonna compile to intcode

placid cape
#

intcode IR

hoary sluice
#

@placid cape i am the biggest 2019 day 7 procrastinator

#

i have had 2019 day 8 solved and gitignored for almost 2 years cause i wanted to push in order and didnt have a proper day 7 solution lol

#

i think 2019 d7 is my longest delta

placid cape
#

i'll have big delta for 2019 d2

#

idk why i solved p1 before

hoary sluice
#

omg day 9 is so free now

dense sand
#

@placid cape XDDDDDD

#

look at the file

hoary sluice
#

@placid cape i submitted nv as my answer again

#

so annoying

#

couldve had a new delta pb

#

17s

#

finally done with intcode

#

didnt even take that long

placid cape
placid cape
#

I just solved d16 y2015

#

2015 is so easy tbh

viscid grove
dense sand
viscid grove
#

oh yeah looks like it

@jiratickets
made a bait post that blew up and now just feel bad about all of the nice people replying with kindness and encouragement. how does yacine live like this

hoary sluice
#

wtf???

placid cape
#

Kotlin doesn't have gcd in std?

#

nvm it doesn't

hoary sluice
#

idk

#

nvm its not wrong

#

i just needed to take the abs

#

for 2019 day 10

hoary sluice
#

i took an hour for p1 and 19 mins for p2, lb took 13min/42min

#

this is so cursed

fleet cedar
#

Show code

#

Looks like mine does funny numpy trickery in 28 lines

hoary sluice
#

part 1 is a hack

#

the number of things a node sees is also the number of unique minified (divided by gcd(dx, dy)) distance vectors

fleet cedar
#

I just used atan2 for that

hoary sluice
#

if 2 nodes are collinear they share the minified vector

hoary sluice
fleet cedar
#

I can then ||sort by that angle|| for p2

hoary sluice
#

i used it in part 2 cause there was a similar problem in aoc that required atan2

hoary sluice
#

i think my p1 probably has a faster runtime

#

but p1+p2 is slower cause i compute the angle anyways

fleet cedar
#

Mine allocates a n^2 array which is kinda unnecessary

hoary sluice
#

i wrote a proper blocking detection system, but it wasnt giving me the correct answer for p1 so i rewrote it with the minified vector approach and then had to remake the blocking detection in p2 cause i deleted it husk

fleet cedar
#

Actually, looking at the numbers, much of my p2 is unnecessary

fleet cedar
#

I think something like this would be more up to modern standards||```py
import cmath;P=cmath.phase;E=enumerate
p={i-j*1j for i,l in E(open("10.in"))for j,c in E(l)if"#"==c}
print(max((len(x:=sorted({P(s-a)%9 for a in p})),(m:=s-min((s-a for a in p if P(s-a)%9==x[199]),key=abs)).real-m.imag100)for s in p))

hoary sluice
#

disgusting

dense sand
#

this is becoming such a scuffed project

placid cape
#

2019 aoc is really interesting

#

can't wait for it

valid jetty
#

looks like an atan2 thing

#

i think my vector impl in elle would come in useful for that

hoary sluice
#

doing p2 without atan2 would be horror i think

dense sand
#

yall are good optimizers, is there any way to optimize this to run faster? For guava it took like 3 seconds which seems horrible(2k entries)

public Set<String> getAvailableClasses() {
    URI sourceFileUri = UriComponentsBuilder.fromUriString(getUri())
            .path("/")
            .path(getArtifactId() + "-" + getVersion() + ".jar")
            .build().toUri();

    try (var is = new ZipInputStream(sourceFileUri.toURL().openStream())) {
        Set<String> classes = new HashSet<>();
        ZipEntry entry;
        while ((entry = is.getNextEntry()) != null) {
            if (entry.getName().endsWith(".class")) {
                classes.add(entry.getName().replace(".class", "").replace("/", ".")
                        .replace("$", "."));
            }
        }
        return classes;
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
fleet cedar
#

Run a profiler to find what takes time

valid jetty
#

@placid cape

placid cape
dense sand
#

apparently you can declare a class inside of a method?

placid cape
#

Funny

#

I never tried it lol

valid jetty
#

and they act as just objects

dense sand
#

like these, they do the same thing

valid jetty
#

like you can do stuff like this

public class Main {
    public static void main(String[] args) {
        Object obj = new Object() {
            @Override
            public String toString() {
                return "foo";
            }
        };
        
        System.out.println(obj);
    }
}
#

yah

#

that

dawn ledge
#

they be copying rust

#

smh

valid jetty
#

@hoary sluice [solution.le:30:13] Array<Tuple<i64, Triple<i32, Tuple<i64, i64>*, Array<Tuple<i64, i64>*>*>*>*>* queue = <[(12, (0, (0, 0), [(0, 0)]))] at 0x1400094f0> LMAO

#

the let is saving my life

let queue = [$(dist(start, t), $$(0, start, [start]))];
io::dbg(queue);
fleet cedar
#

Why so many pointers

#

Why >*>*>*>*>* and not just >>>>>

valid jetty
#

because arrays need to be pointers to be able to be pushed to

#

and idk why i made tuples and triples pointers

fleet cedar
#

An array needs to contain a pointer, sure

#

But why would that be part of the type? It's just the struct's internals isn't it

valid jetty
#

you could technically write Array<Tuple<i64, Triple<i32, Tuple<i64, i64>*, Array<Tuple<i64, i64>*>*>*>*>* as (i64, Triple<i32, (i64, i64), (i64, i64)[]> *)[] lol

valid jetty
#

it has that

#
struct Array<T> @nofmt {
    i32 size;
    i32 capacity;
    T *elements;
};
#

the pointer to Array<T> is so the structure can be modified in place

fleet cedar
#

So things not in pointers are immutable...?

valid jetty
#

no but theyre copied

fleet cedar
#

So you don't have anything like rust's &self

valid jetty
#

if you want to have Array::push and it takes Array<T> not Array<T> * you wont edit the array youll just edit a clone of the array

fleet cedar
#

Kinda like c++ but you chose the different choice?

valid jetty
fleet cedar
#

Why not

valid jetty
#

so its easier if the array is just always a pointer

#

if the array is a param of a function

#

like

fn foo(Array<T> x) {
    x.push(1);
}
#

you dont explicitly allocate stack memory in the IR for this so you cant get its address

fleet cedar
#

So you're letting implementation details guide your design

valid jetty
#

sort of, i do have a workaround

#

if there is some value T and there is no address, it goes and allocates stack memory for it of size T and stores the value there, then returns that address

#

but again, that wont modify x

fleet cedar
#

Implicit copying is the devil

#

One of my (very many) least features of c++

valid jetty
#

which is exactly why itโ€™s always a pointer

#

you never deal with Array<T> itself you just have a T[] which is an alias for Array<T> *

#

and so it doesnโ€™t copy all over the place and actually mutates the array when you expect it to

#

if you were to do

fn foo(i32[] x) {
    x.push(1);
}

fn main() {
    let x = [100, 39];
    foo(x);
}
``` you would expect `x` to be mutated surely
#

if x was a Array<T> and not Array<T> * it wouldnt be

#

and if you dont want it to mutate there is a .clone() method on Array

fleet cedar
#

And when is the array's memory freed?

valid jetty
#

currently at the end of the program's runtime, along with every other allocation

#

i still havent come up with a good solution for this

fleet cedar
#

So, leaked

valid jetty
#

no

#

all allocations are pooled into an arena allocator who's pointer is stored in static memory and the arenas are all freed at the end of the program

#

there are no leaks

fleet cedar
#

"Not freed until the program ends" is the exact definition of a memory leak

valid jetty
#

technically yes but the allocations are still tracked by the compiler so i want to eventually expand this into a gc lol

valid jetty
dense sand
#

it takes 2 seconds to fetch this data ๐Ÿ˜ญ im so cooked with my code

valid jetty
#

day 19 in elle

use util;

fn count_ways(HashMap<string, i64> *memo, string d, string[] ps) {
    if memo.contains_key(d) {
        return memo[d];
    }

    if d.is_empty() {
        return 1;
    }

    i64 ways = 0;
    for p in ps {
        if d.starts_with(p) {
            let remaining = d.slice(p.len(), d.len());
            ways += count_ways(memo, remaining, ps);
        }
    }

    memo[d] = ways;
    return ways;
}

fn main(string[] args) {
    let parts = io::read_to_string(args[1]).split("\n\n");
    let ps = parts[0].split(", ");
    let ds = parts[1].split("\n");
    let memo = HashMap::new<string, i64>();

    i64 c1 = i64 c2 = 0;

    for d in ds {
        let res = count_ways(memo, d, ps);
        c1 += res >= 1;
        c2 += res;
    }

    io::dbg(c1, c2);
}
valid jetty
#

why tf does python sort sets

#

maybe its just when printing

#

{(0, 0), (0, 1), (0, 2), (0, 3), (0, 4), (0, 5), (0, 6), (0, 7), (0, 8), (0, 9), (0, 10), (0, 11), (0, 12), (0, 13), (0, 14), (1, 0), (1, 4), (1, 14), (2, 0), (2, 2), (2, 4), (2, 6), (2, 8), (2, 10), (2, 11), (2, 12), (2, 14), (3, 0), (3, 2), (3, 6), (3, 8), (3, 10), (3, 14), (4, 0), (4, 1), (4, 2), (4, 3), (4, 4), (4, 5), (4, 6), (4, 8), (4, 10), (4, 12), (4, 13), (4, 14), (5, 0), (5, 1), (5, 2), (5, 3), (5, 4), (5, 5), (5, 6), (5, 8), (5, 10), (5, 14), (6, 0), (6, 1), (6, 2), (6, 3), (6, 4), (6, 5), (6, 6), (6, 8), (6, 10), (6, 11), (6, 12), (6, 14), (7, 0), (7, 1), (7, 2), (7, 6), (7, 10), (7, 14), (8, 0), (8, 1), (8, 2), (8, 4), (8, 5), (8, 6), (8, 7), (8, 8), (8, 9), (8, 10), (8, 12), (8, 13), (8, 14), (9, 0), (9, 4), (9, 5), (9, 6), (9, 10), (9, 14), (10, 0), (10, 2), (10, 3), (10, 4), (10, 5), (10, 6), (10, 8), (10, 10), (10, 11), (10, 12), (10, 14), (11, 0), (11, 2), (11, 6), (11, 8), (11, 10), (11, 14), (12, 0), (12, 2), (12, 4), (12, 6), (12, 8), (12, 10), (12, 12), (12, 13), (12, 14), (13, 0), (13, 4), (13, 8), (13, 12), (13, 13), (13, 14), (14, 0), (14, 1), (14, 2), (14, 3), (14, 4), (14, 5), (14, 6), (14, 7), (14, 8), (14, 9), (14, 10), (14, 11), (14, 12), (14, 13), (14, 14)}

hoary sluice
#

when 2019 day 10 in elle

placid cape
#

sets are unordered

valid jetty
#

thats what i thought but for some reason when i print a set its always in order

valid jetty
#

will take a while because im procrastinating so much i cant even finish this year in elle

valid jetty
#

whaaaaa

fleet cedar
valid jetty
#

oh

#

true

fleet cedar
#

Mine doesn't print them in order ```py

{(0, 0), (0, 1), (0, 2), (0, 3), (0, 4), (0, 5), (0, 6), (0, 7), (0, 8), (0, 9), (0, 10), (0, 11), (0, 12), (0, 13), ...
{(12, 4), (4, 0), (5, 1), (8, 0), (14, 13), (5, 10), (8, 9), (10, 6), (0, 5), (2, 2), (11, 14), (0, 14), (2, 11), (13, 8), ...

valid jetty
#

did i just get super lucky doing this then

c = set(list(c)[:b])
``` where `c` is a set
#

and the order is preserved

fleet cedar
#

Which python is it?

placid cape
#

it still prints in same order

valid jetty
#

Python 3.10.14 (39dc8d3c85a7, Nov 09 2024, 22:52:48)
[PyPy 7.3.17 with GCC Apple LLVM 15.0.0 (clang-1500.1.0.2.5)]

fleet cedar
#

Yeah seems pypy prints them in order

#

Cpython does not

valid jetty
#

ah

#

i wonder if my solution wouldve been wrong if i use cpy instead of pypy

fleet cedar
#

Weird to have pypy aliased as python though

placid cape
#

ill run it

#

but probably yeah?

valid jetty
#

yes it is ๐Ÿ˜ญ

fleet cedar
#

If you rely on set ordering then you're wrong

valid jetty
#

its wrong with python3

valid jetty
placid cape
#

i had to do this after bron kerbosch

valid jetty
#

but that was a bug in my original solution

placid cape
#

because sets are unordered

valid jetty
#
def solve(c, s=71, b=1024):
    c = set(list(c)[:b])
    return find(c, s)

with open(sys.argv[1]) as f:
    c = set()

    for line in f:
        x, y = map(int, line.strip().split(','))
        c.add((x, y))

    print(solve(c))
    print(solve2(c))
``` i was doing this and it just shouldnt work but pypy orders sets in order of adding items so it does work lol
#

should be this instead

def solve(c, s=71, b=1024):
    c = set(c[:b])
    return find(c, s)

with open(sys.argv[1]) as f:
    c = []

    for line in f:
        x, y = map(int, line.strip().split(','))
        c.append((x, y))

    print(solve(c))
    print(solve2(c))
placid cape
#

i wonder why pypy has ordered sets lol

valid jetty
#

idk if them being ordered is an invariant it may just be a random side effect

#

wtf did i do

#

why is it doing that

#

im doing like the most basic formatting thing ever

#

and the weirdest thing is it breaks for a second then returns back to workig fine

#

?????????????????????????/ what in the

#

maybe im incorrectly assuming the arena has enough space and then it doesnt

hoary sluice
#

pretty sure this is just jgrapht docs

#

find 2 subgraphs of size a, b such that there is at least one edge between them

valid jetty
#

she has decided she wants to visit a b and c attractions so she has decided she is gonna spill math words

valid jetty
hoary sluice
valid jetty
#

ah yes

#

the bfs

#

my favourite textbook dijkstra

hoary sluice
#

its the same algo

#

different sorting

valid jetty
#

how long do you have to solve this problem

hoary sluice
#

idk

#

5 hours per problem apparently

#

gn

#

In 5h i could make a 3d visualisation of this

valid jetty
#

lmao true

valid jetty
valid jetty
#

@royal nymph opinions on this

fn $scoped(fn *func) {
    let current = #env.allocator;
    #env.allocator = ArenaAllocator::new();
    func();
    #env.allocator.free_self();
    #env.allocator = current;
}

fn main() {
    let a = 5;
    $scoped(fn() {
        #env.allocator.alloc(1024 * 1024 * 1024);
    });
    // All freed after this function is called
}
#

insta husk holy shit

royal nymph
#

make it a macro instead so you dont have to use an inline func

#

and dont use $ its weird

valid jetty
#

"#" is reserved for compiler builtins
"@" is reserved for function and struct attributes

calling it just "scoped" is weird

#

and there are no macros yet

royal nymph
#

oh it's elle

#

why tf u using rust language block

#

i thought u meant in rust

#

anyway just add using/with blocks

fleet cedar
#

Probably because discord doesn't have elle highlighting yet

#

Someone should make a plugin for that

royal nymph
#
using(mem = #env.allocator.alloc(1024 * 1024 * 1024)) {
}
valid jetty
#

no because thats not the purpose of it

#

thats just an example of what you can do

#

the purposes is like

#

because the allocator doesnt clean up after itself

#

if you have to allocate memory during a loop like a game render loop

#

itll just keep piling

#

if you $scoped it, everything will be allocated and freed on every iteration

#

like a temp allocator

#

the purpose isnt to scope only a single allocation and free it afterwards its to allocate a bunch into an autofreed chunk

#

sort of like the way stack allocations work but for the heap

#

specifically like, here

#

.format allocates heap memory because the string has to grow in size so it cant be stack allocated

#

and if this is ran in a loop itll just keep allocating

#

with $scoped itll free itself after its done

wooden walrus
#

helfo heres a pic of some python code i did

valid jetty
#

oh right wait elle doesnt let you capture things

#

so actually itll be more like this

fn $scoped(fn *func, void *arg) {
    let current = #env.allocator;
    #env.allocator = ArenaAllocator::new();
    func(arg);
    #env.allocator.free_self();
    #env.allocator = current;
}

fn main() {
    let a = 5;

    $scoped(fn(i32 *x) {
        #env.allocator.alloc(x);
    }, &a);
    // All freed after this function is called
}
#

ARE YOU SERIOUS

fleet cedar
#

Mangle your idents

valid jetty
#

so it has to be

fn mem::scoped(fn *func, void *arg) {
    let current = #env.allocator;
    #env.allocator = ArenaAllocator::new();
    func(arg);
    #env.allocator.free_self();
    #env.allocator = current;
}

external fn mem::scoped(fn *func, void *arg) @alias("$scoped");
valid jetty
pearl stagBOT
#

index.html: Lines 107-113


<script src="./Javascript/72b5c5874930d6222007ea7b99269673dad47bcb7355815024742ddf575ca55f.js"></script>

<script src="./Javascript/clipboardInterceptor.js"></script>

<script disable-devtool-auto src='./Javascript/bee50f64f68a2feb114d80f4a2f1337fc164bc5574f6689ce9464be7f5ccf1ed.js'></script>
<!--<script src="./Javascript/d178e32824befa1fe8305a075094c8b669b88e27b4dba91c55abca73b3f081f0.js"></script>-->
placid cape
placid cape
#

maybe because you don't allow inner variables in lambda ๐Ÿค”

valid jetty
#

because scoped is performing a special task of providing a clean allocator which automatically frees everything it allocates after the function call

#

a regular block doesnt imply the allocator will free everything inside afterwards because the arena allocator isnt recreated

#

you also cant free a part of an arena only the whole arena

#

so you either free all or nothing

pearl stagBOT
# ornate quiver <https://github.com/messcheg/advent-of-code/blob/main/AdventOfCode2015/Day07/Day...

Day07.rock: Lines 52-67

Robert wants control
Cut control into pieces
The code is attractive
Put pieces at the code into the box
A ray is very gleaming
Cast a ray
The room is large enough
Build the room up
Cast the room
while the box ain't misterious
if the box is smaller than a ray or the box is bigger than the room give back lies
build the code up
put pieces at the code into the box
baby
the truth is right
give it back
valid jetty
#

thats fizzbuzz

#

ok well

#

this isnt the prettiest thing ever

$scoped(fn(i32 bounces) {
    string bouncesString = "Bounces: {}".format(bounces);
    raylib::draw_text(bouncesString, (screenWidth - raylib::measure_text(bouncesString, fontSize)) / 2, 100, fontSize, YELLOW);
}, bounces);
#

but it doesnt segfault anymore

#

and i discovered a huge bug in my formatter code lol

#
let result = (string)#env.allocator.alloc(fmt.len());

the result used to be preallocated to at least the length of the formatter

#

but never memset

#

which is just UB

#

the length of that string is just whichever null byte it finds (there isnt any set)

#

its much better to make it like just an empty string

let result = "";
#

because the string.push and string.extend/concat are designed to make it grow

dense sand
#

what is a reasonable amount of props to have on a component

dense sand
#

cuz im using nextjs and i might be passing a lot of stuff from the server component into client subcomponent

placid cape
#

how many?

dense sand
#

its 5 now

placid cape
#

i think that's okay

hoary sluice
#

ty

dense sand
#

why is there 0 parsers support es6 modules

#

what is this

placid cape
#

babel supports everything

dense sand
#

Most of them still use commonjs

#

But i found some fast-xml-parser whic works ig

placid cape
#

ohh

#

it should be possible to use commonjs modules with esm

dense sand
#

Do yall know of any optimized version of ZipInputStream

royal nymph
hoary sluice
#

@valid jetty you are going to do 2019 day 12

#

crt - ish problem

hoary sluice
#

i had to look up a hint in the subreddit cause i was completely lost after an hour

#

the solution is so simple ๐Ÿ˜ญ

royal nymph
dense sand
#

comedy ๐Ÿ˜ญ

#

i should probably extract it into layouts instead

viscid grove
#

Guava

dense sand
#

yea im making javadocs 2

hasty vessel
#

sure do love pygame

celest lodge
#

you may start crying

torn seal
#

lmao

celest lodge
#

it is not good

torn seal
#

are you trying to make a coreutils replacement or what

celest lodge
#

i got bored one day

#

i wanted to see how hard it was to make a posix-y ls

valid jetty
#

@fleet cedar i finally fixed the struct double alloc thing

#

no more double alloc to dynalloc a struct

#

the issue was when i was doing autoderef on Foo*

#

it makes no sense to hold a Foo

#

so doing a load instruction on that ptr would give you a nullptr deref

dense sand
#

Is there any way I can pass something from layout to page in nextjs?

valid jetty
#

i just removed that part and it works for both Foo and Foo* field access

#

now i need to go and fix all of the places i did double alloc ๐Ÿฅฒ

placid cape
#

i need to work on field access and oeprator overloading

hoary sluice
#

@deep mulch HII

dense sand
#

we are finishing this one ๐Ÿ—ฃ๏ธ

placid cape
#

looks reallly nice

deep mulch
dense sand
# placid cape nice design

yea im just hoping that converting this hell lot of classes into package based tree wont slow this site down by a lot

valid jetty
#

vcotd

elder yarrowBOT
placid cape
dense sand
#

so it cant really be done on build time

valid jetty
#

to deref a structptr into a struct i kinda just do .. nothing

#

i just return the same value with a different type (Foo * and Foo are equivalent actually)

#

its weird that it works like that

#

in this

use std/prelude;

struct Foo {
    i32 a;
};

fn main() {
    Foo *foo = #env.allocator.alloc(#size(Foo) * 4);
    foo[0].a = 42;
    foo.a = 42;
}
``` those are the same thing
dense sand
#

okay i added class lists :D

valid jetty
#

guaba

dense sand
#

yea i mean its kinda the best thing to see it on

placid cape
#

foo[0].a thats weird

valid jetty
#

how

#

you would do like
foo[0].a = 42; foo[1].a = 39; etc

#

the allocation is for 4 Foos

placid cape
#

ohh didnt see that

valid jetty
#

but yeah because of auto deref rules foo[0] and foo and *foo are actually the same thing

#

its really weird but the c compiler does the same thing for llvm so

placid cape
#

i have to rewrite my semicolon parsing

#

it's horrible and has bugs

winged mantle
#

got a mechanical keyboard and idk if it's better for programming tbh because it's really hard not to make typos

dense sand
#

i cant type on membrane now lol

winged mantle
#

how do you type without knocking the arrow keys

dense sand
#

huh lol

#

what size do you have?

winged mantle
#

no numpad

dense sand
#

tkl?

#

i have tkl too

#

i just... dont touch the arrow keys at all?

winged mantle
#

my palm presses them

dense sand
#

wth idk

winged mantle
#

and it can only be avoided by lifting my hands an uncomfortable amount

dense sand
#

wtf lol

winged mantle
#

the tiniest bit of pressure registers on the connected device

#

it's also very easy to press ctrl by accident meaning if you try to type an R it reloads

#

also this is horrible lol

placid cape
hoary sluice
#

@placid cape 2019 is really fun

placid cape
#

make 15s english

hoary sluice
#

and probably also the most difficult

#

day 13 requires you to write a breakout ai

placid cape
#

interesting

hoary sluice
#

but there is no anticheat

#

cause its intcode

#

so there are a few silly solutions

placid cape
#

ill try to finish 2015 until end of next weekend

hoary sluice
placid cape
#

rust????!

hoary sluice
#

yes

#

the keyboard is called ferris sweep, its a fork of the ferris keyboard and ferris is the name of the rust crab

#

thats why hes holding a broom

#

cause sweep

#

get it haha

hoary sluice
#

cause i think ur turning ur hands to not have to angle your wrists in a silly way and hence pressing arrow keys