#dev-general
1 messages Β· Page 506 of 1
then insane humans use Kotlin, IntelliJ and don't need nullability annotations π
pfffft intellij
pffft 'features'
stfu vim user
well ive converted to sublime text
average vim fan vs average IntelliJ enjoyer
after converting to emacs
it's worth mentioning at this point that haskell does optionals SO MUCH better
ive done the reverse power user
pattern matching makes maybe monad a work of art
I hope they find a nice way to bring pattern matching with optional too
They'd better
Pattern matching sealed classes π€€
Because pattern matching is epic
isn't Java's pattern matching basically ported when?
Haskell 
Probably my favorite Haskell feature
No, when is poor manβs pattern matching
I'd argue when technically isn't pattern matching
There's only one pattern you can match
show me the difference
wat
the only thing when can match is booleans
not true...?
Pretty much true
when can match anything

It takes the first branch that evaluates to true
mhm
ah
Proper pattern matching is about matching the structure of objects
Deconstructed is probably the only true pattern matching in Kotlin
you mean destructuring?
right back at pc now
i.e. when is just a bunch of chained if else's π
yeah
case someFunctionThatReturnsAMaybe of
Just value -> putStrLn value
Nothing -> putStrLn "Function did not return a value"
this is a pretty basic example
that literally looks like a when
when using when if less than 3 members (if I'm not mistaken here), it's compiled to if else, otherwise it is compiled to a switch statement
but i'd like to see when do that, in it's current state
the closest you could get is smart casting
when (val res = someFunction()) {
is Just -> println(res.value)
is Nothing -> println("no value")
more noise, and an extra variable
what else
you can pattern match lists too
smart casting was a fault, change my mind
@prisma wave arrow-kt β€οΈ ```KT
val someValue: Option<Double> = Some(20.0)
val value = when(someValue) {
is Some -> someValue.value
is None -> 0.0
}```
that actually looks kinda nice ngl
not bad
the arrow one
although still noisier
close enough
anyone into MERNING
wat
you can also use fold to pattern matching KT Some(3).fold({ 1 }, { it * 3 })
I mean the Maybe monad is basically the easiest, but Haskell allows way more pattern matching
It also cant do further constructor matching
was that for me, or....
yeah maybe monad is just scraping the surface
why is the initial there a function?
Even assignment is pattern matching in erlang
it should be fold(1) { acc, it -> acc += (it * 3) }
reverse l = case l of
[] -> [] -- reverse of empty list is empty list
[a] -> [a] -- reverse of single element is single element
(a:xs) = reverse xs ++ a -- head:tail turns into reverse(tail):head
list pattern matching in haskell
yeah ik guards
I prefer multiple function declarations over case of
{message, Value, Id, {to, Uid}} = MyMsg
This would match MyMsg against the left structure and assign variables as they match,
So it would capture, Value, Id and Uid
what do you mean with initial there?
This also matches objects in them tho
you put { 1 }, which is a function secretx
yeah
Destructuring cannot really match
yes
why don't they use the normal Kotlin fold style?
it's a default value in case the Option is None
This itself matches 2 atoms
ah
because the idea behind functional programming is laziness, all values must only be computed if needed, hence why 1 is a lambda (lazy supplier)
there's a lot of extension functions to work with nullables etc
maybe Krypton should use arrow and become more functional
structuring things functionally is hard
ErLang also does the "No Errors at Runtime" very differently even tho its functional
without experience
I'd rather use Arrow than switch to Haskell lol
obviously
Its way is to simply crash the process if any slight thing goes wrong
lmao
And spin the process back up
Yup
Its built to crash
Quite literally
But the entire application continues
ErLang processes are lightweight
that's like haskell's do notation, quite nice
what happens if i do ```kt
@Nullable
fun test(): String {
return Some.COOL
}``````java
public class Some {
@NotNull
public static String COOL = null;
}
thinking about Haskell, can someone teach me Haskell lol
yes
@jovial warren https://arrow-kt.io/docs/apidocs/arrow-core/arrow.core look at all those monoids
Yes!!
if I can get this stupid piece of shit IJ plugin to work
import Data.Char
llIlIlIIlIllIll :: String -> IO ()
llIlIlIIlIllIll llIIllIIIlIIllI = putStrLn $ lIlIlllIlIlIlll llIIllIIIlIIllI
main = do {
lIlIIIlIIlIIIlI;
}
lIlIIIlIIlIIIlI :: IO ()
lIlIIIlIIlIIIlI = do
llIlIlIIlIllIll . lIIIlllIIIIlIll $ llllIlllIlIIlll lIlIllIllIlIIll
lIlIllIllIlIIll :: [String]
lIlIllIllIlIIll = lIlIlllIIIlllll "ghi" (-6)
lIIIlllIIIIlIll :: [String] -> String
lIIIlllIIIIlIll = head . tail
lIlIIlIlIIIIIlI :: [String] -> [String]
lIlIIlIlIIIIIlI lIIlIllllIIllll = filter (lIIllIIllIIlIll) lIIlIllllIIllll
lIlIlllIlIlIlll :: String -> String
lIlIlllIlIlIlll lIlIIIlIIIIIIII = filter (llllllIlllIIIII) lIlIIIlIIIIIIII
llllllIlllIIIII :: Char -> Bool
llllllIlllIIIII lIIlIIIlllIIlll = lIIlIIIlllIIlll /= '\''
llllIlllIlIIlll :: [String] -> [String]
llllIlllIlIIlll llIlllllIIlIIIl = lIlIIlIlIIIIIlI $ fmap (\lIIlllIlIIllIll -> lIIlllIlIIllIll) llIlllllIIlIIIl
lIIllIIllIIlIll :: String -> Bool
lIIllIIllIIlIll _ = True
lIlIlllIIIlllll :: String -> Int -> [String]
lIlIlllIIIlllll lIlIIlllllIIlIl llIllIlIIllllIl = (\llIlllIIIlIIlIl -> show $ chr $ ord llIlllIIIlIIlIl + llIllIlIIllllIl) <$> lIlIIlllllIIlIl
```easy smh
Dont use that
do
a <- Just 1
b <- Just (1 + a)
c <- Just (1 + b)
return $ a + b + c
``` π
emacs π
this guy gets it
oh yes, I've already got the Haskell plugin in VSC
imacs
just gotta find out how to run it lol
VSC is complaining about GHC not being installed
Use stack run to run if you're using stack
which is BS, since it is fucking installed
bardy just git good
Make sure its in your PATH maybe
just git good
also, stack run gave me No executables found.
do I need to compile it first or something?
Oh god Bardy trying Haskell?
apparently ghc actually doesn't exist 
smh
anyway, lemme build this
you're next
D:
Error parsing targets: The project contains no local packages (packages not marked with 'extra-dep')
AAAAAAA
You dont see ghc installed globally if you're using stack, it should install a local version
Did you create the stack project normally?
theres also stack setup
ah
no correlation found
Arrow-KT Option is like Optional, except that it doesn't suck
what does this error parsing targets mean
It says you dont have any packages added
You need atleast base
Stack setup should do that for you
it worked
π
π
right, where do you tell this thing which file the entry point is?
You dont need to
BARDY
all I get is someFunc
thats the stack default thing
module Main where
main :: IO ()
putStrLn "Hello World!"
main = undefined
```probably borked code
very much so
what's wrong with it?
uhhhhhh π₯Ά
that hello world cant go there
where does it go?
main = putStrLn "hello world"
Wrong directorybard
and yeah
Look under app
app is where your entrypoint and impure stuff usually goes, the rest in lib
oh
src contains your main "logic"
oh src*
module Lib
( helloWorld
) where
helloWorld :: IO ()
helloWorld = putStrLn "Hello World!"
```more borked code?
lol
easy stuff
that looks fine
right, introduce me to some core concepts and some... questionable syntax choices
everything is a lazy function
every function is a single expression
everything is pure
everything is an expression
Functions can be partially applied
π€€
π
currying is epic
curry is epic
Haskell Curry is Epic
add :: Int -> Int -> Int -- function signature
add x y = x + y
add3 :: Int -> Int
add3 = add 3
main :: IO ()
main = print (add3 5)
all functions are single parameters
i.e a mathematical function, 1-to-1 mapping
well not necessarily 1to1
but
print $ add3 5 π
still
You can actually define custom operators with custom precedence as well. Oh and operators can be partially applied as well
putStrLn $ show $ add3 5 π π
^^ because operators are just functions
π
You can also apply any function in infix form by using them in the infix spot with ` on either sides
i think hes stopped listening
Lol
Uh how does the first one work lmao
Lol
`div`
CURRYING
π€£
because all functions only have 1 parameter, functions with more just return functions
add :: Int -> Int -> Int -- function signature
add x y = x + y
```?
add takes an Int and returns an Int -> Int
x y = parameters
you can also write something like map (+2) [1..]
π
π€’ (+2) <$> [1..] ftw
idkwhatthatisbutthatseemscool π
Okay I think I get it
oh
Hmmm
in java terms it's ```java
Function<Integer, Function<Integer, Integer>> add = x -> y -> x + y;
lmao imagine needing types
i didn't do that right
function x y = x + y
Yeah yeah the Int -> Int -> Int kinda shows
lol
That's cool and it makes sense cause lazy
yes precisely
and like the others have said, it has some nice side effects
map (+2) [1..5] = [3, 4, 5, 6, 7]
because + is curried
really immature dkim
<$> π
yeah yeah you dont need to tell me
function = (+)
π
π π π
Thoughts? 
Looks great!
@prisma wave Scala > Kotlin
I looked at scala and kotlin is like a copy
kotlin doesn't have TRAITS though
π
A blog post titled "Why Scala wins against Kotlin" on a website called Scalac.io, is definitely not going to have any bias π
Scala is pretty great
Pretty high pay as well
mhm
Lol
absolutely not
I just read 2 blog posts and I still think Kotlin is superior
can i preserve comments in my yml file if i change something and save it?
probably not with snakeyaml
yeah gl with that
what happened to haskell smh
use configurate maybe?
lol
#dev-general message π
Haskell will likely never be my favourite language
we'll see about that
wus dat
thinking about Sponge, I wonder what else I should steal from Sponge π€
the way Sponge gets around messy static abuse is even more hacky lol
it uses factories and a factory provider to provide those factory instances from the backend
Do like forge, embrace the static abuse π€‘
Everything is done with a singleton
any idea where that singleton is?
Check any mod or mod tutorial and you'll see
I am talking about the mod creation part, i have no idea about the internal forge code
FMLModLoadingContext?
why is my obs quality so bad i have the file size set to indistingushable and video bitrate at 5000 kbps its recording format is mp4 and the encoder is hardware (amd)
So is there something with Kotlin 1.5.x, Gradle + Shadow 7 causing an issue with setting the archived file name from shadow? On Gradle 7.0.2 and Shadow 7, works fine when on Kotlin 1.4.32, but when I go to Kotlin 1.5.10, the output file jar is not keeping capitalization set. Looks like it's pulling the name from the settings.gradle file?
That seems to only happen when the output name is specifically projectname-version.jar
adding a v behind the version seems to work
archiveClassifier.set("")
archiveBaseName.set("Guilds")
archiveVersion.set("v${project.version}")
Normally I set something like archiveFileName.set("Project-${project.version}.jar") on shadow to get the name the way i like
Works fine on 7
That seems to get overwritten
when I tried with this, it generated both this and the lowercased one
oh wait setting archivesBaseName to the capitalized name seems to fix it
outside shadowJar
@onyx loom have you tried yet?
im in bed π
Excuses excuses
π
Dev den
k banned
Lmao
wait, u havent heard of the spigot build tool?
Is it better than Ant?
anything is better than ant
can i join

Oh no
Yo any1 wanna review some code?
Bet
A wrapper library for vanis.io written in Java. Contribute to Conclure/VanisJava development by creating an account on GitHub.
?
you commited your .idea folder
π€‘
Uh well the Map#copyOf doesnβt take a map with null key
Hm
Don't you log it or anything?
Oh no my ocd doesn't like this bit of code
It's not in alphabetical order :(
Dude that triggers me so much idk why
I question if I have ocd sometimes
I have a suggestion
In GameServer you have maximum players, but no minimum players?
Nope
Don't you want that?
Not my game
Oh is it for someone else?
Um, we're gonna need to have words.
You need your commit messages to explain what you did...
Also, why such big commits??? Please do them in smaller commits and push them all.
It takes 2 seconds to do that.
No it doesnβt
It does.
More like 20 min
No, it takes like 2 seconds to commit each thing
Yes too much time
I can't remove embed soz
Not reading that
Read it.
No
TL;DR
Revert a commit with ease if something goes wrong. Big commits are harder to revert
Small commits are easier to understand when reviewing a pull request.
Conc, you can do them finally if you wish to as well
Just add selectives files for commits
and describe what you changed in those
Yugi, what is better? A bunch of smaller commits with one push of smaller code or one big push with all code
he isnt working on a team
that isnt really a valid point lol
hes working alone
so nobody would care anyways
It's still good habit to do smaller commits.
Idc if there's 1 person or 300. Smaller commits are better than larger.
No
Because it's a good habit to get into. Once you start doing it the correct way (smaller commits) then you'll notice a improvement of source control.
Smaller commits
Also yea
calm down
Thank you yugi, someone else who understands the correct way to do it.
You did the same thing like 3 days ago
Large commits?
I think conclure got the point
Frank, it's really not a big deal. There is much better advice which can be given...
Yugi, I have changed though.
also, it's literally his second commit
you want him to commit like 20 times for like the first or seocnd commit?
Hell no
Sorry, its just drilled into my brain on how to do it.
makes no sense at all
Sure, but no need to continuously rant on about it. You already told him once
Sorry.
All good
Idk how to explain, but it's drilled into my brain on doing small commits so for some reason I feel the need to get everyone else to do it.
because in reality if you are working alone nobody is going to give a shit anyways. Plus, you should already be writing recyclable code that would be easy to implement additions/deletions in the future..
I feel like I should shut up.
Also, branches exist too
I am worried that I'm going to let loose again. I didn't mean to go on a rant like that. I'm so sorry.
Btw I have committed over 300 files in one commit once
πΆ
How does Sponge handle the whole load, enable, disable stuff?
Is it similar?
Ah found it, similar enough
Looking nice so far
Groovy has something similar yeah
now that i think about it, the config() access is kinda redundant 
I'd really like to fully learn kotlin sometime, so many parts of it make it seem like an ideal language
but ever since using the gradle kotlin dsl, the whole lambda syntax thingy has reeeally confused me
it's a wee bit scary at first sight, lol
no kidding, just google Kotlin Docs and start from there, if you know Java it will be easy peasy, I'm saying this because that's exactly what I've done
Anyone watch the UE5 showcase yesterday? Really exciting what all they have to offer soon. It also looks amazing in-game.
dang what game is that?
It's the demo project that you can get with UE5.
Only around 200GB in size and took a solid hour to compile for the first time.
wow, it looks kinda amazing though
It really does. Especially if your graphics card supports their new Nanite rendering.
was it unreal or unity that started adding DLSS support?
huh, cause that seems like the biggest improvement in performance for the next few years
But with UE5 you can now drag things from the Marketplace directly into the world you're working on.
https://youtu.be/QQTqXekfAy4?t=91 those feet really make the game creepy as shit
I've given it a look over and kinda started the tutorials a bit but haven't actually given it a proper bit of time. I'll get around to do it eventually ;p
why use kotlin when you could use
Hmmm

π
lol
Man spigot discord hates on gradle as usualπ
lol
man, the new sealed interfaces are pog
I'm using them in the new Krypton command system I'm designing (which I totally didn't at all completely steal from Velocity)
there's going to be 3 types of commands:
- Brigadier command, which wraps a Brigadier
LiteralCommandNode - Legacy command, which is modelled after BungeeCord's command
- Raw command, which is useful for "bolting on" external command frameworks
raw command gives you the arguments as a single string, without any processing
legacy command gives you them as an array of strings (I'm using an array since most cross-platform plugins seem to use an array, and having to convert to a list is expensive)
I wonder if I should keep the legacy command as an abstract class that takes parameters though or make it an interface
probably the former tbh, since I find that easier to work with
lol
i mean what's the alternative
71MiB of ram free apparently
see if your school or a nearby university has a surplus
they sold like, 50 2015ish macs for like $20 a pop at my uni a bit ago
oop
^
any nearby universities? they usually have some good stuff
in fact, my uni actually has a program for CS majors to get free laptops forever

if you complete the first two coding classes, and stay as a CS Major and don't drop out, you get a free laptop
and if you graduate you get to keep it, it's very cool
That's neat
yea!
probably like 90%
do a week trip
8 hour flight + ferry + train to london
hotels around here are very cheap cause everyone is gone for the summer
ferry haha
lmao i was to lazy to figure out how to make an infinate loop, so i just made a while (0 == 0) {
that works too
is there a permanant loop in java or am i actually supposed to do it like this
while (true) is the permanent loop
alright
yeah i'll change it to that so intellij stops screaming at me that its always true
if (actionDone == "viewXp") {System.out.println("XP: " + xp + "/" + xpUntilNextLevel + " Level:" + level);}```
does anyone know why this just does nothing when i type viewXp?
dont use == to compare strings
oh right
its .equals
i completly forgot about that lol
thanks for reminding me
yo what was the thing called that i could use to host an sql server locally for testing purposes called? Deleted a ton of my files and forgot what it was called lol
there was smthn i used to use but ig if i can do it without that thatll work too
you can use MySQL Workbench to send commands prettily
and that works with MariaDB
or if you have IJ Ultimate, you can access the SQL from IJ itself
yeah i do
XAMPP iirc
ah yes
you don't need XAMPP if you just want the SQL
you can just download MariaDB right from their website
or package manager it if you're on not-windows
how can i put a bunch of text in a file/class, then access the file/class in a my main method? since i don't wanna have 300 println's like i did in my last project
uh, example text?
what do you mean?
what kind of text are we talking about here
strings
lemme give an example wait
System.out.println("Current Gear:");
System.out.println("Level 3 Sword");
System.out.println("Level 11 Helmet");```
so, what i want to do, is store the text in a file or class
then i can just print that in 1 line in my main method
do you care about what text you send? or do you just want to send all of it in order?
because i don't want 90% of my code to be print's
it would be exact text in exact order
im using it to make GUI's in a console rpg
oh yeah so you can just use a text file, separate it by newlines, and use a scanner to read through it in order
okay, do you know any guides for doing that? im quite new to java
Scanner sc = new Scanner(new File("potato.txt"));
while (sc.hasNextLine()) {
System.out.println(sc.nextLine());
}```
that should do it
actually it should be by lines
uh
Current Gear:
Level 3 Sword
Level 11 Helmet
it just reads them in line order
You can use different delimiters if you really want to, or a file format if you plan on changing the data stored in it
okay
where should i store the project? am i able to store it in like /ProjectName/Texts/file.txt
or will it not be able to reach it from there
are you using gradle/maven?
unless intellij has that enabled by default, no
i've heard those names but i have no clue what they are
oh okay you can just put it in your project directory wherever you want
okay ty
anybody used thsi before?https://github.com/jetbrains/exposed
no but it looks very nice, it has Kotlin and JetBrains involved and that makes me happy
indeed
is there a way to display variables?
uh
this sounds like a problem that would be best solved with OOP
as in, have each item have its own print method that you can just iterate through
yeah it's cool
bardy uses exposed afaik
okay
yeah I do
yes and it is actual god tier
despite what false information BM might try to spread π
π
Although I still think I'd prefer hibernate for something really big
oh btw, anyone wanna see my newly designed command system for Krypton?
I based it off of Velocity's
I've officially deprecated the old Command (renamed to LegacyCommand now) to encourage the use of its (kinda) replacement, BrigadierCommand
BrigadierCommand is a command that's backed by Brigadier's LiteralCommandNode
then the other addition is RawCommand, which is a command that has its arguments supplied as a single string, to allow external frameworks to do their own processing
talk about breaking changes though amirite
what's binary compatibility though? /s
fun main() = runBlocking { // this: CoroutineScope
launch { // launch a new coroutine and continue
delay(1000L) // non-blocking delay for 1 second (default time unit is ms)
println("World!") // print after delay
}
println("Hello") // main coroutine continues while a previous one is delayed
}
```what does runBlocking do? what if i put launch outside of runBlocking?
(also im not on intellij rn so i can't tryandsee)
also, what would be some alternatives to runBlocking?
since i think it creates the coroutine scope?
oh wait so runBlocking just runs, while blocking, but also creates a coroutinescope
so i'd assume theres something similar to runAsync {}?
runBlocking blocks
Inside a coroutine context you have async which exists for parrallel computation
Running in a scope / dispatcher
if you run in a scope/dispatcher, it doesn't block?
If you dont want to execute skmething parallely just switch contexts with withContext where needed
hey Yugi
Hi star
remember that typescript thing
the data connector thing i was working on a month ago
Depends on the scope you use, but most are async yeah
yea
Yea?
i uh... need some more help
Sure
join room 1?
fun main() = runBlocking { // this: CoroutineScope
launch { doWorld() }
println("Hello")
}
// this is your first suspending function
suspend fun doWorld() {
delay(1000L)
println("World!")
}
```what exactly does the launch {} do? run async?
In like 5 minute, not at pc rn
ah no problem, thanks in advance
new coroutine
Because you're using runBlocking there's no benefit from using launch afaik
Unless you change contexts in doWorld

fun main() = runBlocking { // this: CoroutineScope
launch { doWorld() }
println("Hello")
}
// this is your first suspending function
fun doWorld() {
delay(1000L)
println("World!")
}
```if i removed the `suspend`, would it print ```
World!
Hello
```?
it wouldn't compile
o
because delay is suspending
ah
fun main() = runBlocking { // this: CoroutineScope
launch { doWorld() }
println("Hello")
}
// this is your first suspending function
fun doWorld() {
println("World!")
}
```would it print ```
World!
Hello
```?
ima be honest I think the coroutine library is really overcomplicated and hard to learn, so im not super familiar with how it works
not necessarily
bardy's here!!!
you call launch, which launches a new coroutine
launch launches in the same context as a child
so that's gonna cause a race condition to see who can print the fastest
No bard
it's not a race condition if both are blocking
actually that is a good point
OH
launch isn't blocking though, is it?
There isnt a race condition here afaik
im barely understanding what yugi's saying 
The oarent waits for the child
it launches in the runBlocking scope so yes, it is
The issue exists mostly for globalscopes
yugi u have to remember i have no idea what any of these are
does runBlocking use its own scope?
π₯²
didn't know that
fun main() = runBlocking { // this: CoroutineScope
launch { doWorld() }
delay(1000L)
println("Hello")
}
// this is your first suspending function
fun doWorld() {
println("World!")
}
```would it print ```
World!
Hello
```?
yes
As long as you're launching in the same scope, it should wait for completion
Now say you are in scope A and you launch into GlobalScope, the job starts executing separately
launch = create new scope?
Scopes manage coroutine jobs
runBlocking = create new scope?
launch = new coroutine in the same scope
Every coroutine call you make, is split up into mutliple jobs for the scope by the compiler
runBlocking would kinda be the scope here
there's not an obvious one in this scenario
I get the opposite results when using the Kotlin playground to fire that 1000 times
Yes because parent waits for child
kotlin playground?
wat
you sure it's not the other way around?
uh, what about #dev-general message tho
Parent jobs wait for child jibs
What about it?
because runBlocking is the parent here and launch is the child
and yet the println inside of the runBlocking runs before the launch code runs
so I get ```
Hello
World!
That's weird
import kotlinx.coroutines.*
i can't press the X π©
Zoom out
^
π
Anyway coroutines overcomplicated and hard ExecutorService good coroutines bad
wat
Or f# computation builders good, coroutines bad
coroutines aren't that complex
bm
We have already seen they're complex
contexts are a bit strange to understand, but they kinda make sense
i think the coroutines library is very overcomplicated
?
explain why hello world gets printed then, when parents are supposed to wait for children
you sure that launch gets executed under a child context here?
wat
what if it gets launched under the parent context and then happens to run after the println?
yeah ik that
idk i just think launch as create new coroutine
and since u create new one after, it runs after
but if you delay the first, the second runs
Then it works fine?
yeah those get executed sequentially since they're launched on the same scope and put into the same queue
what's the outcome of that?
who is the parent here though?
runBlocking
okay
yeah but how can the parent be waiting on the children if the parent gets executed first?
?
that's how coroutines work
it compiles to callbacks
Although probably not in this case
parent starts
suspends, waits for first launch call to finish
resumes
etc
parent finishes
yeah
Waiting as in the parent job doesnt end
the job is alive
ah
why is there apparently no main method for this: ```kt
import kotlinx.coroutines.*
fun main() = runBlocking { // this: CoroutineScope
launch { doWorld() }
launch { doHello() }
}
suspend fun doHello() {
delay(100L)
println("Hello!")
}
suspend fun doWorld() {
println("World!")
}
Waiting not in the blocking sense
I thought you meant waiting on the children to finish execution
that's usually what waiting in this context means
Now if you were to launch those into another scope, the parent would die befor the children
runBlocking returns the last call, launch {} returns a Job, so main returns Job<Unit> not Unit
This also means by cancelling the parent, you cant cancel the children
Another this is affects is exception handling
oh
english.exe not found
thing*
Add a return type*
@half harness just shove Unit at the end of runBlocking lol
another thing this*
lol
adding a return type will cause you compile errors
Yes exactly
error is more obvious
import kotlinx.coroutines.*
fun main(): Unit = runBlocking { // this: CoroutineScope
launch { doWorld() }
launch { doHello() }
}
suspend fun doHello() {
delay(100L)
println("Hello!")
}
suspend fun doWorld() {
println("World!")
}
```this prints ```
World!
Hello!
so basically
fun main(): Unit = runBlocking { // Type inference failed. Expected type mismatch: inferred type is Job but Unit was expected
launch { doWorld() }
}
huh
idk it works for me tho
lol
maybe Unit is an exception?
of course it does, since the launch calls are queued in order
ya
yeah Unit is like Object in java
Or should I say, everything extends Unit
producer :: Coroutine (Yield Int) IO String
producer = do yield 1
lift (putStrLn "Produced one, next is four.")
yield 4
return "Finished"
``` :relieved:
I have never had that work for me Yugi
aren't you thinking of Any?
Or Nothing
I've always got that compiler error
what does Yield do
yields
???
proof no error
Unit works in a similar sense bm
yeah Any is the superclass of all types, Nothing is a type to represent something that never returns
lol
never has for me Yugi
I have no idea, presumably it supplies the value to the coroutine
Unit is still a type
similar to a sequence
wait so would launch {} and thread {} sorta do the same thing?
except that launch can run suspend functions
@old wyvern https://i.imgur.com/nTNrCQi.png
i don't want to overcomplicate myself
π€£ rip
flameshot? ever heard of sharex my man
With launch you cant expect it to be ran on another thread for sure
i know
that's why i said sorta
If already in a coroutine context
they're similar in that they launch a new process-sorta
You mgiht be dispatching to the same thing
- I'm on Linux
- ShareX is actually worse than Flameshot imo, since it doesn't give you a chance to re-adjust the window size after letting go of the mouse in my experience
XMonad best wm
well yeah you can't readjust after you let go? it takes the screenshot
smh, something called press-right-click-to-cancel-or-resize
you press Ctrl+PrntScrn to select the area you want to take a picture of
with Flameshot you can, and my mouse is a bit dodgy and sometimes lets go too early
so like kt Thread.sleep in thread {} is kt delay in launch {}?
well that's lame, if only it didn't title your imgur uploads so it didn't show the extended border
They have the same effect, very different implementations
they both "sleep" the thread/coroutine
can you change the title of them perchance?
well yea thats what i mean
I can probably turn that off
thread.sleep sleeps the entire thread, delay suspends the coroutine and resumes it after the time has passed
i know that coroutines are different from threads
you should do it then! that would make it okay in my book π
The difference would be that delay doesnt starve the thread
mhm
It schedules the continuation to be ran after that time and lets other jobs execute
so besides it letting other jobs execute
yeah delay is more like bukkit runTaskLater than anything else
ignoring impls, it does the same thing?
yes
alr
mhm
okay
hell, a lot of coroutines are pretty similar to the bukkit scheduler
at pc yet? π
Very similar concept
the bukkit scheduler is a very cool idea i like it
val job = launch { // launch a new coroutine and keep a reference to its Job
delay(1000L)
println("World!")
}
println("Hello")
job.join() // wait until child coroutine completes
println("Done")
```oh, and this would be like `Future#get`? (the job.join() part)
yup
lol
but then you have to maintain a fork
it's not rocket science

^
room 2!
better than switching to a hacky ShareX port
maintaining a hastebin fork is annoying enough because they keep introducing conflicts with the css
oh its cpp
.cpp
imagine using mic smh
dkim voice reveal soonβ’οΈ
you can see a lot of the cpp influence in java though, a lot of the code is identical
just gotta figure out how to create a new project from version control in CLion
it couldn't be that huge ass "Get from VCS" button at the top right
I don't see that
surely not
like it's not there
lol
oh that
vcs fan vs zip file enjoyer
in the project menu
who needs commits when you can setup a cronjob to zip your project folder and back it up every 5 minutes
or better still, just don't make mistakes
just code everything at once, commit once, ez
vcs fan vs tar file enjoyer
no need to mess with vcs
7z
lol
can I even test dd?
why couldn't you?
idk does it not need a db or whatever?
the bot needs a mysql db (you don't need to run the docdex app, you can just use the official ver)
but what developer doesn't have mysql installed
Β―_(γ)_/Β―
what about mariadb π
Shouldnt running your defined tests be enough?
hah
the changes were done on the discord module
I ran out of time to make tests yugi
trust me, it works!!
also, why the decimal format for colors smh
instead of 0x1RRBBGG where you clearly see the rgb
well I didn't know that was a thing
call me a fake developer cus no dev role here, but i dont π
piggy only has code
docker
no test
never bothered
Imagine having docker installed
same thing smh
trigger warning
docker better
mysql is like so essential
i mean why would I need docker locally
@quiet depot wanna change the format?
oh btw finally got to actually using docker once
star lemmo runs everything in containers
oh
lemmo lives in a container
I don't have enough RAM for that I don't think
Lemmo is a container
with a will there's a way
docker doesn't use much ram
Haskell doesnt use much ram
oh does it dynamically allocate resources?
yeah and you can limit it