« first day (4279 days earlier)      last day (652 days later) » 

4:03 AM
why win10 win button lag af
did win11 fixeed this issue?
 
 
3 hours later…
6:55 AM
[Squirrel in Training] GoOoOoOoOoOoOoOoOoOoOoOd Mornin' pleberinos!
 
7:28 AM
anyone here has much experience with functional programming?
 
7:40 AM
there are some hardcore functional programming concepts that I am trying to look at, but I am currently too biased with expectations to understand the edge cases
 
7:56 AM
more than 2/3 of my works are functional
anonymous methods and extension method everywhere
idk but i hate duplicated code
 
but are they in languages like haskell?
 
idk, idk about pure functional
 
an example of a problem:
consider a language that has no exceptions, instead error values are returned in an "either" or "one-of" construct
 
null...
 
function divide(dividend: Real, divisor: Real) -> (Real | Error)
{
	if(divisor == 0)
		Error("Cannot divide by zero.")
	dividend / divisor // would be some native code or shit
}
a classic example is the divide operation, which is not a (Real, Real) -> Real, because it also has a special output in case of a non-zero divisor
one way to "solve" it, which I am quite curious as to how that would turn out in the long term, is to have a subtype (or subset) of Real, NonZeroReal
but that violates one of my programming principles, in which you never abuse the type system for equal data structure with a subset of values (for example a uint or a non-empty-string)
 
8:06 AM
similar to double.PositiveInfinity?
 
another solution is to have the return value be either Real or Error
either way, the function's signature then accounts for it's exceptions
 
then this will need the language system to support
 
another solution is to return some special value, like double.PositiveInfinity, but that is cheating
 
lol
 
languages like haskell have to support this... as this is what they do
iirc
 
8:08 AM
only if reference had metadata
 
I made a "proposal" for Wietlang to adopt an upgraded variant of Java's explicit exceptions, which is basically the same thing
the problem is, there are some exceptions that are... edge cases
 
value itself cant be on specific special status, it is just some bytes contains only value
Wietlang ??
you still working on it?
 
partially
currently in 2nd design phase (mostly review phase and expansion)
so doing research more than writing code for it
anyway, an edge case for exceptions is... StackOverflowException
function veryBadFib(n: Integer): Integer
{
	if(n == 0)
		0
	else if(n == 1)
		1
	else
		veryBadFib(n - 1) + veryBadFib(n - 2)
}
by taking a quick look, this function appears to satisfy the signature, it will always return an int for any int you give it
except if that int is 1000000000
then it will give an error... specifically a StackOverflowException
 
fibonaci
 
but... wouldnt that basically make every function able to throw an error?
what about OutOfMemory ?
calling any function, requires a stack frame with some memory, so literally any function could throw either of these errors
therefor either errors are not (always) explicit or these errors should crash your application to oblivion
or something else
 
8:16 AM
they are runtime exception, it terminate current thread
 
that sounds bad
 
shouldnt account to method i think
 
?
 
the oom and so exception thrown by lower level instead of function
so it isnt function 'fault'
 
but as a language point of view, these should therefor not be exceptions, but rather system errors
and you cannot catch these errors
and none of your "error-safe" code that should run regardless of errors, will actually run
 
8:21 AM
oom seems cant avoid, unless..... pause?
pause until enough memory
 
in Java for example, OOM is just a throwable
it will throw the OOM and you can catch it wherever you had a try-catch
 
and so maybe can avoided, just use another technology instead of stack? idk
 
and all the finally blocks will be executed
same for SO
 
yes, but if you resolve or use another technique to, not to throw these exception
 
there is no technique for infinite memory though
either you get an error or you get a freeze
 
8:24 AM
maybe pause?
pure fucntional desnt say it cant be paused
similarrr to freeze, but can be able to continue
 
there are technologies for infinite stacks, but then you again are limited by memory
consider it runs on a docker container, and that container spends all the memory on this one application, then it froze forever
freezing is really bad for many reasons, I prefer an error
 
yeah, if the encironment doesnt fulfill the function hardware requirement, we pause the runtime and blame the environment
@Wietlol not sure this will voillate last rule of functional programming: side effect
assuming the middle one function return error from thousand of series function calls, the result would not be normal
the udeveloper ends up catch the errorr middle of scripts........
so I think it isnt good idea for functional programming though
 
