#🪅-progaming

1 messages · Page 120 of 1

valid jetty
#

??????????????????

deep mulch
#

sorry

deep mulch
#

spamming my feed

lucid trail
#

average swiftui experience

#

ts pmo

shrewd canopy
#

:)

lucid trail
#

swift ui is not a serious framework

lucid trail
deep mulch
royal nymph
lucid trail
#

god swiftui actually sucks

#

rewriting parts of my app with UIKit because swiftui is too slow

lucid trail
#

true and factual

#

it was for a totally normal UI bug though

#

nothing complex

#

Nope, it was for a toolbar and I forgot to put Spacer inside a ToolbarItem

nimble bone
#

Vibe Coding Enthusiasts

deep mulch
#

@valid jetty

#

rosie.pi

#

rosie.314159

hoary sluice
#

@valid jetty

#

transalted by chatgcpt

#

task is in german

#

u can translate it if u wanna red it

#

read

deep mulch
#

transalted

valid jetty
#

@deep mulch

deep mulch
limpid mica
#

no

deep mulch
#

@87flowers hi ii

limpid mica
spark tiger
#

/run

import math
print(chr(sum(range(int(''.join(reversed(str(int(math.sqrt(2025))))), 0x10)))))
deep mulch
#

amog

spark tiger
#

it literally said why 😭

#

shrewd canopy
#
this
spark tiger
shrewd canopy
#

many languages

spark tiger
#

any language u just gotta specify it after ``

#

you need three ` s

pseudo sierra
#

do
```py
code

nimble bone
#

#🤖-bot-commands for ur shitposting tyyy

#

you are clogging up the channel

winged mantle
#

https://www.youtube.com/watch?v=8M0QfLUDaaA great video which told me nothiung i didn't already know

We go to some strange places in the computer...

  • A rough model of the stack and heap.
  • Copy and Cloning values
  • The three rules of ownership
  • Immutable and mutable borrows
  • Slice borrowing

The Rust book: https://doc.rust-lang.org/book/second-edition/
List of Copy types: https://stackoverflow.com/a/41413595

End song:

Track: LF...

▶ Play video
frosty obsidian
#

you can't

#

its completely sandboxed

nimble bone
#

i don't care do it in #🤖-bot-commands or get banned

nimble bone
deep mulch
#

@frosty obsidian wingyyy

royal nymph
#

vprune 100 by bots

#

vprune 100 by @glad moth

gilded surge
#

was trying to debug why iwlwifi (the wifi module for the linux kernel) was failing on startup and looked it up and eventually figured out that a WINDOWS 11 SETTING is to blame for broken linux drivers, apparently if you enter hibernate windows 11 interjects some stupid fast startup thing that prevents your wifi adapter from starting up correctly

#

and that happens on all future boots from then on until you disable the setting

deep mulch
#

you love

shrewd canopy
#

No wonder why it explodes

hoary sluice
#

@valid jetty @deep mulch my uni uses Go

#

as the entry language

#

i was gonna ask if i can submit my homework in a diff language

#

but ig this is a good reason to learn go

valid jetty
#

lmao oh god

winged mantle
#

go good

hoary sluice
#

yet another reason to use nvim

shrewd canopy
#

Bruh

fleet cedar
ionic lake
#

Is that jetbrains

shrewd canopy
#

And i dont think nvim works best on windows

fleet cedar
#

I do wonder why the politically corrects went for blocklist and allowlist rather than the obvious redlist and greenlist

balmy lintel
#

whitelist literally means being allowed to do something

winged mantle
#

i don't really understand what's meant to be wrong with blacklist/whitelist though

#

i've never seen an actual... explanation lol

fleet cedar
#

Some people thing everything involving monochrome colors is inherently racist

winged mantle
#

or like master branch? wheres the evidence to suggest there's something wrong with that?

fleet cedar
#

I do agree that master/slave terminology is pretty sus

winged mantle
#

feels like some things got caught in the crossfire of master/slave language

fleet cedar
#

Yeah

winged mantle
#

master/slave is catstare , yes but sometimes there's just a master

fleet cedar
#

Main is a better name than master, but changing the default after several decades is just dumb

winged mantle
#

but who ever talks about the term "master recording" being offensive in music

#

its not master as in "in charge", it's more like master as in original

fleet cedar
#

Or remastering a game

winged mantle
#

yeah that doesn't mean... reownering

winged mantle
#

nobody really has any strong arguments its all really odd

royal nymph
fleet cedar
#

Ew

winged mantle
#

lmao wat

#

what if that... is somebody's title

royal nymph
winged mantle
#

i think its a little silly to make things always gender neutral tbh

#

like if you're talking about an actual policeman

fleet cedar
#

I think gender neutral terms are fine if you do -folk

#

Policefolk, firefolk, chairfolk

winged mantle
#

police officer

#

fire officer

fleet cedar
#

Chair officer

spark tiger
#

my code is always so inclusive! 😊

winged mantle
#

idk i think this is kind of performative activism

#

sorry...

fleet cedar
royal nymph
#

Also like 95% of firefighter are men

if you want to be inclusive maybe work on getting more women interested in the job than policing people's language love

fleet cedar
#

My code isn't particularly inclusive, I have <string> and <vector> in pch so that I don't have to #include them

winged mantle
#

tables have turned

#

you will be most successful from creating a "non-woke, dei free" ide

fleet cedar
#

What's dei

winged mantle
#

[x] correct gender neutral/female language
change all pronouns to he/him

royal nymph
#

[X] Keep politics out of open source - Prefer he/him over woke pronouns like they/them

winged mantle
#

ctrl+alt+a Insert ableist language

#

probably the sort of thing people like these days...

fleet cedar
#

I don't mind they/them, that one's been used for centuries

winged mantle
#

i'm not "anti-woke"

#

i do find some stuff a bit silly though lol

#

sometimes

#

allowlist is a more logical word arguably

nimble bone
#

[X] Keep politics out of open source - Prefer nonwoke maintainers over woke maintainers like @royal nymph

hoary sluice
winged mantle
balmy lintel
#

everything/everyone is male for me unless they specify otherwise

hoary sluice
#

can it stop fucking glazing me

hoary sluice
royal nymph
balmy lintel
royal nymph
hoary sluice
jade stone
#

Why would you ever use svelte though?

winged mantle
#

should i switch to sqlite

#

