« first day (1412 days earlier)      last day (3537 days later) » 

11:00 AM
> How much clothing material we can save if all the people started to wear only swimsuits?
you ask the wrong questions there
 
@Xeo I hate picking overloads manually via casts
 
you should ask things like
 
Xeo
@BartekBanachewicz err, don't do that, then.
 
"How do we get all the people to wear only swimsuits?"
 
@Xeo I need because deserialization ambiguity
x <- deserialize :: X
 
11:01 AM
@AlexM.: hahaha Alex. Sorry that's off topic for the proposal :D
 
@AlexM. I'd be fine with girls only
 
Ell
I thought this was c++
 
@Abyx on second thoughts, me too
 
Xeo
@BartekBanachewicz yes, so?
 
@BartekBanachewicz swift, the "most modern" language doesn't allow extension methods on generic types.
 
11:01 AM
@BenjaminGruenbaum swift is retarded
@Xeo so how do I do that then?
 
@BartekBanachewicz You've used it extensively and evaluated its pros and cons obviously.
 
@BenjaminGruenbaum I'm not in the mood for your trolling today sorry.
 
@BartekBanachewicz not trolling, why do you think it's "retarded"?
 
@BenjaminGruenbaum It's pretty fucking clear that the language designers are smoking crack. No exceptions and arrays are sometimes mutable and sometimes COW? You don't need to be a Swift expert to realize that they're insane.
 
@BenjaminGruenbaum dunno go write in dynamically typed languages somewhere until I fix my problem
@Xeo also cannot overload on return type obviously
 
11:03 AM
@Puppy Arrays are mutable if you declare a mutable array - they had a weird slicing behavior initially that was fixed in like the second build, arrays don't do that anymore. Also - lots of languages don't believe in exceptions because of abuse - they prefer functional solutions and multiple return value like Go.
 
Xeo
Nobody said you have to have the overloads as the interface to your deserialisation
 
deserialize :: Serializable a => istream -> a
 
@BartekBanachewicz that you wouldn't be having with a good type system or no type system? Sure.
 
@BenjaminGruenbaum Then lots of languages are batshit insane.
 
@Puppy for what? Not having exceptions?
 
11:04 AM
yep.
 
Ell
what
@Puppy isn't that a bit close minded?
 
Puppy is right again!
 
@Xeo well what could I use instead?
 
@Puppy name languages you think do exceptions right.
 
Ell
What about the alternatives? have you considered them?
 
11:04 AM
@BenjaminGruenbaum Languages that implement them.
 
multiple return values and exceptions model two different things
also I'm not in this discussion
 
lol
 
imho Either fits better into pure code, and exceptions into impure
 
@Puppy name one language you believe does exceptions right, I can go on a 10 minute rant on why Java exceptions are absolutely horrible and you'd go "oh, I was talking about good languages that implement exceptions" - so I'm asking that you name one.
 
but that might just be me
 
11:06 AM
@BenjaminGruenbaum Even Java's exceptions are substantially better than not having them at all.
 
so @Xeo Either alternative or I'm moving the whole thing to structs and specializing them
 
@Puppy yeah, because when I read a method that opens a database I want to separately handle IOException, ConnectionStringErrorException and 10 other excpetion and end up with method names that are over 200 characters long.
 
@BartekBanachewicz Either is like the proposed expected thingy, right?
 
Not to mention the Throwable or Error Bullshit, and RuntimeException
 
@Griwes It's a 2-variant with one of the options being "greater" or "right"
 
11:07 AM
My latest purchase:
 
@BenjaminGruenbaum Most of the time, handling them at all isn't required.
 
Or the fact that throw safety doesn't really give you throw safety in Java because you can still have errors you can't catch.
 
@BartekBanachewicz Alright.
 
Them shipping costs.
 
@Puppy you haven't used Java then? It absolutely is, your method can't return if you don't handle all exceptions in Java since the exceptions are checked.
 
11:07 AM
and exceptions permit you to signal errors from functions that otherwise couldn't signal any, like constructors.
 
I know what they do.
 