at that point, it is no longer bound to functional programming
for any form of programming, violating your own principles is bad
for languages with exception handling, you can use try-catch-finally constructs to ensure that certain pieces of code always run
for languages with error-monads, you dont need the try-catch-finally construct, as you replaced it with the error-monad, and you can also ensure that certain pieces of code always run
except for some errors that the developers of the language didn't think of
which means that once you are aware of that risk, the developer is in perpetual fear of their code not running (probably not, but I would be)
 
8:51 AM
i wrote many functional scripts avoided the error by using Where() filter and all possible potential exception are already prechecked
so i have super confidence to put it live on production server
i found similar situation to your concern
i return guid and filter out later
because GroupBy() need unique value... otherwise maybe I can use just specific const for indicate an error
 
9:09 AM
[Captain Obvious] @ny that font is HORRIBLE
[Captain Obvious] Or maybe it's just the rendering, but that screenshot was really hard to read
 
9:47 AM
oh I used to this font, and set white to little green
it is ubuntu monotype
 
[Captain Obvious] Are you using linux then? That would explain the shitty rendering
 
 
1 hour later…
10:51 AM
[Captain Obvious] This tooltip tho
 
 
1 hour later…
11:52 AM
that better be ported from Java :D
Java's jdk is filled with classes and interfaces with huge javadoc stuff that the IDE loves to show
take for example the Collection<E> interface
 
[Captain Obvious] Nah it's probably ported from either Swift or Obj-C
 
perhaps as well
 
12:34 PM
[Hector] sup
 
mr5
1:14 PM
o/
@Wietlol I'm not sure which is original of this documentation style. I saw it in both Xcode Swift and AS Kotlin
 
probably still Java's Android SDK
 
mr5
@Wietlol use signals then
 
signals?
 
mr5
e.g., sigabrt
 
crashing the application?
 
mr5
1:24 PM
yes
 
nah
imagine you are writing a web service, you receive one request that asks to do excessively much work, that causes an OutOfMemory error, you want your entire web service to be unavailable to everyone until someone thinks of restarting the application?
 
mr5
@Wietlol in obj-c, most of the examples I saw are recommending to handle in case heap allocation fails, but I was not able to encounter it or have heard/known how to actually recover from it.
 
in Java, it is quite easy actually, you just catch the error
 
mr5
some error/exception classification?
 
fun recursive()
{
	recursive()
}

@JvmStatic
fun main(args: Array<String>) {

	try {
		recursive()
	} catch (ex: StackOverflowError) {
		println(ex.toString()) // java.lang.StackOverflowError
	}
	println("completed") // completed
}
 
mr5
1:33 PM
int main() {
  try {
    run()
  } catch(ex) {
    // retry
    main()
  }
}
 
(Kotlin, but the primary point is that it is JVM)
@mr5 that looks bad though
as you recursively call main again
 
mr5
yeah lol
 
in the catch
so, you will get an SO error, then retry with a stack with one less frame space
 
mr5
catching stackoverflow seems like a bad design
 
that is why these are not subtypes of Exception
 
mr5
1:35 PM
wait, does java has an actual class for it and allowed to catch this?
 
