#💽Programming Chat v2

1 messages · Page 16 of 1

timid quartz
#

but owning my own data is cool

#

so mm idk

spare quartz
timid quartz
#

it would be fun

#

but

#

no time

spare quartz
#

:<

timid quartz
#

besides

#

the atprotocol

#

is probably kinda beefy

#

and unlike http and smtp you kinda need a fuller version to be able to test

spare quartz
#

:<

#

lame,,

timid quartz
#

eh I think I'll just be cringe and use bsky.social

spare quartz
#

noooo

timid quartz
spare quartz
#

at lesat change the handle....

timid quartz
#

I am...

#

giving dns a minute or so to update

#

what's ur bsky stinky

spare quartz
#

javart.zip

timid quartz
#

followed

#

anyways

#

I have like

spare quartz
#

Blocked.

timid quartz
#

a whole list of shit

#

KYS

#

@spare quartz

#

im gonna add rust atprotocol

spare quartz
#

"lua interpreter"

#

yknow i've always wanted to do that but i didn't know where to start

timid quartz
#

just interpret

#

you've made a jvm before

#

same principle

spare quartz
#

lua doesnt have a specification except for the compiler's .c files

timid quartz
#

just wing it

#

make your own spec

#

kekw

spare quartz
#

ewwwwwwww

#

im dying.....

timid quartz
#

good

spare quartz
#

physx rn seems too hard

#

im gonna try adding computers again

#

thankfully i already textured everything

#

i think i could do better though

timid quartz
#

what does physx even do

spare quartz
#

its a physics engine

#

OH YEAH

#

i also need to fix up the toolgun

spare quartz
#

ithink i did great on this one

#

結婚したい

timid quartz
spare quartz
#

what

timid quartz
#

TO WHO

spare quartz
#

classified ......

timid quartz
#

BOI

spare quartz
#

smh why doeseveryone say htat!!!!

timid quartz
#

I didn’t even have to try to draw those kanji I already know what those mean

#

けっこん

spare quartz
#

i think japanese text is like a trap instruction for you

#

i should learn japanese for that reason too..

timid quartz
#

Yes whenever I see Japanese I have the strong desire to read and translate it

spare quartz
#

okay but i imagine you wont do the same if i speak like

#

german or something right

timid quartz
spare quartz
#

bleh im so tired

timid quartz
#

But I will definitely just be a lazy ass and google translate it

#

With Japanese I do actually want to understand more

spare quartz
#

i should really pay more attention to my german classes cause they're an actual course

lyric mesa
timid quartz
timid quartz
spare quartz
#

notice how ada isnt listed... therefore our coolness factor can be anywhere from 0-4* billion depending on the unit used (probably unsigned)

timid quartz
#

Rewrite the dns server in Ruby ca

spare quartz
#

I’m so eeeppyyy

timid quartz
spare quartz
#

oh but I don’t wannnnnanaaa

timid quartz
#

Now you are become sleepy, the goer to bed

spare quartz
#

okay good night then!!!!

spare quartz
#

I can’t escape

timid quartz
# spare quartz
let mut arr = vec![64, 34, 25, 12, 22, 11, 90];
arr.sort();
println!("{:?}", arr);
#

ehh

#

I don't think it looks that much cleaner

spare quartz
#

in Ada you’d need to define this generic function but it should look roughly the same

timid quartz
#

gay

#

imagine not having it defined for you

spare quartz
#

well the implementation is defined by the RTS you’re using

#

you just need to instantiate the function

timid quartz
#

Imagine even needing to do that

spare quartz
#

couldnt be us

timid quartz
#

Or just not freeing it at all

spare quartz
#

the concept of memory management is not a valid concept

timid quartz
#

That means your http server will eventually OOM

spare quartz
#

i've already spoken about this with my codev

#

the memory that is "leaked" is so tiny it doesn't matter

#

Why is go slower than java?

Have i been lied to this whole time?

Quoting Ben Dicken (@BenjDicken)

More languages, more insights!

A few interesting takeaways:

  • Java and Kotlin are quick! Possible explanation: Google is heavily invested in performance here.
  • Js is really fast as far as interpreted / jit languages go.
  • Python is quite slow...
▶ Play video
#

i should not get myself involved in twitter discourse

full berry
#

@spare quartz hey um yk certbot
for it to like work for nginx, i have an existing config, it tweaks it with it's settings

#

but like

#

when it does and i restart nginx it shits the bed

spare quartz
spare quartz
full berry
#

getting it rn

full berry
# spare quartz whats the error

so for context
this is before certbot

server {
  listen 80 default_server;
  client_max_body_size 100M;
  server_name .astrohweston.xyz;
  location / {
    proxy_pass http://localhost:3005;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
  }
}

now, when i run sudo certbot --nginx, it asks me for which domains i wanna do it, i type it in, and then it throws this error:

spare quartz
#

remove the api. and try a wildcard cert maybe

full berry
#

damn.

full berry
#

this error ive seen it before but it like
wtf does "unknown" mean wha

spare quartz
#

bleh

full berry
#

?

#

what

lavish dove
spare quartz
#

this mod is goofy

full berry
#

i rebooted my system and its good

full berry
#

@spare quartz hey i'm requesting brand new certs for new subdomains, and im getting this error, any help?

#

doesnt happen for domains that already had old certs in the system

timid quartz
#

Both slower than rust and cpp

#

Now do Ada

full berry
#

isnt nginx supposed to like

#

if you go to a website that it doesn't have a config for

#

isn't it supposed to throw a 404

spare quartz
#

kotlin wraps a lot of its stuff around the jdk

