#💽Programming Chat v2
1 messages · Page 12 of 1
Now make it break
uh nuh uh
Total Ada death
total rustlet death
Rust pros
- concise syntax (no giant keywords)
- smart enough to do memory management without a GC
- expressive type system that encodes semantics for every type
- option and result over null and exceptions
- high-quality stdlib that provides enough without providing too much
- great package community around it
Ada pros:
- doesn’t have concise syntax
- not smart enough to do memory management beyond stack variables (which any lang can do)
- idk if the type system is as expressive but it’s certainly far from not expressive
- NULL AND EXCEPTIONS

- stdlib is ok ig and idk how much it provides
- lol yeah everyone in the ada community knows each other and they’re all 80 year old boomers using mailing lists
- is concise.
- implementation defined
- a lot more safer than rust!
- :3
- stdlib is incredibly expansive, with GNAT it's stupidly capable
- shut up :<
procedure Name (Param1 : Type1) is
-- Delcarations
begin
-- Body
end Name;
vs
fn name(param1: Type1) {
// Declarations & body
}
who wins in conciseness
i call cap
both are the bare minimum for an empty procedure
yeah otherwise you'll richard stallman me into oblivion
:3
well technically
kys stallman
😭
i really hope the ada IDE scene gets better
i don't wanna live with this forever 💔
be the change you wanna see in the world
NO
you should write a good vsc plugin or a good lsp server
noooooo
or write a language server
that's probably full of microsoft junk from 1902
it is funny how the ada plugin IS written in ada itself
@spare quartz write one of these https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/
This document describes the 3.17.x version of the language server protocol. An implementation for node of the 3.17.x version of the protocol can be found here.
jusst whoever did it sucks at coding
and it errors so much!! ada bad lang!!
@spare quartz make this!!
good project
maven server?
yes
oh is that what the http thing is for
go here and tell me what you see
an ada file
yw 4 my ip
L for yyou ...
uhh is it possible to insert .. in your path line
noprnopenopenope
bad!!!
ok
que
uh give me a file outside the root dir
wget_log
thank god
i also added directory listing
top tier web design if i dont say so myself
liar!!
?
cat was ln -s
-- Configuration for basic_http_server generated by Alire
with "extensible_http.gpr";
abstract project Basic_Http_Server_Config is
Crate_Version := "0.1.0-dev";
Crate_Name := "basic_http_server";
Alire_Host_OS := "linux";
Alire_Host_Arch := "x86_64";
Alire_Host_Distro := "ubuntu";
Ada_Compiler_Switches := External_As_List ("ADAFLAGS", " ");
Ada_Compiler_Switches := Ada_Compiler_Switches &
(
"-O3" -- Optimize for performance
,"-gnatn" -- Enable inlining
,"-ffunction-sections" -- Separate ELF section for each function
,"-fdata-sections" -- Separate ELF section for each variable
,"-gnatW8" -- UTF-8 encoding for wide characters
);
type Build_Profile_Kind is ("release", "validation", "development");
Build_Profile : Build_Profile_Kind := "release";
end Basic_Http_Server_Config;
thats a trade secret...
atp put a jpeg in the root folder
ugh fine
or a png
done
why'd you put a selfie
org/bread_experts_group/bacillus
i downloaded it
downloaded what
bacillus-1.3.0-1.21.1.jar
oh yeah its empty 😭
You should make an alternative package manager called “maiden” and make it better
can't you cross compile?
cross compilation with rust is farily easy
just compile fasterrrr
-j12
i could probably switch my alr toolchain to use gnat-arm
but like
💤
okay nvm im gonna do that
this is way too slow
I wonder how I’d do this with nix…
Probably with the use of crossTarget
valgrind DOES just work
wonderful
[nix-shell:/agony]# valgrind --leak-check=full bin/agony
==430== Memcheck, a memory error detector
==430== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==430== Using Valgrind-3.22.0 and LibVEX; rerun with -h for copyright info
==430== Command: bin/agony
==430==
AAAA -- input number (1 to 5 digits)
234
Generated: 5
your mom gay
asdf
asdf
==430==
==430== HEAP SUMMARY:
==430== in use at exit: 12 bytes in 1 blocks
==430== total heap usage: 5 allocs, 4 frees, 1,555 bytes allocated
==430==
==430== 12 bytes in 1 blocks are definitely lost in loss record 1 of 1
==430== at 0x484476B: malloc (in /nix/store/xw71pz22gcj0b29yyag2gg395kfzacli-valgrind-3.22.0/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==430== by 0x41CD6E: __gnat_malloc (s-memory.adb:79)
==430== by 0x404C9B: _ada_agony (agony.adb:22)
==430== by 0x4054C0: main (b__agony.adb:265)
==430==
==430== LEAK SUMMARY:
==430== definitely lost: 12 bytes in 1 blocks
==430== indirectly lost: 0 bytes in 0 blocks
==430== possibly lost: 0 bytes in 0 blocks
==430== still reachable: 0 bytes in 0 blocks
==430== suppressed: 0 bytes in 0 blocks
==430==
==430== For lists of detected and suppressed errors, rerun with: -s
==430== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
@spare quartz how lovely
the code that causes this is as follows (and this behavior is expected)
-- snip
S : access String;
-- snip
S := new String'("lel");
-- snip
correct
access types inherently leak memory without Unchecked_Deallocation
rn
it's just nice to see that valgrind works
im trying to figure out
WHY I CANT COMPILE THIS CODE
like dude
literally every single one of the ARM RTSes
personally prefer the way rust does it where it knows to insert a free
rust doesn't have analogues to access
looks to me like you're trying to figure out scpsl rn
so doesn't count
references??
are embedded/light
not an access analogue
remove the borrow checker from rust and tell me if they leak

obviously they will because you've removed the one thing that tells the compiler how to prevent leaks
YEAH DUH
ada doesn't have your borrow checker
accesses are simply just invalid the moment they go out of scope but not deallocated unless by the programmer
and im saying rust is better bc it does
one of the many reasons nobody likes accesses
rust does have std::mem::forget and Box::leak though if you really wanna leak memory
well, for your next project, add the borrow checker to gnat
me neither
I just benefit from the work others have done
which code
I wonder if I could make this compile with nix
basic_http_server or the library extensible_http
Uh whatever you’re trying to build rn
that's basic_http
at this point
i'd just forfeit and start making my own rts
but i know theres something OS specific that'll mess it up
yes that
it'd probably be something like
<embedded/light/light-tasking>-rpi3b
in ada terms
lemme see what the correct pkgsCross target is
rpi is still compiling gcc :despair:
is it really not as simple as adding a different toolchain
like it is in c
or even rust
or zig
it is
i just don't have the right RTS
like the weirdest thing is
theres gnat-10 on apt install
but not 11, 12, 13 or 14
so you're 4 years behind (no gnatX or gnat2022)
I will be surprised if this works first try
if you get the application running on an ip with its port 80 open lemme know
ill test its maven capabilities
i'd suggest adding -d maven though
im just testing the compile
I have no aarch64 machine to run it on
man
and if YOU wanna run it...you probably need nix on that rpi
well that depends on the RTS you compile with
i have no idea how nix handles that so
oh
idk either
all im doing is having it compile for aarch64-unknown-linux-gnu
what even is an rts
real time system?
if it goes by conventional logic it'll just use a generic linux RTS associated with your GCC
run-time system
basically the collection of Ada/System files needed for your app to work
no compiler that has a generic linux RTS
only embedded/light runtimes which are meant to run without an os
and you're trying to run it on raspbian assumedly
ok seems that it may be trying to compile more stuff than I thought
this might not be viable
oh?
okay your idea has some weight
alr build -- --compiler-subst=ada,/home/miko/.local/share/alire/toolchains/gnat_arm_elf_14.2.1_524d4d41/bin/arm-eabi-gnat make --RTS=/home/miko/.local/share/alire/toolchains/gnat_native_14.2.1_06bb3def/lib/gcc/x86_64-pc-linux-gnu/14.2.0/
worked up until it tried to reach the library which it didnt find
i gotta fix these 10 warnings before i continuie
yeah ok this cross compile thing doesn't seem to be wanting to work the way I want it to
okay now it's just breaking on link
ⓘⓘⓘⓘ
alright uh
video with japanese text... not recommended
okay but that works
no, couldn't get it to work
not to mention sometimes it just went back to x86
or something with the jvm or clr
your lanauge sucks 🗣️
i wonder if this plain text supports japanese text... gonna try Wide_Wide
says the one who can't even cross compile their language 
hmm wait i caannntt
says the one who can't even write a simple exe parser smh
(it's that you can't)
say one two
and four
wait, what
for some reason it only gets mojibaked when sent??
nuh uh
im busy
with like
completing assignments
do the me strat
okay so this appears to just be a firefox issue
aha
there
content-type set
oh hi
just put all of the memory in the registers
subprograms!
I also feel like the existence of declare blocks makes mountainous code more likely
mfs say "cyclomatic complexity" and my brain just shuts down
because you now have to incur an indentation penalty for adding variables too
vs in normal languages, just conditionals, loops, and functions
"normal languages"
you're being racist to pascal...
anyways i just cranked up the line limit
because the code was being compressed into like, 5 characters nearing the edges
mmmmmm i dont wnna
my task will contain all of its code and only its code
かめりあ feat. ななひら「ごーいん!」より
https://nanahira.jp/goin/
Music&Lyrics:Camellia https://twitter.com/cametek
Vocal:Nanahira https://twitter.com/nanahira
Illustration:4410 https://twitter.com/774_10
Movie:murAta Yuzi https://twitter.com/m_Yz
(興味ない 興味ない)
サンタさんほんとはいない
(Holy night Holy night)
カレンダーのほうがホワイト
(興味ない 興味ない)
だだだれも妬んでない!
(Holy night Holy n...
i gotta implement base64 after this scp sl break
when you did the smtp server, did you implement tls yourself or use something else
i forgor
used a hard binding to OpenSSL
now i wanna do it all in ada (and incur the timing vulns i have no idea about)
On the WolfSSL blog I saw the following announcement today: Today we are happy to announce the availability of an Ada/SPARK binding that enables Ada applications to use post-quantum TLS 1.3 encryption through the wolfSSL embedded SSL/TLS library. It opens the door to obtaining FIPS 140-3 and DO-178C certifications for Ada and Spark application...
can't use
y
y
so instead you use an unsafe c lib
me when I sidechannel you
@wheat zinc you like doing ctfs, learn how to sidechannel tls so you can find the flag hidden on atp's pc
that's fine
anythings better than the current state (anyone on the internet can overwrite/create files in the virtual root)
wait really
yes
turn it back on 👀
there was no authentication for PUT cause i felt lazy and deferred parsing base64 to later
it's blank
mmm
./buildAda.sh validation -d test_folder
mm how to put file
yeah but then send the data
http message body...............
it also supports unicode (theoretically) so use japanese
ah curl http://address --upload-file <file>
wow it works
you could make a pastebin off of this
check new file
check again
oh yeah
wow smh
i forgot you write with root access....
ok enjoy that file whose upload is still in progress
dang how long will this take
or did I make it crash @spare quartz
0 bytes
no that's false
no i cleared it manually
i am uploading file 2 u
if you were wondering where your large file went IT WAS NEVER WRITTEN
there you go
42838B ORDINARY_FILE 42.zip
I uploaded a smaller file
yeah...wanna unzip it...
just did .....
have that mp4 too
⚠️ not your imgur
yuh huh
#MyImgur
you should make it accept a 2gb file upload though
idk how maybe chunk it
Who is more trustworthy
- brand new http server written in obscure language
- literal curl
- good http server written in the language of gods
- you
here
try it out yourself
if it even works otuside of my machine
Idk I think it’s not curl’s fault
Idk could be my university internet being funny
And stop posting random .exe files smh you know I don’t run those
im trustworthyyyy
Nope
noted
Even if Terry sent me an executable file, I would not run it
well yeah but terry is the type of person to put 500 rats in one
what if i sent you a file named burgers.exe
okay just tested
yup you can break out of the virtual root
but i think i know how to fix that
no more jailbreak.
okay intereting
so these two are symlinks to ~/basic_http_server and ~ respectively with the virtual root at ~/basic_http_server/test_folder
going to jester and tester both give a 403 with the new system
so.. unintentional win?
TRUE
日本人になったよ
I STIL LDONT KNOW HOW TO READ IT ALL
あるいは、いつも日本人だったかも
Only if you finish it quick so you can write an ada LSP server and client
Ada.Strings.Fixed.Move (Data (Position .. Data'Last), Group, Ada.Strings.Right, Pad => ASCII.NUL);
Actually you might not need the client a server alone may be fine because I imagine VSC (or any other editor with support for LSP) is a client
That would make sense
im going to write a japanese transltaotr first .....
google translate is quickly becoming insufficient with the shorts i watch....
besides you need to know Japanese to know how to translate it :3
wikipedia :
And learning Japanese can take a lifetime…
You need to learn all the kanji and the vocab and the grammar structures and the nuances
Cause if you thought English was nuanced then you’re in for something else with Japanese
if it means i can watch the silly furries sing the songs better then ill take it 👍
Make LSP first
oh crap i forgot ada doesnt use zero index strings
Cringe
Actually honestly make something that either grabs subtitles from videos or does auto-subtitles and then feed that to Google translate or deepl
ummm
BUT LSP FIRST >:(
i wanna tdo the former
just not the latter
i'd rather dissassemble what they're saying first
Ok but the latter is just an api call
which involves GNAT.Sockets :despair:
imagine not having a decent socket impl in your stdlib
GNAT.Sockets is actually very decent
works on literally every os + real time
just is very verbose as its an ada library after all
Gross
pretty.
If you want to break apart the sentences then figure out what Japanese reading assist browser plugins do to break sentences apart
Or like feed it to jisho.org somehow or apparently JMDict is just a bunch of XML files you can squeeze into any app
ah gnatpp does not like giant arrays
nono like
japanese characters can be like, composite right
it's not just singular things like "a" "b" "c"
Different radicals yes
yeah i wanna look into that first
You want to break the kanji apart?
i don't wanna know what they're saying just breaking it apart
cause that's how i learn
Honestly if you want to study Japanese I can recommend wanikani because it does exactly this with kanji
oooooooooooooo right i need to dooooooo bit manipulationnn
If you want something that’s free, I personally haven’t used it, but kanji koohi might do something similar
oh you just reminded me
afaik ada doesn't have unicode tools built in like java/python do
Haha
There’s also vocabulary that doesn’t use kanji though
And I think all grammar structures involve kana
Learning the kanji and what radicals compose them will help you objectively understand sentences more than if you didn’t, but you’re not gonna get the full meaning without the grammar
abn fxx
x = 0b0000000
I also don’t understand this sentence at all
blep
Why do that if you don’t want to learn the actual meaning
because thats how i learn ....
i need to break things until they're something i can unerstand..
'POS thats it
hmm
Sometimes it don’t all make sense
i could probably represent the string as a 24 bit integer
just gonna violate a cornerstone of ada
Idk you just make no sense
god this is stupid
im very volatile
Like you wanna learn the radicals and how they compose the kanji, but you don’t want to learn the meaning of the kanji or what word it’s actually forming in speech
Like ????
yeah cause i wanna do the latter part later
the former part is just an immediate task like making an lsp
That makes more sense
Which you should do…
ill split the kanji first then 😁
Because lsp is responsible for like the intellisense shit
Which you don’t strictly need but it makes it nicer
okay but like splitting the kanji is just basic string operations which i think i got down with Ada.Strings.Fixed
Like this is caused by the lsp
Yeah but see lsp at the bottom
…idk if the Unicode representation of the kanji has any correlation to the actual strokes used in the kanji
....... big LUTs then!!!
What is a lut
look-up table
Linus Universe Tips??
It will be giant
There’s like 2000 commonly used kanji
And more than that which are not quite as common
It would have been incredibly smart if they made the Unicode correspond to the strokes
I’m actually curious now
i know theres still drama about what they did wrt CJK unification
but im not sure how its all structured really well (i only really look at technicals/latin)
Honestly you might have better luck making a program that captures kanji from the screen and tries to deduce radicals from that
Or even easier maybe: Captions -> split into words -> take kanji from words -> get radicals from dictionary
You could have a table that contains all non-kanji symbols because that is way smaller and filter on that
Use that to separate the kanji out
hmm range might actually come in use here
a lot of the test samples i have in mind have english mixed in with them so...
hopefully all kanji are defined without breaks though
Yeah don’t count English characters either
…that could be the case
That would be smart of them
It seems like this might be the case
@spare quartz range 0x4300 .. 0x9FFF is kanji
it's kinda hard to see but sequences of kanji are prefixed by \ and postfixed by /
const par = document.getElementById("test").textContent;
let newPar = "";
let started = false;
for (let i = 0; i < par.length; i++) {
let curr = par.charCodeAt(i);
if (0x4300 <= curr && curr <= 0x9FFF) {
if (!started) {
started = true;
newPar += "\\";
}
} else {
if (started) {
started = false;
newPar += '/';
}
}
newPar += String.fromCharCode(curr);
}
document.getElementById("test").textContent = newPar;
scp sl break over
Ugh I need to stop doing all the work for you
no keep doing it for me :3
okay
i should stop using stack overflow
it failed me
Mask : Base_64_Group := Base_64_Group (Shift_Left (Shift_Right (Unsigned_32'Last, 32 - (To - From + 1)), From));
but now i have this
Ada.Text_IO.Put (Shift_Right (Unsigned_32 (Extract_Bits (Group, Index * 6, ((Index + 1) * 6) - 1)), Index * 6)'Image);
perfect
what are those? the kana things?
okay neat i got a single bit of terminology down
they are the """native""" japanese text
more akin to our alphabet
and these are katakana
normally used for like adapted words
also ew a ヲ
so like question
there's thousands of kana/kanji right
how do japanese people do it?
learning from a young age and constant exposure
idk they've had thousands of years to perfect it because the chinese who invented these characters had thousands of years to figure out how to make learning them feasible and the japanese had a while after adopting them to further refine it too
hmm
yeah this is something i'll need to wrap my head around ...
so 46 basic kana (not including diacriticals) and 12 that come smaller
kanji learning methods normally do a good job of breaking this apart and using mnemonics to reinforce meaning
still trying to figure out how to effectively encode this base64
threw out the unchecked_conv method (depends on endian)
hmmm
example
btw this is gibberish
japanese lorem ipsum
@spare quartz
busy with scpsl
bro I wrote this code, no idea how it works its fucking magic
vector<vector<string>> makeinstr(string f) {
vector<vector<string>> instr;
bool instring=false;
vector<string> check;
string current= "";
// holy shit this is scary
for (auto i : f) {
if (i == '\"' && instring==false) instring=true;
if (i == '\n') {check.insert(check.end(), current);current.clear();instr.insert(instr.end(),check);check.clear();continue;};
if (i == ',' && instring == false) {check.insert(check.end(), current);current.clear();continue;}
current+=i;
}
return instr;
}```
what the fuck is that 😭
reading 6 bits at a time
I thought there wsa a "bug" in this and there wasnt
wait cant you like
mod %8
and just rightshift then leftshift to normal
so the last 2 bits are in overflow register and ignored
what does this even do 💀
its for an assembler, it takes a string
"instruction operand, operand, maybe string for db instruction"
and converts it to
{
{ instruction, operand, operand},
...
}
a vector of instructions
oh I stared at it for 5 minutes and understand it now lmao
but damn thats scary
That’s all of C++ - fuckin magic
IT DOESNT WORK
base64
RFC4648 BASE64
basically
Why did they make it 6 bits 😭
you read in 3 bytes (24 bits)
Make a data type that’s 6 bits wide
you split that up into 6/6/6/6
Or like read 4 then 2
and reference a LUT with each of the 6 bit numbers
if you're missing data then you pad zeros, if you're missing something out of the three you add a =
i tried that
it also didn't work
cause of endianness stupidness
AAAAAA | AA . AAAA | AAAA . AA | AAAAAA
rust!!!
View screenshots of insecure (publicly open) VNC servers from VNC Resolver
AAAAAA | AA . AAAA | AAAA . AA | AAAAAA
BBBBBBxx | BBBBBBxx | BBBBBBxx | BBBBBBxx
OLlama is so bad
It forces you to use a server that takes 500 megabytes of ram
Haved to turn off the server with systemctl
@spare quartz :3
Ada is modern, supported, and widely used
C++ is literally just a 5 year old making bad decisions for 30 years
I bet F# and OCaml are more widely used than Ada
Explain. Show your work. 0/5 points.
and probably Common Lisp
In embedded projects?? Nah..
in general
Ada is a general purpose language but I’m not gonna go out and say it’s better than everything else
Don’t use it to write code LIKE java or rust
- semi-modern: hmm I may concede that it is modern
- semi-supported: see lack of libraries, lack of interfaces with other things, and most potently lack of functional cross compilers
- not widely used: see lack of libraries, lack of community, and honestly I dare you to do a github search for ada projects and find ones that aren't included in alire's package index, even the DOD dropped the mandate to use Ada
- modern: agreed
- supported: it supports all operating systems, GNAT is directly built into GCC (there’s just a modest lack of prebuilt compilers, we have a ton of embedded drivers/RTSes though)
- not widely used: still incredibly used in the aerospace domain because it’s just that good. it sucks that we have like, nothing for an ecosystem apart from AdaCore and Alire
There’s also Green Hills Software but their stuff is literally classified
ok well if it's supported then cross-compile your http server for a raspberry pi :3
I’m still building GCC on that pi
?
idea idea idea
if it's built directly into gcc
on your normal machine, install arm-none-eabi-gcc
Oh I already have
Just didn’t work well with GPRbuild since I assume alire is messing it up with x86
hmm
Since the alternative is… hand building/binding/linking every file
Maybe
Speaking of scp sl…..
I made my first exiled plugin, it also helped (and is helping) me learn c#
Exiled is very hit or miss imo though it’s a great resource
average kanji
just use bytes fr fr
tell that to the people who made basic authentication
bruh why did they do base 64 instead of base 256 or sommething
naw this is not acceptable make your own security raaah
raaah
wait how did you get physicist
lua code
no way I can get cool role if I just send some lua code
yeah
I verified and the channel is still locked 💀
I was gonna delete the duplicate one I swear
i love chinese
huh
@timid quartz so
turns out
installing a windows cross compiler is as easy as cake
i just need to find one for arm on pkgs
works almost completely fine too
w
now make it so you can replace every javasccript framework with lua code
wait are you cross compiling from ubuntu to windows or windows to ubuntu
former
w
Oh, that was cause of a different set of issues
@spare quartz but can you cross compile from x86 to aarch64 on ubuntu 24 
yes
(the answer is no)
Namely the Ubuntu 18 system i was on just exploded itself
yeah
just compile gcc with aarch64-xxx-linux
Oh fr? Well at least you won’t have to make your pi compile things anymore
Just download the prebuilt compiler lol
arm-none-eabi my beloved
whats eabi raah
embedded
Bare metal target
Eabi without hard float means there’s no FPU
This mf probably runs his system on a gpu ^^^
Also also
It’s not my pi
Huh
Yeah
It’s a friend’s, they gave me SSH cause this HTTP/Maven stuff is for a project considering something we both manage
okay weird
this package installs fine but gprconfig doesn't see it as a compiler
i also installed a cross compiler for https://en.wikipedia.org/wiki/Motorola_68000_series just to check
The Motorola 68000 series (also known as 680x0, m68000, m68k, or 68k) is a family of 32-bit complex instruction set computer (CISC) microprocessors. During the 1980s and early 1990s, they were popular in personal computers and workstations and were the primary competitors of Intel's x86 microprocessors. They were best known as the processors use...
(even though i can't use this)
cool
./basic_http_server-aarch64: /lib/aarch64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by ./basic_http_server-aarch64)
aw crap
bros missing libc
the pi only has 2.31 😭
this is literally just a makefile
ALSO you wanna talk overgrown makefile, look at gprbuild
umm
no
its a Bourne Again shell script
but nice try liberal
yeah but
what does it do
it runs a compiler
basically a makefile disguised as a shell script
gprbuild is literally make
dangit
i need to fix windows directory listing
you deleted it

windows won't let me allocate :80 so ill just use a port you cant
let me innnn
raised ADA.IO_EXCEPTIONS.USE_ERROR : Unable to get modification time of the file "C:\Users\Adenosine3Phosphate\Downloads\Auto-GCAS_Saves_Unconscious_F-16_PilotΓÇöDeclassified_USAF_Footage.webm.480p.vp9.webm"
[C:\Users\Adenosine3Phosphate\Downloads\basic_http_server.exe]
0x7ff689c019ab ada__directories__modification_time at ???
0x7ff689c02ec3 ada__directories__base_name at ???
0x7ff689c03244 ada__directories__start_search at ???
0x7ff689bc41cb basic_http_server__sockettaskTB.1 at ???
0x7ff689bf4d0e system__tasking__stages__terminate_task at ???
[C:\WINDOWS\System32\KERNEL32.DLL]
0x7ffc45725765
[C:\WINDOWS\SYSTEM32\ntdll.dll]
0x7ffc464823ea
ok anyways I eep
good
rr @spare quartz how do I structure code I hate thinking of how to structure code
for the exe reader do I make records do I just make a bunch of functions and procedures rrr
whatever looks good to you
For a file format I’d just make a record and store everything in it
i hate structuring code i hate structuring code i hate structuring code i hate structuring code i hate structuring code i hate structuring code i hate structuring code i hate structuring code i hate structuring code i hate structuring code i hate structuring code i hate structuring code i hate structuring code i hate structuring code i hate structuring code i hate structuring code i hate structuring code i hate structuring code i hate structuring code i hate structuring code i hate structuring code i hate structuring code i hate structuring code i hate structuring code i hate structuring code i hate structuring code i hate structuring code i hate structuring code i hate structuring code i hate structuring code i hate structuring code
It won’t be if you read the documentation right
no no no no nobut
ok
ok
so for a rust roblox api library I made and left half finished a while back
the way it works is that you have a struct (Ada record equivalent) that represents your client and wraps around an inner struct that handles requests and the optional roblosecurity cookie
and it's great because it's one thing that contains all your info
EXCEPT what if you're doing async or multithreading? your program is gonna get stuck sharing that one client OR you're gonna have multiple clients
it would have been better to make just a collection of functions and maybe an optional struct that you also use as an argument that holds the roblosecurity cookie
soouuunndddsss like you should put that client object in a protected object
no no but like
you can't make concurrent requests
because you have to share the client around
but why not?
yeah so like, why not just have an .Initialize on a package that sets a private protected object
and then use that for future calls
but then each thread gets its own client
hold on lemme wake up
which defeats sharing the http requester object and the roblosecurity cookie
no, since each task would be going through that package for requests, every task would only be using the set client
oh and xcrf cookie
unless that’s not what you want
ok well this would work IF the xcrf token wouldn't expire
or whatever it is
just renew it in the protected object
because you have the roblosecurity cookie that is fairly long-lived but then you have the xcrf token or whatever that isn't long-lived at all
and in order to renew it, you need a mutable reference to self
but rust only allows one thread to have a mutable reference at a time
because yknow.....safety...
with an protected object I wouldn’t see that being a problem
rust doesn't have this concept of a protected object
I could wrap the token in a mutex but then that gets so annoyingg
but even then
on pc now
I think it would have been better to have a collection of functions
and interior mutability behind an immutable reference sucks
with Roblox;
with Roblox.User;
procedure Main is
begin
Roblox.Initialize ("cookie!"); -- sets the cookie in a protected object in the private part of Roblox
Roblox.User.Ban_Aerasto; -- goes through the protected object to obtain (possibly renew) cookie/xcrf
end;
use std::thread;
fn main() {
let client = ClientThingey::new(Some("roblosecurity"));
thread::spawn(|| thread(&client));
}
fn thread(client: &ClientThingey) { /* ... */ }
versus
use std::thread;
fn main() {
thread::spawn(|| thread());
}
fn thread() {
let request_jar = Jar::new(Some("roblosecurity"));
// ...
}
and like
the reason
is the xcrf token or whatever can expire
so within the client it has a way to detect that and try to refresh it
which requires a mutable reference to self
i forget how many punctual characters you use in rust
very cool, it's like java lambdas
gee okay.
() -> System.out.println("java");
{ println("kotlin") }
(ada has no equal except for AtS :<)
ok the difference is that a lambda is just an anonymous function whereas a closure closes over the environment around it
what is $it
snapshot (closure) of a at the time let was called
it is the default for the first argument in a one-argument lambda in kotlin
a.let { a -> ... }
but it can be renamed like that
kotlin won't let you just do a simple null check most of the time (for example), so you have to use closures a lot
ic
fun main() {
var a: String = "test"
var b: String = "test2"
a.let { println("closure of $it (a) $b (b)") }
}
yeah this works
so kotlin lambdas do indeed close over the environment
so they are closures not lambdas
you should go correct their docs
mmmmmmmmmmmmmmmmmm lazy
.let / .also are closures
var a = { println("A") }
while this is a lambda
im pretty sure $b isn't a closure of b
if a thread changed b during the parsing of that string for example, it wouldn't be what it was at the time of calling let
it would be unaffected though
no it's a closure because it's able to capture things from the environment it was called in
fun main() {
var a: String = "test"
var b: String = "test2"
a.let { println("closure of $it (a) $b (b)") }
var c = { println("$a $b") }
c()
}
like this works
i'd need to look at the JVM bytecode
fn main() {
let test = "a";
let test2 = || { println!("{test}"); };
test2();
}
in the same way this works
but the way i understood closures are they take a current snapshot/copy of thing x in the environment
$a / $b aren't that, they're just references to the variables in the environment
a.let {
if (it == 5) println("a was 5 at the time let was called, and it will always be 5")
}
if (b == 5) println("b was 5 at the time this if statement was evaluated, but we can't be sure b is still 5 in this branch")
i thought they could