in JVM, there is a root type Throwable
Exception and Error extend Throwable
so when you catch Exception, you wont catch it
when you catch Throwable, you will
> public class Exception extends Throwable {
generally speaking, you wouldnt catch the Errors, such as OOM, SO, TD, etc
but at some points, you should
(except TD I guess)
 
You could catch errors but in the vast majority of times it's not really useful.
 
mr5
catch (err: BSOD)
 
because if your http call caused an out of memory, then you want to catch that, return a 500 error to the user and keep your application running, let the garbage collector clean up the mess
 
Of there is an out of memory, you probably can't do anything about it.
^^ Except in rare circumstances, yes.
 
mr5
1:38 PM
wouldn't OOM prevent you from throwing since it needs heap allocation?
 
fun stackOverflow()
{
	stackOverflow()
}

fun outOfMemory(): Any
{
	return Array(1_000_000) { outOfMemory() }
}

@JvmStatic
fun main(args: Array<String>) {
	try {
		stackOverflow()
	} catch (ex: StackOverflowError) {
		println(ex.toString()) // java.lang.StackOverflowError
	}
	try {
		outOfMemory()
	} catch (ex: OutOfMemoryError) {
		println(ex.toString()) // java.lang.OutOfMemoryError: Java heap space
	}
	println("completed") // completed
}
@mr5 the JVM can reserve memory and stack frames to always be able to throw the associated errors
but even if it doesnt, then your catch will throw the same error after reducing the stack size and memory
the problem in those cases is that the error is not exact any more
for example:
fun stackOverflow()
{
	try {
		stackOverflow()
	}
	catch (ex: StackOverflowError)
	{
		println(ex.stackTraceToString())
	}
}
 
mr5
that would be a longass stacktrace
no?
 
this will not throw a StackOverflowError because it is caught, but converting that Error (while already being at the end of your stack), to a string, will cause a second StackOverflowError
 
mr5
or OOM
 
that one will be caught by one stack higher up
 
mr5
1:45 PM
stackoverflowception
 
and therefor, in the stack trace, the error you receive comes from the println(ex.stackTraceToString()), not from the stackOverflow()
basically hiding the original error
that is why Java reserves memory and stack for these edge cases, just to provide a more meaningful error
 
mr5
So you are copying Java's approach?
 
not really, but Jetbrains is
and I use their system as compilation target
so I inherited their approach
but to be fair, there is no system I would rather inherit from
every other language I have seen either does the same or worse
 
mr5
Hey, you can always try pagefile if OOM occurs so you might be a little unique there
 
2:04 PM
Wouter de Kort on July 04, 2022
We neglected unit tests for a long time because our code base made them difficult. But now we’re putting in the work to change that.
 
@mr5 there can never be infinite memory tho
you always have some edge case of OOM
 
2:38 PM
[Hector] if(Memory.IsFull) process.WaitTheFuckUp();
[Hector] you're welcome
 
Damn why didn't I think of that
 
[Hector] How are you doing guys?
 
Pretty great, unexpectedly won a coding challengeāœŒ
 
[Hector] amazing
[Hector] and here I'm trying to figure out where to add some exclusion property within an XML
 
All I had to do was find the shortest route from A to B with "many" different flights given lol
Couldn't see the tests they ran on our code but it only took a moment so probably not that many flights
 
2:48 PM
[Hector] lol
[Hector] basic A* then?
 
Didn't build anything too fancy
Not even A* lol
Thought I don't have time just go foreach airport I can reach from here find route from that airport to my destination, then choose the fastest.
Look at it the thing fits in one natural sentence even
 
[Hector] ah classic bunch of foreaches
 
Seems I'm one of few who actually built something working, and then I had the nicest code
Bunch of LINQs and one foreach to choose the shortest route
The whole thing was explicitly C# only, guess the sponsoring company looks for C# devs
 
[Hector] oh
[Hector] did you get a job offer
[Hector] or was it just like yaaay you won, cool, thanks, bye
 
Well now I have a 34" UWQH curved monitor and they stil don't have another C# dev
Basically everyone was like "yo here's my card call me lets drink a coffee in my office"
 
2:52 PM
[Hector] what monitor?
[Hector] it's not a 34GK950F by any chance, is it
 
[Hector] oh well, not bad
[Hector] I'd use it for work
 
Definitely gonna use it for work lol
 
[Hector] > Night Vision: See every detail clearly in the dark, helping you find and attack enemies before they notice.
[Hector] what the fuck
[Hector] xD
 
Go go gadget cheater monitor
 
2:55 PM
[Hector] you can attack those bugs in the middle of the night
 
Just need a gaming chair to get better reflexes now for even more cheats
 
[Hector] don't forget to put RGB in your chair
[Hector] +10% skill, everyone knows that
 
Oh definitely, so my enemies can't sneak up in the dark from behind
 
3:15 PM
dang, why did I not think of the RGB in chair?!
@Squirrelkiller easy to win if no one else submits anything
I recently also did some leetcode, and I tried to optimize some submissions
turns out, waste of time
there was one problem, which had an O(n) solution, assuming the input was sorted... which it wasnt
so, most solutions appeared to be O(n log n) (time)
but I tought I could optimize it by using an O(n) sorting algorithm
but that other algorithm has no bias to existing order
and the default sorting algorithm did
and most of the test input was (almost) entirely sorted
so the default sorting algorithm kinda already ran in O(n)
I also noticed a 70% fluctuation in runtime duration for multiple submissions of exactly the same code
 
How is that possible
Do they randomly run some submissions on a toaster
 
submitted the same code 10 times, lowest: ~450ms, highest: ~800ms
sometimes everything is just faster, I guess
probably hitting at the correct time to do everything between GC clears or something weird
or machine just hiccupped
I wonder how accurate Wietbot's code snippet environments were in runtime duration
on the downside, I probably wont be able to find my old dynamic FizzBuzz with iteration over recurring patterns solution
 
 
3 hours later…
6:28 PM
 

« first day (4279 days earlier)      last day (652 days later) »