« first day (1570 days earlier)      last day (3381 days later) » 

@FredOverflow saw that, he makes a good point
both about haskell and writing code dealing with untrusted data very carefully
 
@corvid We don't objectify people here.
 
Ell
@FredOverflow I like this
 
Unless they are women, that is.
 
how do you people think JVM does catch NullPointerException? In C dereferencing a null causes segfault but segfault doesn't have to mean that null dereference occurred, so?
 
7:06 PM
By checking before dereferencing?
 
so you think they check for null every time reference is used?
 
Ell
@mrpyo the jvm checks it
yes
unless it can be certain that it's not null
 
seems excessive, but I guess simple check like this is cheap...
 
user1804599
hahaha null
 
checking for 0 is 1 machine code operation IIRC
there's a specific function for checking if a memory location contains zero
 
Ell
7:10 PM
it's called cmp.
 
I was expecting eqz
and nez for != 0
HI PUPPY
 
@mrpyo It's easily optimized out in many circumstances.
good evening inferior beings and also robot.
 
user1804599
D code and legacy Eiffel code just segfault.
 
clearly the best option is to check by default but permit unchecked use.
 
Haskell too
I guarantee you.
 
7:12 PM
Wide just segfaults at the moment (if you can get it to compile a pointer de-ref in the first place...)
but I will add a check in a future version
 
haskell has nulls? doesnt it force you to use option type?
 
user1804599
In my language it's impossible because there is no null HA I WIN.
 
you have no optional type?
 
user1804599
I sure do.
 
then there you go
 
user1804599
7:13 PM
But that incurs a wrapping.
 
null.
 
user1804599
No, null is different.
 
option type can force a check
 
user1804599
The opposite of null isn't boxed.
 
boxing is irrelevant.
 
user1804599
7:14 PM
It's very relevant.
 
it has absolutely nothing to do with the situation at hand.
 
checking for stuff in debug mode is really not a problem
 
user1804599
You cannot say let x: T = None.
 
user1804599
You can only say let x: Option T = None.
 
right, so None is clearly null.
 
user1804599
7:14 PM
You cannot say let x: T = Some 42.
 
user1804599
You can only say let x: Option T = Some 42.
 
user1804599
It's forbidden to access a field on None.
 
user1804599
You have to check it.
 
right.
 
user1804599
You can't say let x: Option User = …; print x.name.
 
7:15 PM
so you totally have null and instead of segfaulting or throwing, you make the user check for it.
 
user1804599
Which is not my understanding of null.
 
glad that we could dance around the issue pointlessly for 10 minutes and then get to the core of the matter.
 
@Puppy null is the same in the sense it expresses lack of value. But usually name null is used in context of language where every reference can be null
 
user1804599
My understanding of null is that T can be any normal value of type T as well as null.
 
@mrpyo C++ has nullptr and you can't make a T& be nullptr
 
7:16 PM
@Pris drama actors, the lot of you :)
 
there are languages where references cannot be null
 
user1804599
Boxing is essential for making it a proper functor and a proper monad.
 
user1804599
Without it you can't have Some None.
 
@рытфолд Which is exactly the situation of Optional<T>- it can be any T or null.
 
user1804599
@Puppy No.
 
user1804599
7:17 PM
Optional<T> is not T.
 
user1804599
I talked about T, not about Optional<T>.
 
which is completely irrelevant.
 
Ell
But with nullable you can't use T without getting out of a box
 
because you still have to have some semantics for what happens when your Optional is null and you're trying to act as if it wasn't.
 
Ell
whereas optional you have to get a T before trying to use it
 
7:17 PM
which is what we are discussing.
 
user1804599
With null I am referring to an alternative value of type T.
 
I see
so when you say null what you really mean is "Some arbitrary subset of actual null usage that's completely the same as all the other uses"
 
user1804599
Instead of a proper good wrapping type.
 
I'm home, yay
 
@Jefffrey you've created a well behaved drone!
 
7:19 PM
the semantics of how you decide what can be nulled or not is irrelevant as to what you do when a thing you have decided can be null is null but you want to get the value out.
 
@sehe Yeah, I'm scared of that.
 
unless you decide that nothing can be null, which you haven't.
 