@BenjaminGruenbaum Just label them all as throwing RuntimeError, or whatever it is.
 
@Puppy you can return a Maybe<T> for example.
 
I could do, but then every caller would have to check it.
 
not from typical oop constructors
 
11:08 AM
@StackedCrooked I get a 404 if I click on the image :c
 
and also, you can't return shit from a constructor.
 
@Jefffrey me too
 
@BenjaminGruenbaum Constructors don't return values, you silly.
 
you can't write a class in C++ that's explicitly optionally constructible
 
@Jefffrey me too even though the one-box works
you have to add .png I think
 
Actually it skipped b.png. Seems like a chat error.
 
@Puppy no, that's the point - it would be explicit, you'd get a Maybe<T> and have to verify you got the object - errors don't go unhandled.
 
36 secs ago, by Bartek Banachewicz
you can't write a class in C++ that's explicitly optionally constructible
 
@BartekBanachewicz don't construct it via the constructor, use a factory method for that.
 
@BenjaminGruenbaum They don't go unhandled in exception situations, but you don't have to write handling code at every single call site of every single function that might throw.
 
11:09 AM
Construction is not supposed to contain complicated logic to begin with.
 
@BenjaminGruenbaum that's one option
 
@BenjaminGruenbaum That's broken.
 
@BenjaminGruenbaum validation of parameters is not complicated logic
 
Constructors should do one thing- construct an object.
 
@Puppy Or you know... chain optionals and use Either?
 
11:10 AM
@StackedCrooked Basically free as long as you pay for the shipment?
 
@Puppy that's easily solved by monads
 
@BartekBanachewicz validation of parameter can, and should be done through the type system.
 
@Jefffrey I guess.
 
@BenjaminGruenbaum The "you have to verify" part makes the non-exceptional path never free.
 
@BenjaminGruenbaum Yes, when I'm loading the typeinfo header, the type system can tell me whether or not it's present on the target file system.
 
11:10 AM
31 secs ago, by Bartek Banachewicz
@Puppy that's easily solved by monads
chain computations in MonadError or whatever
 
@Griwes right, the design choice is to force you to consider the exceptional cases, they're mostly free and you can chain and propagate automatically with monadic constructs but you have to consider it. The error is explicit. I'm not a huge fan but it's not inherently inferior.
 
@BartekBanachewicz That still involves the "I have to check" part at some place.
 
@Griwes No, it really doesn't - you can simply not add a handler that checks.
 
if you don't check you can't use the damn thing
 
You can, but you should check.
 
11:12 AM
of course you should
anyway I am not in this discussion
I have to fix my terrible serialization code
 
@BartekBanachewicz All the evidence suggests otherwise.
 
Fuck DNS, unreachable etc. I'm doing an all-office reboot.
 
@BenjaminGruenbaum If you can use Monads to chain them together so that they propagate invisibly, then I fail to see how this doesn't effectively consitute implementing exceptions as monads.
 
type safety. (I think)
 
I could implement them that way in Wide too on the codegen level if I wanted to.
@BartekBanachewicz Exceptions are perfectly type-safe.
 
11:13 AM
@Puppy really? It's type safe.
 
@Puppy I think @Benjamin thinks otherwise
 
there's nothing non-type-safe about exceptions.
 
@Puppy No, checked exceptions are type safe. Exceptions in most languages like C++ are not type safe (and broken anyway)
 
you cannot catch an exception of one type as another type that it is not.
 
@Sebastian-LaurenÅ£iuPlesciuc I didn't comment on the question. I commented on this answer, as it appears to advocate a particularly dangerous brand of unethical band-aid. — sehe 9 secs ago
 
11:14 AM
or access an invalid exception object (beyond what you can do with any other object).
 
@BenjaminGruenbaum lol
 
@Puppy Take it from someone who implemented exceptions the other day if your flow control is Action<ResultType,ExcpetionType> instead of Action<ResultType> your exceptions aren't type safe. It's a compromise I happily live with since exceptions are cumbersome but meh.
 
you know, I have also implemented exceptions, right?
 
@Puppy that's using types as predicates, that's not what type safety means at all.
 