spare quartz
#

heres it with Ofast, flto, and gnatp...

#

it just optimized it away

#

with "work" done in the loop

#

lemme try to replicatewhat this guy wrote

#

@timid quartz

#

there

#

replicated

timid quartz
spare quartz
#

yeah

#

technically a 0.8 second boost but

  • i dont know what hw this guy was testing on
  • i dont know if he rounded down an initial result, or used an average result
spare quartz
#

if it was just straight mod, the divison required could play a big part in the speed

#

(should also note the randomness im using isn't random, at least every startup, it needs to be seeded)

#

(but this wouldn't play a part in the speed)

full berry
#

i have FINALLY switched away from NPM and back to native nginx

#

🙏🏽

spare quartz
#

whats interesting is all of these tests have arrays initialized to 0

#

my program doesnt deal with the initialization

#

no way

spare quartz
#

ugh

#

i have the urge to make a third jvm now

spare quartz
#

aw sweet

#

it works

#

using particles to sim cubes rn

spare quartz
#

nixos 🤢

timid quartz
# spare quartz

But you get public static void main(String[] args) and a garbage collector

spare quartz
#

do i go richard stallman

timid quartz
spare quartz
#

mroww :3

#

ugh i suck at ascii art

rustic vine
# spare quartz

what the ui designer submitted in the spec vs. what I made

umbral monolith
timid quartz
#

@spare quartz hows it going

spare quartz
#

I’m in the shower rn

timid quartz
#

with ur projects n shit

#

also get ur phone out of the shower

#

and clean urself off

spare quartz
#

umm fine I suppose, havent worked on TLS for a bit now

timid quartz
#

the one shower a month you have

spare quartz
#

really itching to make a third JVM

timid quartz
#

do it

spare quartz
timid quartz
#

when ada lsp tho

spare quartz
#

ummm

timid quartz
#

and uh when clr

spare quartz
#

when Ada exe loader..

timid quartz
spare quartz
#

I might just write the CLR in rust to spite you

#

Only partially though. I have a feeling that’s a big project

timid quartz
spare quartz
#

becuz

#

You usually expect me to write in Ada

#

shrimple

timid quartz
#

ok sure

spare quartz
#

Also I still need to add lighting and figure out level geometry

#

Since adding a few thousand static objects doesn’t seem right

spare quartz
#

Literally all they say on the documentation for quaternions is “go read a book”

timid quartz
#

lmfao

#

based

spare quartz
#
local MaterialSerivce = game:GetService("MaterialService")
local LogService = game:GetService("LogService")
local Needed = {}
local NeededC = 0

print("Please enter a replacement table of MaterialVariants in your console. When you are done, enter \"done.\"")
print("To enter a MaterialVariant replacment entry, type: \"[ToBeReplaced] -> [ReplaceTo]\" without the quotes, or square brackets *around* the names.")
print("Do not worry about the errors.")

local Replacements = {}

function Run()
    for _, Object in workspace:GetDescendants() do
        if Object:IsA("BasePart") and #Object.MaterialVariant > 0 then
            if not MaterialSerivce:GetMaterialVariant(Object.Material, Object.MaterialVariant) then
                local ReplaceCheck = Replacements[Object.MaterialVariant]
                if ReplaceCheck then
                    Object.MaterialVariant = ReplaceCheck
                    continue
                end
                local MaterialFixCheck = Enum.Material:FromName(Object.MaterialVariant)
                if MaterialFixCheck then
                    Object.Material = MaterialFixCheck
                    Object.MaterialVariant = ""
                    continue
                end
                print("unresolvable material error:", Object, "-> Need: ", Object.MaterialVariant)
                Needed[Object.MaterialVariant] = true
                NeededC += 1
            end
        end
    end

    if NeededC > 0 then
        print(`Please get the following materials ({NeededC}):`)
        for Material, _ in Needed do
            print("-> ", Material)
        end
    end
end

local LoggingCheck
LoggingCheck = LogService.MessageOut:Connect(function(Message, Type)
    if Type == Enum.MessageType.MessageOutput and string.sub(Message, 1, 1) == '>' then
        local ActualMessage = string.sub(Message, 3)
        if ActualMessage == "done" then
            LoggingCheck:Disconnect()
            Run()
            return
        end
        local ReplacementStrings = string.split(ActualMessage, " -> ")
        if #ReplacementStrings > 0 then
            Replacements[ReplacementStrings[1]] = ReplacementStrings[2]
        end
    end    
end)
#

pasting this here cause i think i did a cool thing

#

CLI in a command line script

rustic vine
#

I did a pretty quick pass over it, though

spare quartz
#

you type in parameters and then it actually runs

rustic vine
#

wait does it? I'm not sure whats happening here

spare quartz
#

yes it does

#

a -> b
does
Replacements["a"] = "b"

rustic vine
#

oh logservice

#

interesting

spare quartz
#

the service says right on the tin its not very reliable for in game use but i think its good enough for mini things like this

rustic vine
#

for tooling, yeah

#

could be cool if you're too lazy to write ui for a plugin

#

wonder if you can supress the errors somehow

#

prob not

spare quartz
#

i like it :3

rustic vine
#

does intellisense show up if you start it lowercase?

#

I'd assume not

#

that sounds awful

#

having to start everything with shift + letter

spare quartz
rustic vine
#

🙏

#

the premiere editor

spare quartz
#

anyways yeah intellisense does actually pop up

rustic vine
#

if you start lowercase?

spare quartz
#

yeah

rustic vine
#

huh ok

#

thats surprising to me

spare quartz
#

the results are lower but considering all the symbols i use are in that case it doesnt matter

rustic vine
#

right ok

#

you'll learn that snake case is the superior option eventually 😄

spare quartz
#

nnnnnno

#

i think snakecase should be eaten by a snake

#

👎

rustic vine
spare quartz
#

🪦

#

better than camelcase...

rustic vine
lyric mesa
rustic vine
spare quartz
#

its so ... qserover

rustic vine
#

one day

timid quartz
spare quartz
#

anyways wake up time

timid quartz
spare quartz
#

Do iiii

timid quartz
#

Do it

spare quartz
#

Also I should reeallly get to using spark more

#

Runtime error proof app 🥺

timid quartz
spare quartz
#

Okay but the same could be said for Ada

#

SPARK means proving nothing can go wrong so the compiler doesn’t need to enforce safety at runtime

#

oh yeah this chat turned 4 months old a week ago

timid quartz
spare quartz
#

MATH

#

can you even solve the halting problem

#

had to watch a refresher on it again (the amazing one made by udiprod)

spare quartz
lavish dove
#

I just looked it up

#

why would you want to see if a program ends lol

spare quartz
#

its just a logic impossibility

rustic vine
# spare quartz

"it increases productivity and inclusion in the workplace"

lavish dove
#

lmao

spare quartz
#

i should use this more

timid quartz
#

Because formal mathematic verification blah blah blah

timid quartz
#

Rip

#

What’s even the point then

spare quartz
#

SPARK makes runtime errors impossible

#

like not just what you're doing in rust with handling all exceptions

#

just straight up provably impossible (barring the universe killing the hw) to have an error

timid quartz
#

Or don’t use exceptions in Java :3

spare quartz
#

you do realize we have more than just exceptions to worry about right

#

overflow, divide by zero, type ranges, ...

#

with SPARK proving nothing out of the ordinary can happen wrt to the aforementioned we can safely remove runtime checks

rustic vine
#

static analysis? is it incredibly simple?

spare quartz
rustic vine
#

this reminds me of that memo I saw of a dev working on missile software acknowledging that his code will eventually OOM due to a memory leak, but he calculated that the missile will either hit the target or run out of fuel before it could ever run out of memory with a margin of like 10x to spare, so he just willfully ignored it

#

I guess its more firmware maybe

#

let me see if I can find it

spare quartz
#

by default no memory is freed, only finalized

rustic vine
#

From: [email protected] (Kent Mitchell)
Subject: Re: Does memory leak?
Date: 1995/03/31

Norman H. Cohen ([email protected]) wrote:
: The only programs I know of with deliberate memory leaks are those whose
: executions are short enough, and whose target machines have enough
: virtual memory space, that running out of memory is not a concern.
: (This class of programs includes many student programming exercises and
: some simple applets and utilities; it includes few if any embedded or
: safety-critical programs.)

This sparked an interesting memory for me. I was once working with a
customer who was producing on-board software for a missile. In my analysis
of the code, I pointed out that they had a number of problems with storage
leaks. Imagine my surprise when the customers chief software engineer said
"Of course it leaks". He went on to point out that they had calculated the
amount of memory the application would leak in the total possible flight time
for the missile and then doubled that number. They added this much
additional memory to the hardware to "support" the leaks. Since the missile
will explode when it hits its target or at the end of its flight, the
ultimate in garbage collection is performed without programmer intervention.

--
Kent Mitchell | One possible reason that things aren't
Technical Consultant | going according to plan is .....
Rational Software Corporation | that there never was a plan!

rustic vine
#

I'd try ada if not for the fact last I heard it had practically 0% market share outside of government stuff

spare quartz
#

yeah that's true

#

it's very popular in embedded/safety-critical, but for stuff like desktop/server development it's not very common

#

the memory not being automatically freed isn't too big of a deal for certain stuff though; i can send an http server i made with it a few million requests and only tack on about 0.3 mb of leaked memory

rustic vine
#

the farthest I've gone for embedded is a little C and some verilog

#

absolute despised verilog

#

awful language

spare quartz
#

only heard of it

rustic vine
#

its mainly for fpga programming

spare quartz
#

looks very uh, weird

rustic vine
#

its

#

yeah

#

lol

spare quartz
#

OH ITS HDL

rustic vine
#

yes

spare quartz
#

yeah that explains it

spare quartz
rustic vine
#

trying to run java in an embedded environment (arm32 softfp) with 512 mb of ddr3 was an experience

rustic vine
#

I just thought its cool

spare quartz
#

i imagine some java ee one

#

not ee. i forgot

#

java me thats it

rustic vine
#

custom jdk

#

(I did not make)

spare quartz
#

:<

#

honestly i wish we had more than just (repackaged) oracles hotspot for consumer use

#

the amount of versatility JVMs can be made for is crazy

rustic vine
#

to be more specific it was openjdk setup for that specific platform

#

namely arm32 softfp

spare quartz
#

oh, huh

#

had to remind myself on softfps meaning there

rustic vine
#

yeah, had to wrestle with the gc settings a bit

#

also couldn't use half the gcs that are usually available because

#

arm32

#

🙏

#

so ended up with serial gc I think

timid quartz
spare quartz
#

zgc... save us.... save us zgc....

spare quartz
#

and the stdlib still has to ensure the input is valid to even give you a result

timid quartz
#

Then you have no runtime errors (probably)

spare quartz
#

aerasto you've literally just invented pragma Restrictions 😭

timid quartz
#

lmao

#

SPARK-rs when

spare quartz
#

you have an analogue to that in rust right

#

like uh

#

#![no_potatoes]

timid quartz
#

it’s #!

#

but yeah

#

Like for example

spare quartz
lyric mesa
#

#![feature(burgers)]

timid quartz
#

#[allow(dead_code)] only works on a specific object (eg a function or a struct)

#

#! applies to the entire project

spare quartz
#

ohhh ic

#

the way you're supposed to define pragma restrictions project wide in ada is a little weird

#

you need a sorta, gpr "configuration file" alongside the gpr project file

timid quartz
#

Or you could just

#

!pragma

spare quartz
#

wouldn't that just be like

#

no pragma

rustic vine
spare quartz
#

damn :<

rustic vine
#

Softfp was evil too, in combination with arm33 you lack support everywhere

timid quartz
spare quartz
rustic vine
#

DSLs are cool

lavish dove
#

rising or falling

#

or continuou

rustic vine
#

perhaps something like ANY_EDGE would have been ok too

#

but it don't matter much

timid quartz
#

Just use PHP

spare quartz
#

NO!!

lavish dove
#

c is my only backend and middleend htmx is my only frontend I believe in temple os

spare quartz
lavish dove
spare quartz
#

flex....

lavish dove
#

I wonder if theres a big

#

like huge linux server

#

that anyone can remote into and just get a temporary environment

#

like how when computers used to be as big as rooms a university student could get an ssh thing then use some archaic form of ssh over dsl and connect to their universities computer

spare quartz
#

there we go

#

completely automatic language generation

lavish dove
#

no way

#

minecraft mod that makes languages

spare quartz
#

i think we're the first to do this type of language generation but i can't be 100% sure

#

the alternative was making a 300 line file of every items translation key

lavish dove
#

lol

spare quartz
#

our mod is extremely self modifying

rustic vine
#

ah kotlin

#

the better java

#

alternatively, the language that jetbrains made to sell pro copies of its IDEs

#

(still the better java though)

spare quartz
#

rust........

rustic vine
#

look inside

unsafe {
  // remainder of code here
}```
spare quartz
#

hehehea

#

now to rewrite this but under our control

spare quartz
timid quartz
full berry
#

been thinking about trying to make a web app in vue

spare quartz
timid quartz
#

It’s all JVM bytecode in the end

spare quartz
#

Uh, no

timid quartz
#

uh yes 🤓 ☝️

spare quartz
#

The spongepowered mixin plug-in only supports java for mixins

timid quartz
#

But it’s all JVM bytecode in the end

#

There’s definitely a way

spare quartz
#

You can make the mixin code redirect to a kotlin function in another file, but that’s dirty and weird

spare quartz
#

person who's trying too hard
or
person who can only write business logic

#

take your pick

lavish dove
#

huh

lavish dove
spare quartz
#

yeah that's why i specified they're someone trying too hard

#

just cause you use arch or neovim =/= you are a better programmer for x domain

lavish dove
#

I mean arch is good

#

cuz linux in servers

spare quartz
#

well im assuming they don't want a sysadmin job

#

(every programmer should still know how to use a unix-like system though)

lavish dove
#

it still looks good

lavish dove
#

wait isnt windows unix like

spare quartz
#

dont think so

#

DAMMIT!!!!!!

lavish dove
#

HAHAAHAH

#

sussy unix

timid quartz
#

im a sped with no job 😭

spare quartz
#

Nerd .

timid quartz
#

0 interviews 0 internships

#

im so cooked

spare quartz
#

3 commands written for astral industries.....

#

the funnies......

timid quartz
#

@spare quartz 🐱

spare quartz
# timid quartz <@516049910622191626> 🐱
   procedure Read_DOS_Header (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Item : out DOS_Header) is
   begin
      raise DOS_Header_Decoding_Error;
   end Read_DOS_Header;
#

i win

spare quartz
#

spark approved!!!

timid quartz
#

nope

timid quartz
spare quartz
#

i should not have brought arti to qsp 💔

timid quartz
#

I mean

#

katsumi did too I think

spare quartz
#

nah i did it first, like october last year

#

just before i was banned iirc

timid quartz
spare quartz
#

hmm

#

deciding wether i should skip over the DOS header

#

or read it

timid quartz
#

honestly

#

well

#

you need the end of it

#

to figure out the PE header offset

#

but that's all you need

spare quartz
#

the DOS header is fixed size which means i can just seek and ignore it

timid quartz
#

yeah

#

the oonly thing I'd say is

#

make sure the MZ signature is ok

#

but that's meh

spare quartz
#

no i'll just do an object oriented thing*

#

oh cmon

#

they make processors too??

#

everything i know so far about mitsubishi

  • they make cars
  • the us government (dod) buys projectors from them
  • they make processors
timid quartz
spare quartz
#
   type Machine_Type is (ANY, ALPHA_AXP_32, ALPHA_64, MATSUSHITA_AM33, AMD_64, ARM_LE, ARM_64_LE, ARM_THUMB_2_LE, EFI, INTEL_386_OR_LATER, ITANIUM_64, LOONG_ARCH_32, LOONG_ARCH_64, MITSUBISHI_M32R_LE, MIPS_16, MIPS_FPU, MIPS_16_FPU, POWERPC_LE, POWERPC_FPU, MIPS_LE, RISCV_32, RISCV_64, RISCV_128, HITACHI_SH3, HITACHI_SH3_DSP, HITACHI_SH4, HITACHI_SH5, THUMB, MIPS_LE_WCE_V2);
#

OH almost forgot UNKNOWN

timid quartz
#

yep

#

anyways

#

CRINGE

#

OOP

#

👎

spare quartz
#

oop is good......

#

except in lua

#

anyone who uses oop in lua is gross

rustic vine
#

oop in java is gross too

#

java in general is just gross

spare quartz
#

its java

rustic vine
#

c# is the better kt which is the better java

#

I hate to admit it

spare quartz
#

the feds are supressing me

timid quartz
spare quartz
#

yes

#

don't do it

timid quartz
#

like what

rustic vine
#

ecs

#

ecs is the superior choice

spare quartz
#

like i've never had a reason to use oop for anything in lua

rustic vine
#

for any game

#

oop sucks

#

(mostly just inheritance)

spare quartz
#

the 2 jvms i made dont even have it 😭

rustic vine
#

but it still sucks

rustic vine
timid quartz
#

ok but like

#

take for example

#

CollectionService and doors

#

what are you gonna do

rustic vine
#

ecs

spare quartz
#

ecs or just a module

rustic vine
#

make entity, door component

#

easy stuff

#

collection service is like a knockoff ecs that doesn't really work anyway

timid quartz
#
local DoorState = {
-- [Door1_Model] = { ... },
-- [Door2_Model] = { ... },
-- [Door3_Model] = { ... },
-- ...
};
local Connections = {
-- [Door1_Model] = { ... },
-- [Door2_Model] = { ... },
-- [Door3_Model] = { ... },
-- ...
};
#

just shit like that?

spare quartz
#

no

rustic vine
#

no

#

ecs

timid quartz
#

tf is an ecs

spare quartz
#

like an extremely simple door module is just

rustic vine
#

pattern for game programming (and more)

timid quartz
#

sounds like oop with extra steps

rustic vine
#

its oop with less steps

#

leads to significantly less coupling in your code

#

which means writing new features and behavior is incredibly easy

spare quartz
# spare quartz like an extremely simple door module is just
local CollectionService = game:GetService("CollectionService")
for _, Object in CollectionService:GetTagged("Door") do
  local misndvinvb = Instance.new("Clikckofodvb ")
  minsinfdig.MouseClick:Connect(function()
    .........................................
  end)
  miminfdigfd.Parent = Object
end
#

no oop

rustic vine
#

kinda

#

collection service + attributes are like a bad ecs

timid quartz
rustic vine
#

they do

#

destroy the instance and it gets freed

spare quartz
#

but really you wouldn't need oop here for any reason

timid quartz
rustic vine
#

they do

timid quartz
#

connections stay connected until explicitly disconnected

#

nope

rustic vine
#

they dont

timid quartz
#

they do

#

how do I know

rustic vine
#

the docs say they do

spare quartz
timid quartz
#

because I and the rest of sst had to fix a bunch of that shit in qserf

spare quartz
rustic vine
timid quartz
rustic vine
#

they do

spare quartz
timid quartz
#

oh wait

rustic vine
#

yeah well an ecs library is just array access

timid quartz
#

it's not the connection

spare quartz
rustic vine
#

fr

timid quartz
#

it's when the connection references a variable outside of it

rustic vine
#

well yeah

timid quartz
#
local theValue = {"a", "b", "c"}
script.ChildAdded:Connect(function()
    print(theValue)
end)
#

this leaks memory

#

unless disconnected

rustic vine
#

should still get disconnected

spare quartz
#

cause.. the event is on the script

rustic vine
#

on destroy

#

lol

spare quartz
#

if you delete the script for example, the event + any other events the script made are disconnected

timid quartz
#

ok that's if you delete the script

rustic vine
#

yeah?

spare quartz
#

your event is on the script

rustic vine
#

I don't get your point

timid quartz
#

during runtime you're not gonna be deleting scripts though

rustic vine
#

I still don't get your point

spare quartz
#
Ext.Event:Connect(...) -- disconnected if script is removed OR ext is removed
script.Event:Connect(...) -- disconnected if script is removed
-- both capture what we're saying: events are disconnected if the initiator OR target are removed
timid quartz
spare quartz
#

i'd need to see proof of that cause that just doesn't sound right

#

the event is on the object, if it's removed and gc'd the event won't exist

#

unless you're saving a ref to the connection maybe

timid quartz
#

you're still probably gonna leak terrible amounts of memory if you ever have to regenerate those models

rustic vine
#

loosely coupled code is great

#

why?

timid quartz
#

because the connections will
a. probably be capturing external variables that don't get gc'd
b. not get disconnected and continue to exist for models that don't exist

rustic vine
#

destroy an entity results in all its components being freed, thats all the memory there is

timid quartz
#

@wheat zinc you know more about this shit than I do

spare quartz
rustic vine
#

destroying an instance results in all connected connections on it to be freed

#

so I don't see where theres a leak

spare quartz
#

after deletion of an object, if you're not trying to save the connection (as shown in the scripts above), the connection won't have any references to it and will be cleaned up

rustic vine
timid quartz
#
local ModelStorage = game.ServerStorage.Model;
local Counter = 0;

local TheModel = ModelStorage:Clone();
TheModel.InnerPart.Touched:Connect(function()
  Counter = Counter + 1;
end);

local RegenEvent = script.RegenEvent;
RegenEvent.Event:Connect(function()
  TheModel:Destroy();
  TheModel = ModelStorage:Clone();
end);
#

this leaks memory

#

connection is never disconnected

rustic vine
#

which connection

#

you make 2

timid quartz
#

The TheModel connection

rustic vine
#

and they both get disconnected

#

no memory is leaked

#

well, they don't both get disconnected, but no memory is leaked

#

it doesn't ever grow

timid quartz
#

No, the connection on TheModel.InnerPart will leak if RegenEvent is fired

rustic vine
#

no

timid quartz
#

yes

rustic vine
#

theres only ever 1 connection to that

spare quartz
#

hold on

rustic vine
#

when the instance is destroyed so are its children, which frees the connection

timid quartz
#
rustic vine
#

you also don't make the connection again

timid quartz
#

You can read shit like this

#

By people smarter than either of us

rustic vine
#

I ain't reading that brah

timid quartz
#

Then don't argue if you don't read the facts

rustic vine
#

those posts have

#

nothing to do with

#

this topic

#

I've read them before

timid quartz
#

maybe especially on the second post

rustic vine
#

thats talking about gc

timid quartz
#

if you used your eyes

rustic vine
#

do -- Also also all good, as Destroy() implicitly disconnects all connections
local p = Instance.new('Part')
p.Touched:connect(function() print(p) end)
p:Destroy()
end

#

Destroy() implicitly disconnects all connections

timid quartz
#

you'd see that they pertain to leaking memory via not-disconnected connections

spare quartz
#
local ModelStorage = game.ServerStorage.Model;
local Counter = 0;

local TheModel = ModelStorage:Clone();
TheModel.InnerPart.Touched:Connect(function()
    Counter = Counter + 1;
end);

local RegenEvent = script.RegenEvent;
RegenEvent.Event:Connect(function()
    TheModel:Destroy();
    TheModel = ModelStorage:Clone();
end);

for _ = 1, 60 * 10 do
    RegenEvent:Fire()
    print(gcinfo())
end
#

no memory is leaked

rustic vine
#

yeah

#

its constant

#

as expected

#
RegenEvent.Event:Connect(function()
    TheModel:Destroy(); -- connection is freed here
    TheModel = ModelStorage:Clone();
end);```
timid quartz
#

Anyways I will still always explicitly disconnect connections

#

because that's the only way to make sure they don't leak

rustic vine
#

alternatively you can destroy the instance

#

and that disconnects them all

#

memory leaks are hard in well written code, you almost have to try to make one to get one

spare quartz
#

heres a longer trial without :Destroy()

#

since the model is cloned to nil, the GC eventually gets to it and clears it

timid quartz
# spare quartz ```lua local CollectionService = game:GetService("CollectionService") for _, Obj...

so I'd turn this into

local RegenEvent = script.RegenEvent;
local Conections = {};
local CollectionService = game:GetService("CollectionService");

local function Disconnect(Conn)
  Conn:Disconnect()
end

RegenEvent.Event:Connect(function()
  for _, Conn in Connections do
    pcall(Disconnect, Conn);
  end
end);

for _, Object in CollectionService:GetTagged("Door") do
  local misndvinvb = Instance.new("Clikckofodvb ")
  Connections[misndvinvb] = minsinfdig.MouseClick:Connect(function()
    -- ...
  end)
  miminfdigfd.Parent = Object
end
#

that's what I'd do

#

and add a thing on regen to reconnect everything

rustic vine
#

🤷‍♂️

#

the same thing happens if you destroy them

#

why do you pcall disconnect

timid quartz
spare quartz
#

(be careful with pcall, exceptions are expensive)

rustic vine
#

why would it fail?

#

I'd argue if it failed you'd want it to fail loud

#

instead of fail silently

timid quartz
#

then the game breaks and people spam reports

rustic vine
#

the only reason for it to fail would be if Conn was nil, and that sounds like its more a bug than a normal thing

rustic vine
#

as in, you now know about the bug

spare quartz
#

but you'd need something a bit more to handle that

timid quartz
#

honestly if conn is already nil by the time it gets to disconnecting it then I don't see why you'd have to care

rustic vine
#

you should care

#

because it shouldn't be nil

#

and if it is, you should fail loudly instead of ignoring silently

timid quartz
#

if it's nil then it's probably already been dealt with

#

¯_(ツ)_/¯

rustic vine
#

that doesn't seem like a good assumption to make

spare quartz
#

i'd suggest just checking if Conn is nil and clearing it out if you're intentionally undermining program integrity for whatever reason

#

if you know it's not nil handle it normally w/o a pcall

timid quartz
#

All I know is that I've encountered some situations where a nil connection was causing an error on disconnect when it really didn't matter

#

I don't remember exactly what

#

But it's possible in some case

spare quartz
#

i had a similar issue while developing a plugin

#

but that feels separate from something like game code

timid quartz
spare quartz
#

wdym

timid quartz
#

you define it inside the loop?

#

like idk

#

a counter

rustic vine
#

you make a component

#

and store it in that

#

or attribute, I guess, if you're sticking with collection service + attributes

spare quartz
#

either the script scope (not the temporary event scope) or attribute works

timid quartz
#

just like

#

some idk StringVariable object

#

I never use those

rustic vine
#

ok so ecs is a pattern

#

it stands for entity component system

#

everything in your game is 1 of those 3 things

#

entities are like your oop objects

#

components are things added to entities, they are like fields in a oop class

#

they have a name and a value

spare quartz
timid quartz
#

so like that

rustic vine
#

systems are behavioral code that runs every frame (or n frames, or at a fixed interval, etc..) that act on entities and components

timid quartz
#

is what I thought

rustic vine
spare quartz
#

mmmmmm

#

closest analogue i can think of is a SAM interface

rustic vine
#

entities can have any combination of components (and values inside those components)

spare quartz
#

but that concerns one method, not a field

rustic vine
#

minecraft bedrock uses an ecs

timid quartz
#

atp read code

#

respond

rustic vine
#

written in c++

#

called entt

spare quartz
#

yes that code's fine aera

#

p.s. you should use += in luau

rustic vine
#

ik bedrock is like

#

hated on but

#

its a cool techstack

timid quartz
#

thought you liked that smh

rustic vine
#

no

#

+= is explicit

timid quartz
#

you the kinda person to use x = x + 1 in luau

spare quartz
#

(which i guess you can dunk me on since ada is pretty verbose, BUT. yeah)

rustic vine
#

I'd dunk on you but I don't know ada

#

so I can't comment

timid quartz
#

dunk on atp anyways

rustic vine
#

actually I know that nobody uses it

#

so

timid quartz
#

exactly

#

now you know 1

rustic vine
#

I write luau cause its a fun language

timid quartz
#

1 of like 2

rustic vine
#

its a nice break from writing java in my datastructures & algorithms class

spare quartz
rustic vine
#

java bruh

#

does lua have it now

#

5.3 right

spare quartz
#

in 2022 we got @ in something like y := @ + x though so.. /shrug

#

no contracted assignment/addition is a luau thing

rustic vine
#

are you sure

spare quartz
#

yeah

rustic vine
#

I thought lua got it in 5.3

spare quartz
#

lemme open the cgi bin they have on the lua site and see if they do

rustic vine
#

oh

#

they didn't

#

fumble

spare quartz
#

MY CGI!!!!!!!

rustic vine
#

looks like the cited reason is that lua is a single pass compiler

#

just open godbolt

#

nvm godbolt doesn't have lua

#

why hasn't anyone pr'ed lua or luau in

spare quartz
#

but yeah

#

no contracted arithmetic unfortunately

rustic vine
#

that is unfortunate

#

no ternary either

#

if this then that else other that is great

spare quartz
#

that just reminded me

#

afaik kotlin doesn't have short circuiting like in lua 😭

#

so (a == 5 && b == 10) will evaluate both even if a != 5

rustic vine
#

java does

#

why wouldn't kt

#

both jvm langs

spare quartz
#

i dunno

rustic vine
#

you sure? cause in java bitwise operators explicitly eval both

spare quartz
#

probably some compiler oversight, they just pushed K2 so it might be good to try

rustic vine
#

i.e. a == 5 & b == 10

spare quartz
#

it'll evaluate both sides for ex. an if statement

rustic vine
#

k2?? we got kotlin2 before gta6

rustic vine
#

so I'd expect kt to be not much different

spare quartz
#

¯_(ツ)_/¯

#

two different compilers at the end of the day

rustic vine
#

I guess

spare quartz
#

probably wouldn't be that bad of an idea to read into kotlins one day

rustic vine
#

I wish I got to use kt more but

#

the places I can are so limited

#

most java I write/wrote was for work or for uni

#

and they ain't taking kt

spare quartz
#

i primarily write it for mod dev since writing a mod in java is inferior in almost all ways

rustic vine
#

I've heard mod dev is hell

#

mixins sound terrible

spare quartz
#

they're actually kinda great

#

biggest hurdles are

  • basically no documentation
  • the workarounds modloaders use can get very annoying if you try to do something more expected of say, a desktop app
#

like they wrap a url to a file in an opaque format that's not documented anywhere

rustic vine
#

and the source being

#

decompiled and

#

deobfuscated (with symbols added, thankfully)

#

probably doesn't help

spare quartz
#

yeah

#

microsoft does give out mappings to most things which is a lot better than essentially just having numbers for names but

#

no javadoc at all

rustic vine
#

yeah symbols added

rustic vine
#

what da flip

#

is that reflection

#

brah

#

reflection worst mistake known to mankind

#

nvm null was

spare quartz
#

reflection to our own classloader since we can't load in the native libraries the normal way

rustic vine
#

2nd worst mistake

#

apparently c++ is getting reflection though

#

can be good I guess, easy to abuse

timid quartz
#

reflect deez nuts

rustic vine
#

goat

spare quartz
rustic vine
#

LOL

#

cpp committee when any new idea is proposed
"but it breaks ABI"
they all say in unison

spare quartz
#

it's even worse when like

rustic vine
#

hey c++23 has std::print

spare quartz
#

there's just random pitfalls in the C++ stdlib that look perfect for x situation but

rustic vine
#

we're getting somewhere

rustic vine
#

don't even start

spare quartz
#

naw it actually destroys your memory soz

rustic vine
#

half the collections in the stdlib could probably be constexpr'd

#

but they aren't

#

cause nobody uses them

#

so nobody bothers to fix them

#

the consensus is to just use std::vector everywhere instead

#

cause its the goated datastructure

spare quartz
#

oh right

#

i need to actually assign values to all of these

#

auuuuughhhh

rustic vine
#

whats that

spare quartz
#

PE** format reader to compete with whatever aeras doing with his

rustic vine
#

huh

spare quartz
#

we love unsorted enums

rustic vine
#

ah well

#

microsoft

spare quartz
#

honestly who even came up with the idea of error codes back there

rustic vine
#

wait till you need to call ConvertSecurityDescriptorToStringSecurityDescriptorA

spare quartz
#

"oh, this program could potentially have so and so error"
uses a CSPRNG to generate an error code for it

#

like why???

#

0xC0000005 for a segfault???

rustic vine
#

do not let them cook

spare quartz
rustic vine
#

I've been trying to get into numerical optimization and controls software more

#

its super cool stuff

spare quartz
#

thats a bunch of sciencey words out of my league

rustic vine
#

controls is just

#

how do I get from x to y

#

but like do it well

#

optimization is a big part of controls, its finding the minimum cost to do something

#

or maximum, etc..

spare quartz
#

ohhhh

rustic vine
#

yeah

#

mainly for robotics

wraith scarab
#

pls help what does print("hello world") do

rustic vine
#

dude imma be real with you

spare quartz
#

doesn't ML intersect with that field?

rustic vine
#

I got NO clue

spare quartz
#

not GAI*s, but

#

evolution type ones

rustic vine
#

basically I think the gist of that is

#

people want to try to replace good ol numerical optimization with ML optimization

#

which, doesn't really work so well tbh

spare quartz
#

aw hell naw

rustic vine
#

math is math

spare quartz
#

you can't just trust a 9 bajillion long equation to do everything right

rustic vine
#

its cool tech I think but not ready for prod

spare quartz
spare quartz
rustic vine
spare quartz
#

you cant just redefine globals 💔💔

rustic vine
#

I heard there used to be a bug in luau/rblx where you could actually access the genv

#

through getfenv

wraith scarab
rustic vine
#

and if you caught it using __index

rustic vine
#

and you could do funny stuff with that

spare quartz
#

no way

rustic vine
#

patched long ago though

#

but yeah back to optimization its a super cool field I think

#

you can say like if I wanted to shoot a basketball into the hoop from a certain position, what would be the optimal angle/speed to launch it at

#

and stuff that into a optimizer and solve

#

just slap on the drag equation for a sphere or whatever

#

its definitely math heavy though and im not confident enough in a lot of it 😅

spare quartz
#

friendship ended with approximation.. friendship started with discretization

rustic vine
#

TRUE

#

discretization is fun

#

cause all the math you ever write is

#

continuous

#

but when applied to code that runs discretely

#

it messes up

spare quartz
#

i suck at continuous stuff personally

#

im just not smart enough to know how to represent the equation without breaking some fundamental part of it

#

but for relatively simpler stuff like magnetic field equations the visualizations that can come out are really preetty

rustic vine
#

well most equations you see are continuous equations

#

they are applied at infinitely small timesteps

#

your classical mechanics equation x(t) = 1/2at^2 + v0t + x0

#

thats continuous

spare quartz
#

but we iterate over it using steps of 1/60 for say a physics engine

rustic vine
#

yeah

#

thats "good enough"

#

but that equation isn't actually "correct" when applied in discrete timesteps

spare quartz
#

yeah

rustic vine
#

thats the whole point of discretization

spare quartz
#

it's a tradeoff between precision and sheer volume

#

(can we switch back to using analog computers......)

rustic vine
#

taking continuous functions and converting them into their discrete counterparts

#

no we will

#

add quantum communcations

#

and blockchain

#

instead

#

big data analysis

timid quartz
#

Both of you rn

spare quartz
#

isn't there also research into like

#

optical computers

spare quartz
#

(excl. optical data transfer)

rustic vine
#

repeat what he said for interviews

#

certified works 100% of the time

spare quartz
#

go back to adding @%($%(!#^) to your code

rustic vine
#

rust users when they have to reach an MVP (near impossible)

#

using rust is like proactively adding a decade to development time

timid quartz
rustic vine
spare quartz
#

my abstract tagged limited private record is top tier

timid quartz
#

I may use Rust but I’m not a nerd

rustic vine
#

contradictory statements imma be real

spare quartz
rustic vine
#

oh like fiber optic

spare quartz
#

since they're faster than electrons, you can mux multiple wavelengths,

#

yeah, but for logic

rustic vine
#

interesting

timid quartz
rustic vine
#

ok but you use lifetimes

#

wth is a lifetime bruh

timid quartz
#

Ideally not actually

#

7/10 times if anything other than '_ (an elided lifetime) shows up you’re doing something wrong

rustic vine
#

nerd

spare quartz
#

yeah he's got you there

timid quartz
#

Elided lifetime is like a lifetime jumpscare but it’s actually harmless

rustic vine
#

see previous comment

spare quartz
#

you have your elided lifetimes and we have our math but actually programming

timid quartz
spare quartz
#

aw hell naw im not making a physics engine

rustic vine
#

I tried reading through the rust book and got 10% of the way in and gave up

#

that language is insane

spare quartz
#

ill leave that to nvidia

rustic vine
#

cpp is the far superior language

spare quartz
#

bomb his house

rustic vine
#

because I can actually write an MVP in

#

a day

#

instead of a decade

spare quartz
#

OK that was just an example

timid quartz
#

“iT wAs JuSt An ExAmPlE”

rustic vine
#

I might try rust again for advent of code

spare quartz
rustic vine
#

every yea I've tried to learn a new language for AoC but it never works out

#

I just go back to

#

cpp

#

or python (god forbid)

timid quartz
spare quartz
#

ITS NOT CALLED PHYSX

rustic vine
#

physx is

#

not made by atp

timid quartz
rustic vine
#

unfortunately

timid quartz
#

Learn how it works first to reduce the damage to your head from banging it into the wall

rustic vine
#

yeah I tried reading the book

#

and I gave up

#

🙏

timid quartz
#

Do like rust by example or some shit idk

rustic vine
#

idk I just wasn't that committed to actually learning it

#

if I was I'd have stuck with the book

#

I don't see when I'd ever use it instead of cpp

timid quartz
#

The biggest thing is you gotta figure out what the borrow checker wants out of you

#

Because it does memory management without being a GC

rustic vine
#

yeah my alternative is to not have a borrow checker

#

gods grace

timid quartz
rustic vine
#

ok well they're warnings for a reason