@Pris his hair is fabulous
you suck
 
user1804599
What the fuck.
 
user1804599
Why are there ads on Stack Overflow.
 
user1804599
7:19 PM
I use goddamn AdBlock.
 
maybe they bough a place on whitelist
 
ad companies evolve defence against adblock
 
I mean ad providers
 
@рытфолд is it up to date?
 
@AlexM., yes like a fabulous muppet
 
7:20 PM
@Puppy One crucial difference is that null is often a language feature, while optional types don’t have to be.
 
user1804599
woot
 
user1804599
AdBlock has this setting:
 
user1804599
> Work around Hulu.com videos not playing
 
@LucDanton I don't really consider this important.
 
user1804599
I hope this makes Hulu available to me.
 
7:21 PM
@Jefffrey i'd point out that it's likely perfectly fine. it's even useful if you specifically don't want the inner code to (accidentally?) touch the outer x
 
iow optional types are 'no tricks up my sleeve' plain, null is not
 
But I'd tell her to be aware of the pattern
 
user1804599
@Mgetz Yup.
 
there's nothing tricky about null.
unless you do something tricky.
 
null is evil
 
7:22 PM
@Puppy That’s a world of difference.
 
you can do tricky things with optionals too if you like.
in fact you can plain just do tricky things with libraries.
half of exceptions is implemented as a library... in fact, substantially more than half.
so there's certainly no guarantee that just because a library is involved there is no seriously funky shit going on
 
@Puppy That’s nobody’s point, stop DeadMGing.
 
user1804599
I just found this: i.imgur.com/ciQaI5E.jpg
 
@Puppy of course if you use optionals everywhere instead of using non-nullable references when you can then there is no difference to the language where you just have nullable references
 
if it's 100% no-tricks it wouldn't need to be a language feature
 
7:24 PM
@LucDanton Then I don't know what your point is.
 
That there is a fundamental, language-independent kernel of interestingness and relevantness to 1 + a that makes it stand out from null.
 
user1804599
@sehe I like when it's the other way around.
 
That’s it.
 
@sehe Tell that to stuff like D's hashmaps, or C's complex types. People implement things that should be library features as language features all the time.
 
Ell
@Puppy which is wrong, right?
 
user1804599
7:25 PM
Fun fact: calling a parameter in JavaScript disables a shitload of optimisations because the parameter may be eval which can fiddle with the current scope.
 
@Ell Right.
 
user1804599
Unless you're a good boy and use "use strict";, of course.
 
@LucDanton I don't see it.
 
I’m sorry.
 
 
7:27 PM
repost
 
about js
 
@mrpyo I'm fairly certain I saw that yesterday.
 
@EtiennedeMartel repost
 
You're a repost.
2
 
magic world of dynamic typing
 
7:28 PM
that's stupid typing, not dynamic typing.
you can't do that shit in Lua I believe.
 
user1804599
It has nothing to do with dynamic typing.
 
at least, not quite in the same way.
 
user1804599
You can't do that shit in PHP.
 
in PHP the same expression would give two different results.
 
user1804599
PHP doesn't use + for string concatenation hurray!
 
7:29 PM
@рытфолд Oh, you can do worse things.
 
user1804599
Wait till I finish my compiler and VM.
 
user1804599
Then you can enjoy programming again.
 
to me interpreting string as a number (without programmer telling to do so) is just retarded
 
@рытфолд writing a compiler for python?
 
user1804599
No, lol Python.
 
user1804599
7:31 PM
I said enjoy not be terrified by.
 
if ("false" == 0) echo "true\n"; // => true, wtf - does it work like that in PHP?
 
poutine is like putina in romanian which means toilet
or rather the one outside
shack-like shithole
 
Ell
@Puppy How don't you see it?
Try making references nullable in c++
well.
 
user1804599
7:37 PM
@Ell That would not be very difficult, but extremely dumb.
 
optional<T&> works just fine as far as I am aware.
or at least you can make it work if you want to.
I don't really see the point except to support generic programming maybe
 
Ell
@Puppy That's not the same thing though right?
 
why not?
 
Ell
because you can't call member functions of T on it
 