Then what does "type safety" mean in your book?
 
11:16 AM
All I'm saying is that not having exceptions is not inherently inferior.
 
It is.
 
the only system you've described to replace them exhibits all the same core properties.
 
@Griwes that if a function can throw a FooException you must expect it in the function that calls it.
 
>: error: default template arguments may not be used in partial specializations
struct deserialize<std::vector<T>> {
^
 
@BenjaminGruenbaum That would be statically typed, not type safe.
 
11:17 AM
fuck.
 
@BenjaminGruenbaum That's just bad, and you have explained that already when talking about java's exceptions being bad.
 
@Puppy no, it wouldn't. If your function is throwing a FooException and you have no idea waht your function is throwing yo're not type safe.
 
@BenjaminGruenbaum lol
lol
 
@Griwes I'm not saying I like it -_- I think it's horrible to force you to do that - I think type safety is bad in this case.
 
it does not mean it's not type safe.
no, it just means that the type checking is deferred until run-time.
 
11:17 AM
@Griwes it's like pattern matching on Anything
 
@BenjaminGruenbaum lol
 
@BartekBanachewicz exactly
 
you cannot violate the type system with exceptions.
 
Someone is still flagging in the lounge. To whomever it concerns: STOP. Thank you
Aug 23 at 16:39, by Feeds
PUBLIC SERVICE ANNOUNCEMENT: READ THE RULES.
 
So... boost::any_cast is type-unsafe?
 
11:18 AM
@Puppy There is no type system with exceptions, you are violating it in most of the case.
 
Lolwat.
 
@Griwes well type erasure removes the information, so you can't base on it anymore
 
@BenjaminGruenbaum Sure there is. I can't name a single time or write a single piece of code that would allow me to catch an exception as the wrong type.
 
@BenjaminGruenbaum does it have a comfuture?
 
@Puppy you can simply ignore it and not catch it.
 
11:19 AM
@BartekBanachewicz RTTI preserves it. any_cast can reject unsafe type casts. It just occurs at runtime.
 
@BartekBanachewicz any_cast can tell if what I requested is valid or not - at runtime, granted, but the information does not go away, it's still there.
 
@BenjaminGruenbaum So what? I have that power anyway.
 
Hidden, but still usable.
 
@Puppy only for virtual types
 
and allowing exceptions to implicitly propagate is what makes them so good.
 
11:20 AM
@Puppy because it's not type safe.
 
@sehe No, for all types.
 
You are ignoring the type of the exception thrown.
It's like using Object for everything and then casting with instanceof
I find it hard to believe you've written a language with exceptions since you'd have to know that.
 
Er.. hello?
 
instanceof is perfectly type safe.
 
Xeo
just one example
 
11:21 AM
if you have one single Object, then instanceofing it is perfectly type safe.
 
catch(MyException e) {} is like writing catch(Exception e) { if (e is MyException) ... else throw;}
 
the problem is when you have a precondition where it has to be some more specific derived class.
 
How are you not getting it -_-
 
like, I dunno, collections.
but those situations do not occur in exception handling.
 
This isn't the actual argument anyway - which is exceptions are not inherently more powerful than the alternative which I have shown in "You can implement exceptions trivially in modern languages without them" and "there are alternatives like Maybe and Either you can use".
However - I have no idea how you're calling instanceof checks everywhere for validating your types instead of having explicit return types safe...
 
11:22 AM
all you've done is suggest that you can implement exceptions as monads.
 
@Xeo interesting
 
regardless of whether or not it's true, it's not really important, since you end up with exceptions either way.
 
No, I just said that to illustrate it's not less powerful, I've also suggested aother solutions.
 
@BenjaminGruenbaum It's only unsafe if you've got the potential to violate a precondition.
 
@Puppy of course it is relevant - your claim was that languages without exceptions are inherently worse.
 
11:23 AM
My notwork is interborken.
 
@BenjaminGruenbaum Yes, and you've just said "We totally don't have exceptions, we just do something which is identical in nearly every observable fashion."
 
@Puppy the return value of the function T foo() is of type <T,?> instead of <T,E> and you have to manually cast ? to E.
 
Xeo
alright, time to go to sleep
 
@BenjaminGruenbaum You're wrong; because nobody ever stated as a precondition that it has to be E.
 
I didn't even claim I don't like it - I like exceptions.
 
11:24 AM
although FTR
 
I just think the claim that 'they're inherently better than everything else in other languages' which I'm now convinced you've never written in is FUD.
 
in my own language, I am planning to use inferred checked exceptions where possible.
 
I'm starting to think that by languages without exceptions you think I mean C
 
Kaspersky: 'Downloaded: 62 KB (261 KB/sec)', for five minutes..
 
The effect of your function isn't controlled. That breaks type safety.
Imagine all your functions doing:
 
11:25 AM
no, it's perfectly type safe, and perfectly controlled.
it's just that the requirements are not very strict.
that does not make them uncontrolled or unsafe.
 
SuperBaseObjectType o = myFunction()
MyType t = explicit_cast(MyType,o); // this might fail
@Puppy :lol:
 
sure, it might fail, but that's perfectly well-defined and safe behaviour.
 
It's type safe, it's just that the type isn't strict.
 
#cpp Truths: Fun with Lambdas: C++14 Style (part 3) http://shar.es/11b7zI #wow This will take some around-wrapping of my head
 
nobody's precondition was violated if it failed.
 
11:26 AM
You can try/catch code that doesn't have the ability to throw exceptions and you can ignore code that can.
 
both of those things are good things.
 
@Puppy you keep using that word, I'm not sure it means what you think it means.
 
The Lounge is just about the only thing working here:(
 
the correctness of the user's code does not depend on the exact type of the exception being thrown.
 
 error: call of overloaded 'deserialize(std::istream&)' is ambiguous
     uint32_t size = deserialize<uint32_t>(str);
                                              ^
@Xeo ~
 
11:27 AM
I have no idea why you think exceptions don't break invariants but "this code does not crash my program unless I explicitly handle it - oh and I have no way to know it might do that" is pretty huge.
 
Xeo
@BartekBanachewicz uhm, doing it wrong, I assume
 
I copied your code
 
@BenjaminGruenbaum It clearly cannot crash your program. That's what catch(...) is for.
 
Xeo
you're not supposed to overload the (std::istream&) function.
 
the reality of exception handling is that the exact derived exception type is of little interest to anybody.
 
11:28 AM
@Puppy hahahaha, catch(...) - the pinnacle of type safety. "Something went wrong and I have absolutely no idea what".
 
Xeo
You're supposed to add a new (deserialising<T>, std::istream&) function
 
Again, I'm not saying I'm against exceptions. I like exceptions. I just think that the notion that they're inherently superior and languages that have them are superior to languages that don't is FUD.
 
you haven't suggested any languages that don't have exceptions (except C). You've only said that in other languages, they implement them by chaining monads instead.
 
@BenjaminGruenbaum that's not a problem with type safety. That's a problem with coding intent
 
anyway it's my lunchtime
 
11:30 AM
@Xeo ah yeah I slipped
I think it works
template<typename T,
         typename = typename std::enable_if<std::is_pod<T>::value>::type
         >
T deserialize (deserializing<T>, std::istream& str) {
    T t;
    str.read(reinterpret_cast<char*>(&t), sizeof(t));
    return t;
}

template<typename T,
         typename = typename std::enable_if<std::is_pod<T>::value>::type
         >
std::vector<T> deserialize (deserializing<std::vector<T>>, std::istream& str) {
    uint32_t size = deserialize<uint32_t>(str);
    std::vector<T> v (size);
my glorious creation
 
@sehe there is no verification that your code is catching all exceptions that might be thrown to it - that's the type safety bit. Doing ... is like assigning the method return value to a global super type all your classes inherit from because you can't figure out what the function returns from its signature and the compiler can't validate it for you.
Meh, I'll be back later.
 
I like exceptions too. The outermost-level handler directs all my Access Violations into log file entries, so allowing my suckApps to continue working.
 
@Puppy Go, that was my first suggestion.
 
Xeo
alright, now time to sleep for reals
 
@Xeo Not allowed - you have to pass an int or DWORD.
Something is grossly shagged in my office net.
 
11:36 AM
@BenjaminGruenbaum ah, if you insist that exceptions are part of the function signature. That's a definition thing. Not my take. I view exceptions as "out-of-band" (kinda "async") and this is also how C++ implements that
 
Well..
http://stackoverflow.com/questions/25547707/getting-wrong-answer-on-project-euler-8
 
@BenjaminGruenbaum FTR Puppy thinks C++ is better than Haskell
don't stress it.
 
Still, it's the programmer's intent to catch "anything". You can hardly blame the language for being "untyped" or "not strongly typed" just because the programmer chose to write a generic handler
 
generic handlers are useful for rethrowing and pretty much only that
and rethrowing itself is a nice concept
 
:D /cc @Ell
 
11:40 AM
@sehe yes, and that is not type safe. That's all I said about it. I'm for that design choice but saying it's type safe is funny.
 
fuck @Xeo I am getting ambiguity between one overload and the lack of overload overload
:/
 
@sehe Looks about right.
 
C++'s inference is dumb as hell
 
@sehe Unsurprising, sadly.
 
@sehe it doesn't count people who died in Iraq
 
11:41 AM
yes I am calling a function returning void to store its result
guys can anyone help me with that? :(
I am terrible at C++
 
@Abyx Still, if you get shot dead or blown up, you have very little chance of dying from cancer.
 
I'd like to disambiguate between <T> and <T, is_pod<T>> in favor of the latter
 
So the wars could be portrayed as an anti-cancer measure.
 
@MartinJames I hate you.
 
fuck it I am going to ask on SO
 
11:44 AM
Anyway, talking of wars, must check the news to see if Ukraine still exists.
 
@MartinJames More generally, if you cure people who have cancer, then you then have to provide jobs, food, land, etc.
 
@Puppy Good point. Graves, (assuming there is anything left to bury), are cheaper.
 
@sehe well, one way to fortify your control over the people is to invent some imaginary enemy
Communist party in China used to do it all the times (still does), U.S. government has been employing this technique for years
 
0
Q: Can I disambiguate between two overloaded template functions towards more constrained one?

Bartek BanachewiczThe Code #include <iostream> #include <type_traits> template<typename T, typename = typename std::enable_if<std::is_pod<T>::value>::type > T foo(T t) { return t; } template<typename T> void foo(T t) { } int main() { foo<int>(5); } The Error main.cpp: In function 'int ...

shameless self-promotion.
inb4 "bin it"
 
^ wanna downvote it
 
11:49 AM
downvoted
 
you're so nice guys
 
but I knew puppy would do it for me
 
@MartinJames which is why we can't afford gun control!
 
@sehe lol
 
@BartekBanachewicz Spamming links to my blog.
(Shame on you.)
 
11:54 AM
@R.MartinhoFernandes I can't C++ :(
 
My notwork seems to be recovering. I don't know what happened, I didn't do anything to fix it.
 
But I will learn
I am going to reserve one weekend in the future and read the whole flamingdangerzone
 
"...; considering 0 to be even, of course."
 
I should write more.
 
- my math professor
Last time I checked 0 is neither even nor odd.
 
11:56 AM
"The notation for null matrices that we'll use is a capital zero." - one of my math professors.
 
Ell
@sehe heh :L
 
@Jefffrey what?
 
What what
 
Zero is even.
 
user3010322
char8_t would be nice.
 
11:57 AM
It's a multiple of two.
 
Oh, well. Nevermind me then.
 
@ThePhD int8_t.
 
 
That's char :S
 
I wonder what kind of malfunction makes a site appear like... this ^
 
11:58 AM
@R.MartinhoFernandes Exactly.
 
'An even number is an integer which is "evenly divisible" by two. This means that if the integer is divided by 2, it yields no remainder.'
 
@sehe letter-spacing
 
@sehe Science spending.
 

« first day (1412 days earlier)      last day (3537 days later) »