i guess probably not (because i'm too far into this project)... but is sqlite fine even if you have multiple processes accessing the same db

hoary sluice
#

@valid jetty is this actually bad

let a = &self.something;
do_stuff(a.read_stuff());
let mut b = self.borrow_mut();
b.do_stuff();

chatgpt told me this is ub because a is still alive while self is mutably borrowed in b

#

@fleet cedar

#

even tho a isnt used after b is mutably borrowed

valid jetty
#

thats fine as long as you dont use a after creating b

#

or well, rust wont let you

hoary sluice
#

chat says itll work now but it might break with a different compiler

valid jetty
#

???

#

why are you listening to chatgpt

#

Excellent! You're thinking like a true vibe coder now. Here is the correct solution:

hoary sluice
#

im just confused

#

as to why it thinks theres an issue here

fleet cedar
#

Because it doesn't think

#

It's autocomplete

hoary sluice
#

You can’t have a shared (&T) and mutable (&mut T) reference to the same data at the same time.
Even if you don’t use the shared one after creating the mutable one, both exist concurrently, which breaks Rust’s aliasing rules.

The compiler and optimizer assume a &mut T is the only reference to that memory.
If an old &T still exists, the optimizer may reorder or remove reads/writes, producing wrong results.

So code like:

let a = &self.field;
let b = self.borrow_mut(); // mutable borrow of all `self`

is undefined behavior because a and b could alias.
Rust forbids this to keep memory safety and compiler optimizations valid.

#

specifically when you borrow some field of self immutably before then mutably borrowing all of self

fleet cedar
#

No, NLL was added many years ago

hoary sluice
#

i will be arguing with it until one of us proves their point

fleet cedar
#

References are tracked by liveness, not just lexical scope

hoary sluice
#

i am aware

spark tiger
hoary sluice
#

and so is he

manic condor
#

Hi all, quick question! I love using the pinned DMs plugin, but I was wondering if there's a way to hide this section here? I'm trying to clean up my view a bit. Thanks in advance. Also if anyone has a code for hiding the sicker button that be awesome too.

fleet cedar
#

Is pindms different from favoriting a chat in vanilla?

manic condor
#

this is what i am using if you are talking to me

hoary sluice
#

@fleet cedar can you help me understand this The update would be a compiler optimization that fully trusts the noalias guarantee on &mut references.
It would allow LLVM (or a MIR pass) to reuse or reorder memory reads and writes across function calls that take &mut, assuming no other reference can see the same data.
Once that optimization lands, code that still keeps an &T alive while calling a &mut self function could start reading stale values—a silent miscompile—because the compiler now skips reloading memory it believes cannot change.

#

or why it is wrong

#

cause i dont

fleet cedar
#

That sounds like complete poop

#

If you wanna discuss questions that's fine, but discussing ai poop answers is nonproductive

hoary sluice
#

it does, its saying because there is another reader it will skip the write

#

or something

fleet cedar
#

It's writing words in plausible-looking sequences

hoary sluice
#

Let’s be exact.

If your immutable reference is never used after the mutable borrow, then in practice there is no observable problem.
The compiled code will behave the same no matter how the optimizer reorders things, because nothing reads through that old reference again.

The formal UB label only exists because Rust’s aliasing model has to forbid all overlap so it can safely mark every &mut as noalias without analysing each case.
That’s a conservative rule for correctness proofs, not a statement that your specific code will miscompile today or tomorrow.

So:

  • Real-world effect: nothing bad happens, because the old reference is never used.
  • Language-lawyer view: still outside the defined model, because the compiler isn’t required to keep it working.
    Both statements are true. The “UB” flag is about what Rust guarantees, not about an actual runtime hazard in your exact program.
fleet cedar
#

If you want to discuss nuances of borrow checking, a human is much better than a word poop machine

hoary sluice
#

ok thats what i thought

hoary sluice
#

and i dont even know if its right about it being """ub"""

fleet cedar
#

And it's wrong, because if it was ub then borrowck wouldn't accept it

hoary sluice
#

that was my argument

#

it said the borrow checker cant detect all ub

fleet cedar
#

If you ask your questions here I can answer them

#

I do not waste my time arguing against word poop

hoary sluice
#

i was moreso trying to convince the llm that im right

fleet cedar
#

A futile endeavor

hoary sluice
#

im right 😎

#

i shouldve just gone to sleep instead

fleet cedar
#

I'm sure it still snuck in an incorrect edge case

#

Like it always does

hoary sluice
#

but not really

fleet cedar
#

Yep it's still claiming there's ub

hoary sluice
#

its also saying the code is safe

fleet cedar
#

It's literally saying "the code is ub but compiler lets it slide"

hoary sluice
#

well

#

yes

#

lol

#

it feels like its instructed to make the code it generates as verbose as possible

#

so even if you use it as a typing assistant you still have to refactor what it spits out

fleet cedar
#

Most likely yes

hoary sluice
#

wtf its been an hour

#

im never debating an llm again

frosty obsidian
#

you can't debate something that literally has no capacity for reason

deep mulch
#

in this project i have theres a massive workflow with building and testing and release

#

would it be better to split the release into its own?

#

but then i would have to copy/paste like 200 lines of jobs

#

@jade stone help

ionic lake
#

build a matrix

deep mulch
#

i did

#

its over 300 lines total

jade stone
deep mulch
jade stone
ornate quiver
deep mulch
#

could run build workflow, then release workflow would be able to take those artifacts

#

idk

ornate quiver
#

I would split it off
there's subtle differences that don't make putting them together good
like for example you shouldn't be using cache for release builds

deep mulch
#

oh really

#

i didnt think about that

ornate quiver
#

yeah

deep mulch
#

i willd o that blobcatcozy

royal nymph
deep mulch
#

Let's suppose you have a workflow with a job in it that at the end uploads an artifact using actions/upload-artifact action and you want to download this artifact in another workflow that is run after the first one. Official actions/download-artifact does not allow this.

#

vee blindd

ornate quiver
#

why would you need cross-workflow artifacts

#

oh you sent that a long time ago

supple whale
#

gh so brokey recently

pseudo sierra
supple whale
#

HORRRRYYY

#

thats crazy

#

never seen that1

spark tiger
hoary sluice
#

who cares what vaxrys opinions are

#

nothing in the world changes because of vaxrys opinions

shrewd canopy
shrewd canopy
pseudo sierra
hoary sluice
#

and host genocide

#

minecraft specifically just because its microsoft owned

#

java because of oracle

shrewd canopy
shrewd canopy
hoary sluice
hoary sluice
shrewd canopy
#

have to block linux users

deep mulch
#

🦅ly @hoary sluice

hoary sluice
#

@valid jetty

#

i just did some progaming for like 15 minutes and then realized my mouse was disconnected the whole time

#

i think ive achieved perfection

shrewd canopy
# hoary sluice 😡

I prefer supporting predictable and stable platforms (linux isnt one of them), sorry

hoary sluice
deep mulch
#

true

stark timber
#

ok am running into this issue now 😭 where can I find that proxy wrapper u were talking about

serene elk
#

just maka the target of the proxy a function

#

instead an object

#

new Proxy(function(){}, {....})

stark timber
#

olrite

spark tiger
serene elk
#

and then if u run into an issue with making Object.keys or similar work let me know

#

there's another thing in particular of when you make the target a function

spark tiger
valid jetty
#

@hoary sluice @deep mulch i plotted a julia set

#

basically you iteratively call f(z) = z^2 + C

and then shade the point based on whether the resulting curve diverges (goes off to infinity) or converges (approaches a limit point), and if diverges how fast it does so

and with my mouse i'm controlling the value of C

#

and if you render that you get this very beautiful fractal

valid jetty
#

yes

deep mulch
#

oh is it entirely cpu

#

no shader?

valid jetty
#

nono it is a shader

#

this is the shader

deep mulch
#

oh

valid jetty
#

this is the elle code that renders it

deep mulch
#

whats fs

valid jetty
#

fragment shader

#

glsl

deep mulch
#

oh

#

isn't the extension glsl

valid jetty
#

idk

#

i call it .vs and .fs usually

deep mulch
deep mulch
valid jetty
valid jetty
#

it's like surprisingly simple

deep mulch
#

I should do in my compose fractal thing

valid jetty
#

the test for divergence is basically whether it exits the unit circle lol

#

that's the cplx_abs(z) > 2

deep mulch
#

I mostly just used AI cause I literally could not find anything that did mandelbrot programmatically that wasn't single letter variables

hoary sluice
deep mulch
#

julia seems easier

hoary sluice
#

what makes this different from a Mandelbrot

deep mulch
#

@hoary sluice you love my compose scripts project

crude star
#

julia and mandelbrot sets are dual

valid jetty
#

yes

valid jetty
#

the values of C that converge are actually defined by the mandelbrot set

valid jetty
#

no lol

#

z is a variable in f(z)

deep mulch
#

oh Rosie my Rosie

#

there was some cool fractal video I saw

hoary sluice
valid jetty
#

oh

hoary sluice
#

so what is z

crude star
valid jetty
#

f(z) = z^2 + C

deep mulch
#

function!!

valid jetty
#

start with some z, typically the position of the pixel you're calculating

then you just apply f(z) = z^2 + C some amount of times

if the output point is within the unit circle (|z| < 2), then it converges, otherwise it diverges

and you control the value of C

hoary sluice
valid jetty
#

the more iterations, the higher resolution your fractal

valid jetty
#

the initial z*

deep mulch
#

how many dimensions are julia sets

hoary sluice
#

i get it

#

you iterate f(z)

deep mulch
hoary sluice
#

the guy in the video explained it

valid jetty
valid jetty
valid jetty
hoary sluice
deep mulch
#

@valid jetty make it so you can step through the iterations

#

@valid jetty make elle compile to spir-v

valid jetty
# hoary sluice oh i didnt read this message

well specifically i start with

float x = mix(x_min, x_max, fragTexCoord.x);
float y = mix(y_min, y_max, fragTexCoord.y);
vec2 z = vec2(x, y);
``` which basically maps the pixel coord into a value from x_min to x_max and the same for y
valid jetty
deep mulch
#

world to screen or something

valid jetty
#

you can just control the value of max_iterations

deep mulch
#

@valid jetty hii

#

hop off silent typing

#

so bad

valid jetty
#

nop

#

now that i have client mods on my phone again i will take full advantage

winged mantle
#

i have a good idea

deep mulch
valid jetty
#

screen to world

stark timber
stark timber
#

'cause I tried that but it always returns undefined

#

like this should be returning a rejected promise

winged mantle
#

i don't think my idea will work

#

i wanted to make iostream in kotlin :(

#

there's no <<

#

and you can't even overload shl

serene elk
#

you need apply too

stark timber
#

ty

deep mulch
#

make elle run on embedded devices when

#

I wanna run elle on my esp32

hoary sluice
#

compile to x86, decompile to c, compile to esp32 husk

stark timber
#

look guys I made it so u can search and sort playlists in the browser

solid gazelle
#

racchole

stark timber
placid igloo
#

how many minutes

#

I've got 6 outof 7 minutes

placid igloo
winged mantle
#

i just realised i'm kind of not prioritising getting hello world working in my language

#

hello world is hard...

#

idk maybe strings can just be another primitive type

shrewd canopy
winged mantle
#

my value.h header is already bloated

#

but yeah i guess they probably should be lol

#

why did i think this would be hard

shrewd canopy
#

I mean optimizing strings if they were primitives would be easier

winged mantle
#

if they were objects that'd mean two levels of indirection to the data ig

#

i had to remind myself that strings are immutable in gc languages so that would be pointless

#

unless i want to be weird and make strings mutable

shrewd canopy
#

Make another string primitive then

winged mantle
#

i like the way the compile command i made doesn't tell you off for passing no files lol

shrewd canopy
#

Mutable string primitive purely for optimization/performance purposes

winged mantle
#

horror

#

trying print hello world

#

that's what i like to see

#

seems my lexer doesn't like strings

#

what could i possibly be doing wrong LOL

shrewd canopy
winged mantle
#

average c code of somebody who doesn't normally code in c, probably

#

idk

#

probably pretty typical c code

#

&***&*(void **)memcpy(x1, ++++++x2)

jade stone
#

copilot is so smart and so stupid at the same time

royal nymph
#

how do you not have /bin/bash????

ornate quiver
#

i ate it

valid jetty
#

i turned the message action sheets into context menus

#

it's actually way nicer than the action sheet i love it

#

tho i have to find a way to bring reacting back

valid jetty
#

client mods

#

i have this patch ```ts
Patcher.before(ActionSheet, 'openLazy', (self, [component, type, message]) => {
if (type !== "MessageLongPressActionSheet" || !message) return;

component.then(instance => {
const unpatch = Patcher.after(instance, 'default', (_, __, res) => {
unpatch();
const buttons = findInReactTree(res, x => x?.[0]?.type?.name === 'ButtonRow');
if (!buttons) return res;
const state = ContextMenu.useContextMenuState();
const items = React.useMemo(() => buttons.map(({ props: { message, onPressRow, IconComponent } }) => ({
IconComponent,
action: onPressRow,
label: message
})), []);

  React.useEffect(() => {
    ActionSheet.hideActionSheet();
    ContextMenu.showContextMenu({
      key: `uid_${message.id}`,
      x: 33,
      y: 250,
      position: 'below',
      align: 'left',
      height: 126,
      width: 102.33332824707031,
      state,
      items,
      title: "Manage Message",
      requestClose: () => {
        ContextMenu.hideContextMenu();
        const active = state?.activeIndex?.value;
        active >= 0 && items[active].action();
      },
      onClose: () => {}
    })
  }, []);

  return res;
});

});
})

#

that ive been working on since last night

#

i finally got it to work this morning

hoary sluice
#

discord uses react native??

valid jetty
#

on mobile yes

hoary sluice
#

I thought they did kotlin

valid jetty
#

on ios, always

#

on android, since discord 127

hoary sluice
#

when was 127

#

and were they on kotlin before

valid jetty
#

we're now on discord 300-ish

hoary sluice
#

oh

valid jetty
#

they were on kotlin

#

that's why aliucord is on such an old version

hoary sluice
#

i heard they were switching to react native like a year ago

valid jetty
#

they're using the last version before discord switched to RN

#

i'm also running an old version, the last one that has tabsv2

#

discord 213

hoary sluice
#

is there deobfuscated source code for discord

valid jetty
#

which is from about feb 2024

valid jetty
hoary sluice
#

i think i remember that layout

valid jetty
#

it was awesome

#

that's why i'm bringing it back

hoary sluice
#

rosie are you allowed to work at 17 in the uk

valid jetty
#

uhhh probably

hoary sluice
#

you can open a company at 16

#

and do b2b contracting

#

so there are no restrictions on working hours

#

you should look for part time contracting

#

to build experience on a resume

#

(or just lie on ur resume after ur done with school)

ionic lake
#

The children yearn for the mines

hoary sluice
#

i will raise my children as software devs from a young age

#

then outsource my work to them

#

and when theyre adults i will apply to jobs for them with my resume and let them do the work and take all the money

#

i should name my eldest son after myself so this is easier to do

valid jetty
#

make a pr now

#

@royal nymph you will merge

hoary sluice
#

you should submit this to expressjs itd be funny

gilded surge
#

i square to god i will kms

#

the quickshell systemd service doesn't correctly load singletons when u reload your config so you have to stop and then start the service

spark tiger
#

It's finally here. Zed is available on Windows.

Built from scratch, and rendering at 1 million pixels/millisecond.

hoary sluice
#

wtf is that unit

jade stone
#

guhhhhhhhhh

#

me when i want to use regex but vscode says EOL bug

lucid trail
hoary sluice
#

so it runs at 101fps at 4k

#

thats not that impressive

valid jetty
#

@robust jackal ignore how it's so slow but i did it.. (it turns out making a pop out component here is really hard)

#

thanks discord!

#

yay

tired vigil
valid jetty
#

it does

#

im running an old version

tired vigil
#

I see

shrewd canopy
valid jetty
#

not really

#

usually its 1-2 max

#

this is just ultra bad

#

well i should probably do a findInReactTree for that

#

but i just took it straight from my repl

#

its fineeeeeee

#

@cinder egret can you give me brainrot for a sec i wanna see if it explodes

#

no obviously not lol

#

im on 213

#

oh

#

212

cinder egret
valid jetty
#

ignore that lmao

#

its from a really old plugin i made

#
import { get, set } from '../common/store';

export abstract class Patch {
    static key: string;
    static title: string;
    static subtitle: string;
    static icon: string;

    static get(key: string, def?: any) {
        return get(`${this.key}.${key}`) ?? def
    }

    static set(key: string, value: any) {
        return set(`${this.key}.${key}`, value);
    }

    static get enabled() {
        return this.get('enabled');
    }

    static patch(Patcher) { };
    static render({ disabled }) { };
}
#

i made the chat menu thing as part of utilitypatches

#

which i havent touched in at least 2 years

valid jetty
#

@hoary sluice @deep mulch

#

this one isnt interactive because its a very particular fractal

#

its (|Re(z)| + i|Im(z)|)^2 + c where c is the pixel coordinate

deep mulch
#

show shader code

valid jetty
deep mulch
#

where did you learn how

valid jetty
#

wikipedia

deep mulch
#

is there any guides that isn't just plain math

deep mulch
valid jetty
#

it literally just tells you

deep mulch
#

I cannot read that

#

idk what Im is

#

tlelll

#

@valid jetty you will help me

valid jetty
#

a complex number is z = a + bi

Re(z) = a
Im(z) = b

deep mulch
#

I'll try to make it in my compose script

#

what is Re and Im

valid jetty
#

real and imaginary parts of z

crude star
#

real and imaginary

#

|x| is abs(x)

deep mulch
#

ik

#

what is c

valid jetty
#

the pixel coord

#

basically, its like the mandelbrot set

#

but instead of just z^2 you take the absolute value of the components

deep mulch
#

does x and y map to c somehow

valid jetty
deep mulch
#

oh

#

so it's a vec2

#

guh

valid jetty
#

min and max are just the bounds of the graph

deep mulch
#

I hate single variable letter names like that

valid jetty
deep mulch
#

just call it pos

valid jetty
#

its not pos

deep mulch
#

@valid jetty im ready

#

teach me

#

@valid jetty

#

rosie either died or is typing an essay

#

i hate silent typing

valid jetty
#

im heree

deep mulch
#

hii

valid jetty
#

what do you want me to do

deep mulch
#

i wanna make burning ship

#

what if i timeout you @young flicker

valid jetty
deep mulch
#

yes

#

hold on

#

gonna add a way to switch shader

valid jetty
#

okiee

deep mulch
#

@valid jetty

valid jetty
#

ok awesome

deep mulch
#

rosinga

valid jetty
#

now define a vec2 for min_x, max_x, and another for min_y, max_y

define a number of max iterations and send it to the gpu

now in the gpu, get these functions so you can perform complex arithmetic

// (a + bi)(c + di) = (ac−bd) + (ad+bc)i
vec2 cplx_mul(vec2 a, vec2 b) {
    return vec2(a.x * b.x - a.y * b.y, a.x * b.y + a.y * b.x);
}

// |a + bi| = sqrt(a^2 + b^2)
float cplx_abs(vec2 a) {
    return sqrt(a.x * a.x + a.y * a.y);
}

you dont really have to know how they work, just that youll be using them

now in your main shader

convert your pixel coordinate into a coordinate from min_x to max_x and same for y

float x = mix(x_min, x_max, fragTexCoord.x);
float y = mix(y_min, y_max, fragTexCoord.y);
vec2 c = vec2(x, y);

that is your value of c

z starts at 0, as defined by the formula

now perform the iterative process the number of times you specified

vec2 z = vec2(0.0, 0.0);

int i = 0;
for (; i < max_iter; ++i) {
    // z = (|Re(z)| + |Im(z)|i)^2 + c
    z = vec2(abs(z.x), abs(z.y));
    z = cplx_mul(z, z) + c;
    
    // if the distance from the center is more than a circle with radius 1, then it diverges
    if (cplx_abs(z) > 2.0) break;
}

now, color this pixel however you like

i chose to shade it smoothly but im sure you can figure out how to color it

if not, i did it like this

float t = float(i) / float(max_iter);
t = sqrt(t);
t = smoothstep(0.0, 1.0, t);
t = 1 - t;

float k = t * 4.0;
int l = int(floor(k));
int m = min(l + 1, 4);
float f = fract(k);

vec3 col = mix(colors[l], colors[m], f);
finalColor = vec4(col, 1.0);

where colors is passed from the cpu

deep mulch
#

LONG

#

okay

#

i will try

valid jetty
#

and then after, define in compose some way to change min_x, min_y, max_x, max_y using the mouse

#

this is how i do it in raylib you can use it as reference

deep mulch
#

funny thing i could theroetically run this in a discord bot

#

user sends it compose code and it returns rendered image

valid jetty
#

lmao horror

deep mulch
#

jetbrains should hire me

winged mantle
#

horror

#

how did the typescript language server just disappear

deep mulch
#

sorry

humble stream
winged mantle
#

i guess people use vscode because it just works

valid jetty
#

its very similar to the other fractals i made

deep mulch
#

Try catch is not supported around composable function invocations. guh!

winged mantle
#

oh i just deleted the stuff i added to my config and it works

#

also i forgot to install tsx treesitter parser

deep mulch
#

ill just catch exception inside the script

#

oh funny i think i found a compiler bug

deep mulch
#

Caused by: java.lang.RuntimeException: error: 4: symbol 'min' was already defined if i dont catch it i get this error

valid jetty
#

because youll be changing it on the cpu side

deep mulch
#

if i do catch it i get java.lang.Exception: ERROR Unresolved reference 'makeShader'. (script.composable.kts:204:38)

shrewd canopy
#

why husk

deep mulch
#

insane statement

winged mantle
#

should i be worried by the fact that an import call is taking 100ms

#

i'm probably doing too much stuff with global initialisation

#

or idk i guess node.js automatically runs swc for all ts files

#

that might be a bit slow

shrewd canopy
winged mantle
#

comments still showing white in tsx

deep mulch
#

@valid jetty ar the min and max literally just the bounds of the canvas

valid jetty
#

yes

deep mulch
#

meow

#

time to see if this works

valid jetty
#

but theyre on the cpu so you can control them

deep mulch
#

negative min?

#

scary

valid jetty
#

well yes this is the complex plane

#

values range from -i to i and -1 to 1

deep mulch
#

whats the simplest way to color i

#

it

valid jetty
deep mulch
#

funny thing

#

apparently sksl doesnt let me use a non-const in for loops

#

so i have to hardcode max_iter

#

idk if theres a way around

valid jetty
#

lmao thats probably fine

#

you probably wont be changing that during runtime anyway

deep mulch
valid jetty
#

nono afterwards

deep mulch
#

oh

#

okay

valid jetty
#

when all the iterations are done

#

whatever the value of i is

deep mulch
#

is there a reason finalColor is camelCase

valid jetty
#

thats just what glsl expects

deep mulch
#

oh i forgot

#

sksl has you use a return statement

valid jetty
#

typically the

deep mulch
#

i could maybe even return from insie the for loop

valid jetty
#

uhhh yeah probably

deep mulch
#

i think i did something wrong

#
half4 main(vec2 fragCoord) {
    float x = mix(x_min, x_max, fragCoord.x);
    float y = mix(y_max, y_max, fragCoord.y);
    vec2 c = vec2(x, y);
    
    vec2 z = vec2(0.0, 0.0);
    half4 final_color = vec4(1.0, 1.0, 1.0, 1.0);
    for(int i=0; i < max_iter; i++) {
        z = vec2(abs(z.x), abs(z.y));
        z = cplx_mul(z, z) + c;
        
        if (cplx_abs(z) > 2.0) break;
        
        float t = float(i) / float(max_iter);
        vec3 col = vec3(t, t * t, t * 0.5);
        final_color = half4(col, 1.0);
    }
    
    return final_color;
}
#

its solid white

valid jetty
#
half4 main(vec2 fragCoord) {
    float x = mix(x_min, x_max, fragCoord.x);
    float y = mix(y_max, y_max, fragCoord.y);
    vec2 c = vec2(x, y);
    
    vec2 z = vec2(0.0, 0.0);
    half4 final_color = vec4(1.0, 1.0, 1.0, 1.0);
    for(int i=0; i < max_iter; i++) {
        z = vec2(abs(z.x), abs(z.y));
        z = cplx_mul(z, z) + c;
        
        if (cplx_abs(z) > 2.0) {
            float t = float(i) / float(max_iter);
            vec3 col = vec3(t, t * t, t * 0.5);
            final_color = half4(col, 1.0);
            break;
        }
    }
    
    return final_color;
}
deep mulch
#

solid black now

valid jetty
#

suspicious

deep mulch
#

is -2f/2f fine for min/max

valid jetty
#

i think its working youre just looking at the wrong region or something

#

this is what youre supposed to see

deep mulch
#

o

valid jetty
#

can i see the full code

deep mulch
#
BURNING_SHIP(
    shader = """
        uniform float x_min, x_max, y_min, y_max;
        const int max_iter = 256;
        
        // (a + bi)(c + di) = (ac−bd) + (ad+bc)i
        vec2 cplx_mul(vec2 a, vec2 b) {
            return vec2(a.x * b.x - a.y * b.y, a.x * b.y + a.y * b.x);
        }
        
        // |a + bi| = sqrt(a^2 + b^2)
        float cplx_abs(vec2 a) {
            return sqrt(a.x * a.x + a.y * a.y);
        }
        
        vec4 main(vec2 fragCoord) {
            float x = mix(x_min, x_max, fragCoord.x);
            float y = mix(y_max, y_max, fragCoord.y);
            vec2 c = vec2(x, y);
            
            vec2 z = vec2(0.0, 0.0);
            vec4 final_color = vec4(1.0, 1.0, 1.0, 1.0);
            for(int i=0; i < max_iter; i++) {
                z = vec2(abs(z.x), abs(z.y));
                z = cplx_mul(z, z) + c;
                
                if (cplx_abs(z) > 2.0) {
                    float t = float(i) / float(max_iter);
                    vec3 col = vec3(t, t * t, t * 0.5);
                    final_color = vec4(col, 1.0);
                    break;
                }
            }
            
            return final_color;
        }
    """.trimIndent()
) {
    var minX = -2f
    var minY = 2f
    var maxX = -2f
    var maxY = 2f

    override fun buildBuffer(): ByteBuffer {
        return ByteBuffer
            .allocate(16)
            .order(ByteOrder.LITTLE_ENDIAN)
            .putFloat(minX)
            .putFloat(minY)
            .putFloat(maxX)
            .putFloat(maxY)
            .rewind()
    }
};
#

eventually i wanna store the shader code in a seperate file

valid jetty
#

these values are wrong

#

should be -2, -2, 2, 2

deep mulch
#

blame copilot for that

#

i should disable

deep mulch
#

oh

#

yea

#

i confused my own var order

valid jetty
#

lmao

deep mulch
#

and i pass it in the wrong order too

valid jetty
#

lmao horror

deep mulch
#

hmmstill black

#

unless that single pixel is something

#
BURNING_SHIP(
    shader = """
        uniform float x_min, y_min, x_max, y_max;
        const int max_iter = 256;
        
        // (a + bi)(c + di) = (ac−bd) + (ad+bc)i
        vec2 cplx_mul(vec2 a, vec2 b) {
            return vec2(a.x * b.x - a.y * b.y, a.x * b.y + a.y * b.x);
        }
        
        // |a + bi| = sqrt(a^2 + b^2)
        float cplx_abs(vec2 a) {
            return sqrt(a.x * a.x + a.y * a.y);
        }
        
        vec4 main(vec2 fragCoord) {
            float x = mix(x_min, x_max, fragCoord.x);
            float y = mix(y_min, y_max, fragCoord.y);
            vec2 c = vec2(x, y);
            
            vec2 z = vec2(0.0, 0.0);
            vec4 final_color = vec4(1.0, 1.0, 1.0, 1.0);
            for(int i=0; i < max_iter; i++) {
                z = vec2(abs(z.x), abs(z.y));
                z = cplx_mul(z, z) + c;
                
                if (cplx_abs(z) > 2.0) {
                    float t = float(i) / float(max_iter);
                    vec3 col = vec3(t, t * t, t * 0.5);
                    final_color = vec4(col, 1.0);
                    break;
                }
            }
            
            return final_color;
        }
    """.trimIndent()
) {
    var minX = -3.5f
    var minY = -3.5f
    var maxX = 2.5f
    var maxY = 2.5f

    override fun buildBuffer(): ByteBuffer {
        return ByteBuffer
            .allocate(16)
            .order(ByteOrder.LITTLE_ENDIAN)
            .putFloat(minX)
            .putFloat(minY)
            .putFloat(maxX)
            .putFloat(maxY)
            .rewind()
    }
};
#

tried changing min/maxs

valid jetty
#

i have a feeling this is something to do with the difference between fragCoord in sksl and fragTexCoord in glsl

deep mulch
#

maybe

#

hm

#

ill try something

valid jetty
#

i think im right

#

try this

float x = mix(x_min, x_max, fragCoord.x / iResolution.x);
float y = mix(y_min, y_max, fragCoord.y / iResolution.y);
deep mulch
#

you are i think too

#

yea

#

i need to pass in the resolution

#

yippee

#

@valid jetty

valid jetty
#

yayyyyyy

deep mulch
#

how make it pretty now

valid jetty
#

now find a way to shade it properly

deep mulch
#

yop

valid jetty
#

i do this

float t = float(i) / float(max_iter);
t = sqrt(t);
t = smoothstep(0.0, 1.0, t);
t = 1 - t;

float k = t * 4.0;
int l = int(floor(k));
int m = min(l + 1, 4);
float f = fract(k);

vec3 col = mix(colors[l], colors[m], f);
finalColor = vec4(col, 1.0);
``` where ```glsl
uniform vec3 colors[5];
``` and
```rs
colors := [
    Vector3::new(0.0, 0.0, 0.0),
    Vector3::new(0.835, 0.176, 0.0),
    Vector3::new(0.937, 0.463, 0.153),
    Vector3::new(1.0, 1.0, 1.0),
    Vector3::new(0.639, 0.0078, 0.384)
];

for i in 0..colors.len() {
    loc := rl::get_shader_location(shader, "colors[{}]".format(i));
    rl::set_shader_value(shader, loc, &colors[i].x, ShaderUniformDataType::SHADER_UNIFORM_VEC3);
}
deep mulch
#

is colors a gradient?

valid jetty
#

nop

#

well

deep mulch
#

o

valid jetty
#

its not really

deep mulch
#

how doesi t owkr

valid jetty
#

its the lesbian flag lol

#

you can just mess around with the colors

#

wait actually

#

i dont think this one is the lesbian flag

deep mulch
#

grunka grunka

#

i need to add hot reloading

#

to my code

valid jetty
#

its these colors

#

as well as black and white

deep mulch
#

@valid jetty you should run my compose-scripts project on your pc

valid jetty
#

maybe,,

valid jetty
deep mulch
#

its not very practical but its so cool

#

burning ship

valid jetty
#

better

#

if you add controls you should go explore this area

deep mulch
#

love

valid jetty
#

on the left

deep mulch
#

bright

valid jetty
#

then i interpolate and thats the color

deep mulch
#

o

#

neat

valid jetty
#

its colored based on how many iterations it takes to escape

#

thats why i invert it

deep mulch
#

@valid jetty how many iterations do you use

valid jetty
#

300

deep mulch
#

low iterations look funny

deep mulch
#

@valid jetty got something that isnt painful to look at

valid jetty
#

yayyy

#

now make interactive

deep mulch
#

soon

#

how zoom

valid jetty
# deep mulch how zoom
mouse := rl::get_mouse_position();
m := Vector2::new(
    x_min + mouse.x * (x_max - x_min) / SCREEN_WIDTH,
    y_max - mouse.y * (y_max - y_min) / SCREEN_HEIGHT
);

wheel := rl::get_mouse_wheel_move();
if wheel != 0 {
    scale := wheel > 0 ? 0.95 : 1.05;
    x_min = m.x + (x_min - m.x) * scale;
    x_max = m.x + (x_max - m.x) * scale;
    y_min = m.y + (y_min - m.y) * scale;
    y_max = m.y + (y_max - m.y) * scale;
}
deep mulch
#

oh

#

thats simpler than i tohught

#

theres a slight problem i need to figure out

limpid mica
#

it's just an affine transform smh

deep mulch
#

its following the window scale, so it gets stretched if the window is wide

deep mulch
valid jetty
#

thats to be expected no?

#

thats why my window is square

deep mulch
#

i dont like that

limpid mica
#

my name rini

deep mulch
#

zoom works

#

need to add offsets now

limpid mica
#

hi p

deep mulch
#

@limpid mica hiiiii

#

the lily

#

@young flicker hats me

valid jetty
# deep mulch need to add offsets now
if rl::is_mouse_button_down(MouseButton::MOUSE_LEFT_BUTTON) {
    dx := rl::get_mouse_delta().x * (x_max - x_min) / SCREEN_WIDTH;
    dy := rl::get_mouse_delta().y * (y_max - y_min) / SCREEN_HEIGHT;

    x_min -= dx;
    x_max -= dx;
    y_min -= dy;
    y_max -= dy;
}
deep mulch
#

i was gonna do that @valid jetty

valid jetty
#

sowee

deep mulch
#

evil roie

valid jetty
#

@deep mulch

#

@deep mulch

#

@deep mulch

deep mulch
#

zoom and offset working kinda @valid jetty you love

#

lumina

valid jetty
#

yayyyyy

deep mulch
#

you are lumina

valid jetty
#

you love

#

lumina

#

lumina

#

lumina

#

lumina

#

lumina

#

..

#

@young flicker can you react wwith lumina so i dont seem insane

deep mulch
#

as i zoom in it amplifies the existing offset which i need to fix

valid jetty
#

offset

deep mulch
#

offset

valid jetty
#

spam offset

#

get paige's account locked

deep mulch
#

offset

#

offset

#

offset

#

offset

#

offset

#

offset

#

offset

#

offset

#

offset

#

offset

#

offset

#

offset

#

offset

#

offset

#

offset

#

offset

#

offset

#

offset

#

offset

#

offset

#

offset

#

offset

#

offset

#

noo dont do that

valid jetty
#

yeah but thats mean

#

turn it back on

#

thank you

#

@deep mulch now for the fun part

#

comment out this line and look at the result

#

leave everything else as-is

nimble bone
#

offset

deep mulch
#

how it do that

valid jetty
#

magic

#

mandelbrot is defined as f(z) = z^2 + c

burning ship is just that but you take the absolute value of the components of z first before you square

deep mulch
#

did you hear something @valid jetty

#

thought i heard something

valid jetty
#

yeah

deep mulch
#

how

#

Tuahmisu!

cinder egret
#

@young flicker block zt

#

true

valid jetty
#

true

cinder egret
#

@valid jetty

valid jetty
#

@cinder egret

cinder egret
#

@valid jetty send that essay in my dms aha

deep mulch
#

i need to fix the zoomm

valid jetty
#

@valid jetty send that essay in my dms aha

#

oh

deep mulch
#

i zoom in then dragging the mouse moves it so much

valid jetty
#

@cinder egret send that essay in my dms aha

cinder egret
#

dm me

#

do it no balls

#

do it or you have balls

deep mulch
#

@young flicker

#

didnt ask @young flicker

cinder egret
deep mulch
#

didnt ask @cinder egret

valid jetty
#

I have literally so many Apple products made by Apple

cinder egret
deep mulch
#

CREEP

valid jetty
#

hiiiii

deep mulch
#

CREEPLORIST

#

@valid jetty how do you handle the drag properly

valid jetty
cinder egret
#

drag deez LOL

#

@deep mulch

deep mulch
#

the cursor should stay in place

#

over the ship

valid jetty
#

how are you calculating mouse delta

deep mulch
#

its just given to me

#

change.x change.y

#

husk if you love me

#

@young flicker

valid jetty
#

well then clearly whats given to you is wrong or youre using it wrong

deep mulch
#

well obviously

#

im doing something wrong

valid jetty
#
dx := rl::get_mouse_delta().x * (x_max - x_min) / SCREEN_WIDTH;
dy := rl::get_mouse_delta().y * (y_max - y_min) / SCREEN_HEIGHT;

x_min -= dx;
x_max -= dx;
y_min -= dy;
y_max -= dy;
``` idk
valid jetty
deep mulch
#

i only have offsetX and offsetY variables that define the cetner coord

#

i think

#
detectDragGestures { change, dragAmount ->
    change.consume()
    val dragDeltaX = dragAmount.x / zoom
    val dragDeltaY = dragAmount.y / zoom

    offsetX += dragDeltaX
    offsetY += dragDeltaY
}
valid jetty
#

you shouldnt be tracking zoom but instead scaling your min and max by the appropriate zoom

#

and then your drag deltas should be the same no matter what the zoom is

deep mulch
#

wouldnt minX always equal -maxX

#

oh

#

yea that works

#

close up of the ship

valid jetty
#

yayyyyy

#

awesome

deep mulch
#

i get this insane error I havent figured out with my scripts

#

Caused by: java.lang.ClassCastException: class Script_composable$Shader$BURNING_SHIP cannot be cast to class Script_composable$Shader (Script_composable$Shader$BURNING_SHIP is in unnamed module of loader org.jetbrains.kotlin.scripting.compiler.plugin.impl.CompiledScriptClassLoader @73f717da; Script_composable$Shader is in unnamed module of loader org.jetbrains.kotlin.scripting.compiler.plugin.impl.CompiledScriptClassLoader @459048ea)
@valid jetty

valid jetty
#

here is my elle render

deep mulch
#

make it 144 fps

#

@valid jetty what if you animated some property of it

valid jetty
#

chaos

#

i do wonder what happens if you change the starting position

deep mulch
#

are the min/max complex plane stuff

valid jetty
#

changing the start position z_0

deep mulch
#

roieeee 😭

valid jetty
#

btw i tried controlling the value of c earlier and it resulted in just solid colors and was useless

#

hmm what else can i control

#

ooooooo

#

the exponent

deep mulch
#

its so weird zooming into one of these

#

since it repeats

valid jetty
#

lol yeah

deep mulch
#

@valid jetty how far can you zoom in

valid jetty
#

as far as the precision of a 32 bit float will take you

#

lol

deep mulch
#

funny colors

#

i tried 16384 iterations its very laggy as expected

valid jetty
#

weirdly enough as you increase the number of iterations the eiffel towers start to fade out

deep mulch
#

yop

#

it gets all stretched if i keep zooming too far

valid jetty
#

yeah thats the 32 bit float exploding

deep mulch
#

is 64 bit possible

valid jetty
deep mulch
#

it would have to render on cpu wouldnt it

valid jetty
#

actually apparently you can use doubles

#

husk

#

ok well

deep mulch
#

do

valid jetty
deep mulch
#

what value is changing there

valid jetty
#

starting position

#

z_0

deep mulch
#

i dont have a z_0

valid jetty
#

you do

#

this is set to vec2(0) for you

deep mulch
#

oh

#

just say z

valid jetty
#

husk

#

im going to sleepm,,

deep mulch
#

niniii thank you for helping

sweet pebble
#

@solemn rock @wanton osprey @royal nymph
I love ur loading quotes plugin but can i customize the quotes?

#

i know i can if i custom download into documents type thing for custom plugins, but cant otherwise?

royal nymph
#

did you really have to ping 3 people for this basic ass question

#

dumbass

sweet pebble
#

damn bro my fault

royal nymph
#

rules 9, 10 and 12

winged mantle
#

should i just switch from solid because i'm too noob

#

is that a good reason

#

reactivity seems to be lost across For each boundary

#

wait no... across component boundary

#

oh i'm dunmb

#

there are so many things you need to wrap in closures

stark timber
#

hi

stark timber
winged mantle
#

idk idk all frameworks are kind of magic

stark timber
winged mantle
#

i just used vanilla js for years

stark timber
#

and then

winged mantle
#

well ok

#

i think i might have used jquery a bit

#

then solid when i actually needed a... solid web application

#

as doing in vanilla js seemed too hard

stark timber
#

alright

#

well idk u could try react it’s pretty simple and the most popular

#

or svelte is good too

winged mantle
#

i think i mainly chose solid because of smaller bundle size

#

also global state seems easier

#

you can just have a global signal lol

#

i did manage to figure out my issue

crude star
#

didn't react get a whole lot smaller recently

stark timber
winged mantle
#

you can just create a global variable

#

so convenient

stark timber
#

you mean this stuff?

#

vue is kinda like that in the same way and it’s easy af

#

vue was my first framework

#

it’s good but annoying for big projects

winged mantle
#

the main thing i keep running into is instead of this

let name;
if (props.game === "undertale")
    name = "Toby Fox";
else if (props.game === "deltarune")
    name = "Foby Tox";
else
    name = "unknown";
return <div>{name}</div>

you need to do this

const name = () => {
    if (props.game === "undertale")
        return "Toby Fox";
    else if (props.game === "deltarune")
        return "Foby Tox";
    else
        return "unknown";
};
return <div>{name()}</div>;

and i don't really understand... why... it's hard to find resources explaining things

#

with the former it won't properly react to property changes

#

i guess it does make sense sort of because fine grained reactivity

#

but i feel like i don't really understand what's hapenning still

#

then again i guess most react developers probably don't learn what's going on under the hood and it also has confusing quirks

stark timber
#

idk seems like that means the component isn’t rerendered when the props change

#

at least not in a way I’m familiar with

winged mantle
#

i think solid probably relies on a lot of compiler magic

#

doesn't react have a compiler but its optional

royal nymph
winged mantle
#

i think the main issue is unlike react where it tells you when you break the rules solid doesn't

crude star
#

the components function only ever runs once

royal nymph
royal nymph
#

or smth like zustand

crude star
#

but <>{this}</> creates a rendering scope

#

so that part in {} basically gets turned into a function

#

that's what the solidjs magic is

hoary sluice
stark timber
ionic lake
ionic lake
winged mantle
#

projects i return to after not touching for months my beloved

solemn rock
#

I remember writing this feature.

deep mulch
#

@valid jetty I made a Julia fractal last night

#

I was trying to get variables passed in but didn't finish

#

theoretically it's possible to make my script project run in the browser

spark tiger
deep mulch
#

it's raylib I think

deep mulch
spark tiger
#

oh

deep mulch
#

faints per second

spark tiger
valid jetty
#

everywhere there is a ship, there is a corresponding mini mandelbrot bulb

lucid trail
valid jetty
#

yeah its awesme

jade stone
young basalt
#

im pro skidder

#

tuff right

spark tiger
young basalt
spark tiger
#

how do i make game loop run at like consistent rate. do i like do sleep or

while (1) {
  float delta = curTime - lastTime;
  if (delta < UPDATE_RATE)
    continue;
  update();
}
spark tiger
#

fuhh off gng

spark tiger
#

what about nanosleep or same thing

valid jetty
spark tiger
#

or what’s it called

valid jetty
#

specifically this bit

#

raylib's wait function uses nanosleep yea

spark tiger
#

oh

crude star
#

nanosleep is fine

spark tiger
#

ic ty

#

though it seems like there isn’t nanosleep on windows

lucid trail
#

seems good

spark tiger
nimble bone
#

im pro skidder

#

tuff right

spark tiger
lucid trail
spark tiger