oh noes, a whole extra de-reference?!
but my * key will cost a million dollars to replace!
 
Ell
7:38 PM
...
can you implement it or not?
 
@AlexM. "Poutine" is also how we transcribe the name of Russia's president in French.
 
by the same token, pointers in C++ are also not nullable, because you can't call members functions of the pointed-to type on them.
 
@EtiennedeMartel putina is also the name of putin's wife now that she married him
hehehe
 
IBM is giving out free poutine concocted by watson
truly we live in a glorious age
 
Ell
@Puppy okay try this
 
7:39 PM
Yeah, but it's in Toronto, and there's this rule that any poutine made outside of Quebec will suck ass.
 
Ell
can you substitute your Ts with your nullable of T?
I'm talking about nullable clearly needing language support btw
 
sure, just swap . with ->.
 
Ell
@Puppy it's not really substitution is it? :P
 
you don't want substitution.
 
Ell
if you have to change the implementation of the things you're calling
 
7:40 PM
at least, I don't want substitution in that way.
it simply doesn't make sense.
 
Ell
I don't know how you can say javas reference types don't have language support to check for nulls
who do you think does the checks if not the jvm?
 
don't believe I ever did say that.
 
Ell
Oh
my bad then :P
 
can C++ lambdas change a variable outside of it's own scope?
 
Ell
Sorry :)
 
7:43 PM
what I said is, there's nothing inherently interesting or different about language support for nulls compared to library.
which is only untrue if you permit direct substitution, which is batshit insane.
 
when developers and software engineers don't quite cut it anymore, you hire developer engineers careers.stackoverflow.com/jobs/73573/…
 
user1804599
You don't want -> either.
 
@mrpyo A non-local (to the lambda body) variable, yes.
 
-> is better than alternatives
 
user1804599
Eiffel had null initially but they fixed it.
 
user1804599
7:45 PM
Now you're required to check before using nullable types.
 
so is it legal?: int x = 10; var some_lambda = () -> { x = 2;} (I don't know C++ syntax, sorry)
 
yes, if you capture x by reference
 
user1804599
Using assertions or conditionals.
 
auto some_lambda = [&x] { x = 2; } in C++
 
user1804599
auto some_lambda = [=] () mutable { x = 2; } also works.
 
7:46 PM
lol no need to star that
(unless there's a blatant mistake, in which case it's fine to star it by definition)
@рытфолд it does not "work" :P
 
if you don't want it...
 
user1804599
FUCK
 
user1804599
WHY DID NOBODY TELL ME FOSDEM WAS IN BRUSSELS I THOUGHT IT WAS IN LOS ANGELES
3
 
user1804599
FUCK FUCK FUCK
 
@рытфолд because Brussels?
 
7:48 PM
@рытфолд You travelled to the US by mistake? That's impressive. Certainly beats robot's efforts.
 
it's belgium's most bleh city
 
@Ell Also, I can't name a single language that does support direct substitution.
 
user1804599
If I knew it was that nearby I'd have gone there.
 
user1804599
Eiffel and Hack do, but you gotta check first.
 
Ell
@Puppy I was talking about java really
I meant replicating java reference in c++
 
7:50 PM
which does not support direct subsitution.
 
Ell
all java references are nullable
aren't they?
 
yes, so it's impossible to substitute a nullable reference where a non-nullable one used to be.
 
@рытфолд Probably because they state it on their website? Kinda hard to miss.
 
@Mgetz "it's belgium's most bleh city" Wich is the nicest one? Considering a trip to belgium ...
 
Ell
@Puppy I didn't mean that
 
7:51 PM
@DieterLücking Which is exactly my point. You checked eof() after you know the extraction has already failed! Contrast: istringstream ss("a"); char ch; ss>>ch; assert(ss.eof()); fails the assert. — sehe 50 secs ago
WTF. I'm having to explain noobcake business about istream::eof() to Dieter Lucking?
 
Ell
I meant substitute an optional for a nullable in c++
where nullable is the c++ equivalent of javas references
 
@πάνταῥεῖ Bruges or Ghent
fuck all the rest
 
@πάνταῥεῖ HAHAHA you're asking an American, you think I know anything?
that is optimistic
 
well, you can substitute an optional<T&> for a T* if you want to, I believe.
 
user1804599
@Ell pointers.
 
user1804599
7:51 PM
Java references are nothing but nullable pointers without pointer arithmetic.
 
posted on February 02, 2015 by Scott Meyers

Today I got email about some information in Effective Modern C++. The email included the statement, "An expression never has reference type." This is easily shown to be incorrect, but people assert it to me often enough that I'm writing this blog entry so that I can refer people to it in the future. Section 5/5 of the Standard is quite clear (I've put the relevant text in bold): If an express

 
@Mgetz At least Tony answered ;-)
 
Ell
Right but you can't substitute this imaginary java equivalent for optional in c++
 
why not?
also it's not imaginary, it's called T*.
 
user1804599
Optional<T> in Java.
 
user1804599
7:52 PM
Never use null in Java except for interop with legacy code.
 
@Mgetz @sehe Should know.
 
user1804599
Always use Optional<T>.
 
This is one the primary reasons why experienced SO users aren't usually seen answering the simples.
 
-
 
user1804599
Everything.
 
Ell
7:53 PM
I'm not sure how to explain myself
 
The tiresomeness of having to go over the details with another "wannabe" or pedant is just to great
 
Ell
I know what I mean :L
 
Noun: myself (plural ourselves)
  1. that being which is oneself
 
that's because as far as I can tell you don't really have a rational position to explain.
every time you try to clarify it it makes less sense.
 
@рытфолд Nonsense! You just need to use it correctly, as everything else in programming.
 
Ell
7:54 PM
I'm saying
 
user1804599
You want the extra wrapping.
 
Ell
implement, without language support, java's references in c++ such that you can drop them in everywhere you take an optional in c++
 
user1804599
Otherwise you can't implement join.
 
user1804599
And nullable without join is just laughable.
 
user1804599
AHHAHAHAHA C#
 
7:55 PM
@Ell That makes no sense whatsoever, since optionals can express much more than pointers.
like optional<int> for example.
 
@рытфолд what is join in the context of nullables? You mean outer joins and stuff o.O?
 
Ell
I'm not talking about pointers >.<
 
that is exactly what java's references are.
 
user1804599
@sehe Nullable<Nullable<T>> -> Nullable<T>
 
pointers.
 
Ell
7:55 PM
you have to dereference pointers
 
@рытфолд Ah.
 
and you also have to de-reference them in Java, it's just hidden from you.
 
Ell
you don't have to dereference references in java
 
and you have to also de-reference optionals in C++.
 
user1804599
So
 
7:56 PM
and having an optional you did not have to de-reference would be batshit insane.
 
Ell
@Puppy right, it's hidden - try hiding the dereferencing in c++ without language support
 
and any lack of implementability is fantastic.
 
> (Rest assured, I didn't exactly invent this. It's quite a famous conundrum and pops up on SO every 20 minutes)
I'm quite happy with that addition
 
user1804599
Nullable<T> Join<T>(Nullable<Nullable<T>> x) {
    if (x.IsNull) { return Null; } else { return x.Value; }
}
 
@Ell You mean, "Try to do something totally insane, but randomly also pretend that your language is a totally different one"?
 
user1804599
7:57 PM
Assuming Nullable<Nullable<T>> is legal (ahahahahahah C#).
 
the task that you're suggesting doesn't make sense and then the relation to Java also does not make sense.
C++ does not hide de-referencing, there's no reason to want to hide it, and Java's hiding of it is irrelevant and has nothing to do with language or library support for optionality.
 
user1804599
Java doesn't hide dereferencing.
 
Ell
javas hiding of it is the point I was making
you can't implement that in c++ without language support
 
user1804599
It's explicit and called ..
 
user1804599
Except for this.
 
7:58 PM
right, except I don't want to do that and it doesn't make sense to do that in C++.
and also arbitrarily maintaining the . syntax even though it has a completely different meaning between the two languages completely does not make any sense.
and I don't use . to access optionals in C++ anyway so swapping them with pointers works just fine.
well, mostly.
so what I'm saying is that your point completely does not make any sense at all.
just in case you missed that.
 

« first day (1570 days earlier)      last day (3381 days later) »