« first day (2200 days earlier)      last day (2752 days later) » 

9:00 AM
Mmm, then I think here it's after you come back
 
@Ven For static analysis you have to assume that (because some other part of the code should enforce the invariants somehow).
 
user1804599
Types can reduce boilerplate.
 
I'm even more confused now
 
:D
 
user1804599
newtype Fix f = Fix (f (Fix f))
 
9:00 AM
@Ven What does (a : String) means there?
 
user1804599
@Shoe A parameter of type String, of which the value is known as a in the remained of the type.
 
Ven
@Shoe It's the parameter name. In the function's type signature. So that I can use that argument to call typefor
 
user1804599
The value-in-type part is what makes it a dependent type.
 
I see
 
user1804599
The type typefor a depends on the value a (which is of type String).
 
9:02 AM
Cool
 
user1804599
The concrete value a is not available until you apply the function getFor.
 
Type inference in Agda programs must be a bitch
 
Ven
You can't.
You can't have type inference and dependent types, really.
 
I figured
 
user1804599
Type inference is undecidable in dependently-typed systems.
 
9:03 AM
That's probably a pro, though.
 
user1804599
It is undecidable in even simpler systems such as System F.
 
@Shoe uh no.
 
At least people finally decide to write function signatures down
 
Ven
Got to go now.
 
@Shoe undecidable computations are BAD
 
9:04 AM
Alternatively, you could just have overloading... :D
 
@Shoe However, if you use SMT solvers with theories that are not undecidable it is not undecidable
@Shoe That's the premise of Liquid Types
 
user1804599
Overloading is much less powerful than dependent types.
 
Although the computation is already intrinsically within NP
@rightfold Am I making sense?
 
Vermillion is cinch right?
 
9:05 AM
Duh
 
user1804599
For example, with dependent types, you can ensure that the result of concatenating a list of length A and a list of length B is a list of length A + B.
 
@VermillionAzure So is integer addition.
 
@R.MartinhoFernandes Really?
Wait what
 
Heck, const 1 is in NP.
 
user1804599
With the following type: concat : (n : nat) -> (m : nat) -> list n a -> list m a -> list (n + m) a.
 
9:06 AM
Sure.
 
"This problem is in NP" is, most of the time, useless information.
 
@R.MartinhoFernandes You know what I mean -_-
 
@VermillionAzure No, I don't.
 
Ven
@rightfold those can be {} really.
 
user1804599
Even when n and m are not known until runtime.
 
9:06 AM
@rightfold How would you call that function?
 
@R.MartinhoFernandes SMT solvers are NP-COMPLETE
 
user1804599
@Shoe concat n m xs ys.
 
How's that
 
@rightfold Sure; though only the "runtime" part is what escapes, say, C++ ATM.
 
Ven
no
 
user1804599
9:07 AM
Not entirely; you can also have polymorphic recursion.
 
@rightfold But you would need to repeat the sizes, while they are in the type of the lists already
 
@VermillionAzure See, apparently not even you knew what you meant.
 
user1804599
@Shoe In Agda you can define parameters such that they can be inferred at the callsite.
 
@R.MartinhoFernandes Well I'm not super experienced dude. But I'm learning
 
@rightfold Hmm.
And contracts kind of (yeah I know it's not really) get us there.
 
user1804599
9:08 AM
That would be concat : {a : Set} -> {n : nat} -> {m : nat} -> list n a -> list m a -> list (n + m) a or something like that.
 
Ven
@Shoe you can have concat : {a : Set}{n m : Nat} -> list n a -> list m a -> list (n + m) a
the {} means "implicit argument"
 
@Ven Hmm. Why would you ever use () then?
 
user1804599
Because Agda can't infer everything.
 
Ven
@Shoe ...to pass an argument?
it's like type inference in C++. It can infer some types, you still need to pass arguments
 
user1804599
If you would have {} for all arguments to concat, you say concat, the compiler has no idea what arguments to pass.
 
9:09 AM
@rightfold Isn't that just template<typename a, int n, int m>?
 
user1804599
@Griwes No, because n and m may not be known statically.
 
@rightfold (Disregarding the runtime case for a second.)
 
No, I'm saying: why would you use rightfold's original version of concat as opposed to the {} one?
 
user1804599
@Griwes My message is older, try harder.
 
Ven
@Griwes you posted your message after @rightfold's.
@Shoe because it's easier to explain to you.
 
9:10 AM
Jeez, such an outrage.
:D
 
Ouch
 
user1804599
@Shoe To demonstrate the function to people who are not aware of implicit arguments. ;p
 
Ven
@Shoe no ouch. Showing new syntax at the same time as new rules isn't productive
 
Ok, now it's starting to make sense
 
Ven
it's like induction. you build everything up :P
 
9:11 AM
I guess that leads me to the final question
> Like multimethods, multi-parameter type classes support calling different implementations of a method depending on the types of multiple arguments, and indeed return types.
How does this make sense?
 
Ven
@Shoe what doesn't?
 
@rightfold And yes, I am aware that this doesn't work at runtime; I basically started with saying that this is the part C++ can't do. :P
 
Multi-parameter type classes are purely a compile time thing
How can they have anything in common with multimethods that do dispatch based on runtime values
 
Ven
class convert a b where
  convert :: a -> b

instance convert Int Str where
  convert = intToStr
 
@Shoe Have you heard the good news about forall?
 
user1804599
9:12 AM
class C a b c where f :: a -> b -> c
instance C Int Double Float where f = ...
instance C Text Nat Bool where f = ...
 
Ven
@Griwes you don't need forall
 
$ git checkout
Display all 1485 possibilities? (y or n)
 
Ven
guriwesu pls
 
This repo might have a bit too many branches.
 
@Ven You need for what I'm talking about. :P
 
user1804599
9:13 AM
Dependent pi-types subsume universal quantification.
 
@Ven And now?
 
Ven
@Shoe multi-parameter type class, yay?
 
What I mean is showing @Shoe how this also affects runtime effects, when you do forall to basically get polymorphically erased hierarchies out of typeclasses.
 
Ok, where's the runtime dispatch?
 
user1804599
@Shoe type classes work by passing vtables around
 
Ven
9:14 AM
@Shoe now, let's swap "Int" for "something that looks like an Int"
 
@Shoe Runtime dispatch is once you erase the type somehow.
 
Ven
 class convert a b where
  convert :: a -> b

instance Numeric N => convert N Str where
  convert = numericToStr
 
Hmmm
How would numericToStr be implemented?
It doesn't matter
It's a type class, it probably has a toStr function
 
user1804599
numericToStr :: Numeric n => n -> Str; so it obviously needs some method from Numeric to do the job
 
Ven
class Numeric N where
  numericToStr :: N -> Str

instance Numeric Int where
  numericToStr = intToStr
 
9:15 AM
The fuck do you care
 
Ven
/shrug
 
I was talking to myself
 
Ven
@Shoe does my explanation make sense?
 
user1804599
no
 
lol
 
Ven
9:16 AM
@rightfold thx bby
 
@Ven I still don't see the runtime thingy
 
user1804599
All you need for runtime dispatch is a vtable.
 
user1804599
Type classes work with vtables.
 
Why would they?
 
Ven
@Shoe if you have a "Numeric N => N", the type N is not statically known
 
user1804599
9:17 AM
It's just that the vtables are passed as hidden arguments, not as pointers in the values themselves.
 
Dispatch based on type classes is purely at compile time, no?
 
user1804599
No.
 
@Shoe How could it be?
 
user1804599
f :: Show a => [a] -> String
f = concat . map show
 
@Shoe Sometimes your functions are compiled before the types they will be used with are even thought of.
 
user1804599
9:18 AM
f knows nothnig about concrete type a
 
The concrete type a doesn't even exist yet.
 
user1804599
The Show a constraint is transformed into a normal parameter of type "vtable for Show".
 
user1804599
the caller decides which vtable to pass
 
@R.MartinhoFernandes What matters is that an instantiation of that exists when the function is called and the type a is inferred
 
user1804599
for f [1, 2, 3], it'll pass the vtable for Show Int.
 
9:19 AM
Similarly to templates
 
Ven
@Shoe wrong. Templates are not compiled.
 
I know
 
@Shoe Not everything gets specialized.
 
But they generate instantiations which are compiled
 
user1804599
No.
 
user1804599
9:20 AM
They pass vtables.
 
That seems inefficient
 
Ven
@rightfold he's talking about templates
 
user1804599
Haskell polymorphic functions are like Java generics.
 
user1804599
They are not like C++ templates.
 
I guess they could generate instantiations in the obvious cases where passing the vtable would induce overhead.
But that'd be an optimization.
 
user1804599
9:20 AM
There are optimization passes that perform specialization, but it is by no means required to do so.
 
Ven
@Shoe you can't do that if you take type-classed arguments
 
It's like if you were to tell me that some compiler implemented templates as vtables so that they could compile the templates themselves.
 
user1804599
In fact, in some cases, it's impossible to do that.
 
@Shoe Instead of struggling with the problems C++'s export causes, Haskell just takes the simple way out sometimes.
 
@Shoe Haskell is both superior and inferior to C++ in this case.
 
Ven
9:21 AM
@Shoe also imagine code-size if you had specialized everything everywhere
:c++:
 
user1804599
@Shoe In C++, templates must be specialized, because their specialization may affect the type checking.
 
@Shoe The problem is when you're looking across hard module boundaries.
 
It's superior because it gives you Andy's "virtual concepts", and inferior because devirtualization is a mere optimization, instead of a thing that's provided by default (like with templates).
 
Are you guys telling me that Haskell is a runtime mess?
 
Ven
9:21 AM
if by "mess" you mean "with different tradeoffs than C++ made" - yes
 
@Shoe Sometimes functions do get specialized for known types. Sometimes they don't.
 
No; it just does the right thing of not really specifying whether it's a runtime or a C++ thing.
 
Sometimes you can force the specialization.
 
user1804599
In Haskell, the body of a polymorphic function only has to be type checked once. In C++, the body of a template is type-checked every time it is instantiated (second phase in two-phase lookup).
 
@R.MartinhoFernandes How would you specialize in Haskell though?
 
9:22 AM
@Shoe The compiler does it. It's an optimization, like any other.
 
If you ask me, it's better, because the line between compile-time and runtime isn't as obvious as with C++.
 
user1804599
You can force the compiler to specialize your function.
 
There's a pragma to force it.
 
user1804599
Using a {-# SPECIALIZE foo #-} pragma.
 
I see
 
user1804599
9:22 AM
You cannot write custom specializations.
 
user1804599
AFIAK
 
But why would it specialize if you can't specify a specialization yourself?
 
user1804599
To make your program faster.
 
Does it invent a specialization out of nowhere? How would that be faster?
 
user1804599
No vtable.
 
9:24 AM
@Griwes If you've read that in what I said, you're either really bad at reading, or you're just a miserable starbait whore.
 
Oh wait
I see
 
@Shoe Devirtualization.
 
user1804599
It's like devirtualization that C++ compilers do.
 
@Shoe It's the compile-time dispatching thing you were talking about. Generate specific code for the type without passing vtables.
 
and FTR that's obviously not what I said or meant to those geniuses who starred that message
 
9:25 AM
right, I see
 
user1804599
f :: Show a => [a] -> String
-- becomes during codegen:
f :: Show_vtable a -> [a] -> String
-- specialized, it can be:
f :: [Int] -> String
-- note the absence of the vtable
 
You can't specialize functions from different modules unless the function is marked inlinable (different pragma), because the compiler normally doesn't keep enough information to produce specializations (essentially equivalent to keeping an AST).
 
Ven
@rightfold thank god :v
 
user1804599
:)
 
This is basically the C++ export problem. (Except C++ makes it so much worse)
 
9:27 AM
So Haskell does vtables to avoid the problems with compiling "templates", but in the end it instantiates specializations like if there was a template (sometimes)?
 
If it can, and the analyzer thinks it's worth it, yeah.
 
user1804599
@Shoe you can look at the output of the PureScript code to see how type class dispatch works: (click "Show JS"): try.purescript.org/?gist=8794db16ec542df8f2e306ad1557be7d
 
Go interfaces are the same.
 
Because generating specializations every time a program is compiled would be insane?
 
@Shoe Well, it's a similar issue as with inlining everything.
Sometimes doing the "optimization" everywhere is a pessimization because, well, CPUs don't work that way.
 
9:30 AM
right
But C++ generates specializations every time, right?
 
user1804599
It is required to generate template specializations, during type checking.
 
user1804599
However, devirtualization OTOH is not required.
 
Ok, I think I got it
Thanks all
 
Technically it could merge the ones with identical or similar code, but I don't think that's common (I'm not even sure any compiler even tries it).
With Rust traits you choose between dynamic and static dispatch (i.e. Rust crates include export information if you write statically dispatched functions, similar to GHC's inlineable pragma).
(static: fn f<T: Trait>(x: &T) vs dynamic: fn f(x: &Trait))
 
user1804599
Rust always does specialization though. But during codegen, not during type checking.
 
9:35 AM
> I opined that there should be a way to statically assert layout-compatibility, so that the error would be caught at compile time, rather than dinner time.
 
@rightfold Even if you use trait objects? I don't think so.
 
user1804599
@Morwenn offsetof
 
user1804599
@R.MartinhoFernandes Oh, no not then, but it does for parametric polymorphism.
 
user1804599
You get a monomorphization-time error if you attempt polymorphic recursion. :D
 
user1804599
9:37 AM
error: reached the recursion limit while instantiating `f::<std::vec::Vec<std::vec::Vec<std::vec::Vec<std::vec::Vec<std::vec::Vec<std::vec::Vec<std::vec::Vec<std::vec::Vec<std::vec::Vec<std::vec::Vec<std::vec::Vec<std::vec::Vec<std::vec::Vec<std::vec::Vec<std::vec::Vec<std::vec::Vec<std::vec::Vec<std::vec::Vec<std::vec::Vec<std::vec::Vec<std::vec::Vec<std::vec::Vec<std::vec::Vec<std::vec::Vec<std::vec::Vec<std::vec::Vec<std::vec::Vec<std::vec::Vec<std::vec::Vec<std::vec::Vec<std::vec::Vec<std::vec::Vec<std::vec::Vec<std::vec::Vec<std::vec::Vec<std::vec::Vec<std::vec::Vec<std::vec::Vec<std::
 
@R.MartinhoFernandes There's some magic experimental linker switches in GNU ld that merge identical functions (not just template functions) provided nobody takes their addresses, but I don't expect them to stop being highly experimental any time soon. (But again, that's on the linker level, not on the compiler level.)
 
user1804599
s/magic/sufficiently advanced/
 
same difference
 
Actually, the "experimental" modifier essentially means "not sufficiently advanced".
 
No, it means "don't come crying at our shoulder if this breaks your production code". :P
 
user1804599
9:44 AM
> When a distinguished but elderly scientist states that something is possible, he is almost certainly right. When he states that something is impossible, he is very probably wrong.
 
By this virtue everything is probably possible. :P
 
user1804599
No, it says probably
 
There, probably fixed now.
 
user1804599
> Any sufficiently advanced technology is indistinguishable from a rigged demo.
4
 
user1804599
9:54 AM
> An Iraqi refugee who was jailed after claiming it was a sexual emergency when he raped a boy
 
user1804599
> sexual emergency
 
amazing
nothing like rich foreign culture amirite
 
user1804599
Have him do forced labour in an amirite mine.
 
@BartekBanachewicz Don't worry, the locals make up stupid excuses as well. A while back it was some dude claiming he could not have been going around showing his penis to women because it was too small to be seen.
Though that was Germany, not Austria.
His wife even testified to that in court.
 
@R.MartinhoFernandes lol
 
user1804599
9:58 AM
Don't expose benis without permission.
 
@R.MartinhoFernandes I guess she just went with the story, however dumb it was
 
user1804599
> testified
 
user1804599
geddit
 
but yeah obviously all nations have their black sheep
 
@BartekBanachewicz IIRC the judge ordered a measurement.
 
10:00 AM
sigh
 
they must be really bored around there
 
user1804599
@R.MartinhoFernandes It should be repeatable, though.
 
user1804599
What if it grows?
 
In the US sometimes the excuse is that the boy had a great future ahead of him.
 
10:02 AM
wait what
oh you mean that swimmer guy
 
user1804599
Michael Phelps?
 
@rightfold One Brock Turner.
 
user1804599
Reminds me of that retarded New Zealand idea to introduce reversed burden of proof for rape cases.
 
user1804599
I recall they were "pretty sure" that it wasn't going to be abused.
 
@rightfold As in the plaintiff required to prove it didn't happen?
 
user1804599
10:09 AM
You accuse someone of rape, they have to prove they didn't
 
Oh wow, it being abused was their main worry?
How about going against presumption of innocence.
Also, you know why I don't bother to check if presumption of innocence is core tenet of NZ law? Because it's in the fucking UDHR.
 
You know when people swear the oath of office and all that ritual bullshit? They should be required to recite the UDHR by heart. And then again at the start of every legislative session, in unison.
Fucking idiots.
 
@rightfold Ok, now I want you to sign here for consent, or mini Python won't come out and play
 
user1804599
There must have been a sexual encounter.
 
user1804599
10:18 AM
> The presumption of supply is a rebuttable presumption in criminal law which is governed by the New Zealand Misuse of Drugs Act 1975. It provides an assumption in drug-possession cases that if a person is found with more than a specified amount of a controlled drug, they are in possession of it for the purpose of supply or sale.
 
I wonder, if people do colonize Mars, what would Mars people look like in 3 generations time ...
 
I mean different atmospher, gravity and food source would inevitably change some fundamentals of the humans there ...
 
@rightfold lol, terrible article, but the responses are amazing. No one makes much of the cyber ransom thing. It's good for Buttcoin!
 
10:25 AM
@R.MartinhoFernandes the ones great britain said they aren't willing to uphold?
@rightfold ugh
 
You know what? At least the DPRK quit the NPT before they openly violated it (so, technically they didn't violate it).
The DPRK takes international treaties seriously.
Ain't that amazing?
(And by "seriously", I mean they only violate them covertly)
 
nwp
I just abused md5 as a password generator.
 
@nwp You are such a pervert.
 
@nwp you don't have a proper cryptographically secure RNG?
 
MD5 isn't an RNG. I don't see the connection.
 
nwp
10:31 AM
@ratchetfreak I probably do. The idea was that I can recover the password when I need it again in a year or so.
The problem is I will have forgotten what I hashed, so it doesn't even work.
 
@nwp Wait what? Isn't the password the hash? What did you use MD5 for?
 
nwp
but there is an argument to be made to hash the "usual" password that one generates from the site name + some rule to be less obvious
or one could not be a badlet and just use a password manager, but meh
 
@R.MartinhoFernandes yeah, I think that's the idea
 
nwp
@R.MartinhoFernandes md5("password123").hexdigest()
that is the password, not some salting scheme
 
it still requires you to use different phrases though
so I'm not sure if I see the point
 
10:35 AM
presumably it's actually md5(siteName+"password123").hexdigest()
 
nwp
The point is that if I use "stackoverflowpassword" then one can pretty easily guess my microsoft password. If I hash them first it is much harder.
 
@ratchetfreak not very helpful over using "siteName + password" as the password
@nwp Smells like security via obscurity to me
 
s/md5/sha512/
 
well that's a reasonable first step
 
@BartekBanachewicz It is if you run it several times. It may not add entropy, but it requires an uncommon attack profile.
There are much easier targets around.
@ratchetfreak Hashing adds no entropy.
The only benefit of using a different hash algorithm is different speed (slower is better).
 
10:41 AM
the entropy is the single passphrase which gets concatenated with the site name. To crack the scheme you would need to brute force the passphrase, if long enough that's impossible. Then the site name is just a salt
 
If you come across a password database and everything looks like SHA512 hashes, you can map sha512 over your rainbow table and crack a bunch.
 
if you come across a password database you get a bunch of passwords
 
If most things don't look like hashes you can just crack the easy ones and go get more databases.
 
you don't really have to crack them at all then
 
Sam
Hey... Robot...! What's up?
 
10:43 AM
@GundolfGundelfinger yeah the HoT OST is the work of Lena Chappelle along with Maclaine Diemer (last remaining composer/music person at anet) and Stan LePard (who is external to anet I think). also I would have thought I linked some of the pieces before, but in any case part of the OST available on the official soundcloud
 
@R.MartinhoFernandes that's an interesting sentence to come into this room and read without any context
 
@BartekBanachewicz Well, hashes. The point is that this is a simple transformation of your rainbow table. (But it's probably not worth it unless enough people use this scheme)
Note that this depends on it being unpopular, not necessarily secret.
Picking a slower hash (or adding rounds of a fast one) makes the transformation worth less.
@ratchetfreak Yes, but if your password is already good enough, you might as well just slap the site name on it and call it a day.
 
@R.MartinhoFernandes that's presuming the site does password handling correctly
if not then it leaks your password for other sites
(this is I think the attack vector @nwp is worried about)
 
Ah, true.
Password manager is best. With 2FA devices.
Use head -c 1000 /dev/random | md5 for passwords :D
 
yeah, I just use a password manager and try to ensure I do so for every site
 
10:57 AM
The annoying thing with the password derivation scheme is that you need to remember website password policies somehow.
You password might have to be hash!A
And sometimes you'll run across some where it cannot be hash!A
It's just horrible.
 
but most sites will accept case-sensitive alphanumeric of up to (at least) 30 chars
so a base64 of a hash is nearly perfect for that
 
Still think that's too optimistic.
eBay used to have maximum 20 characters (up to 64 now).
PayPal too (now unlimited, I think)
 
i suspect this topic was discussed a lot of times before, but i want to ask: how do you feel about concepts not making it into c++17?
 
that then requires a little storage with the limitations per site (max length, allowed symbols (get some more entropy passed along), ...)
 
@ratchetfreak Oh, and sometimes you'll get "symbol must not be first nor last character".
I kid you not.
That's an actual rule from an actual website that handles credit card data somewhere within.
 
user1804599
11:09 AM
@user7023624 that would be great
 
So it might have to be "ha!sh".
 
@rightfold you mean if they made it?
 
user1804599
No, if they don't
 
user1804599
I think it is a bad idea to add more features to C++.
 
user1804599
Especially features so complex that nobody understands them completely before the next revision.
 
we kind of agree
 
C++ could do with some simplification revisions
 
@ratchetfreak that probably won't happen
except if you count things like removing register as simplifications
 
Ven
I mean, they are.
 
user1804599
11:31 AM
ugh, three editions of the same album, and when you shuffle the artist's songs, you get all those songs thrice
 
user1804599
good job spotify
 
user1804599
I want to learn how to use Emacs as my mail client.
 
Ven
@rightfold Org is amazing. It's not hard to use
 
user1804599
 
Ven
11:48 AM
 
nwp
I listened to some SO podcasts and they seem to think you will only need 1 login in the future. You just use your facebook/twitter/amazon/whatever account to login to any site. Cross site logins seem like a terrible idea to me, but so many sites do that nowadays.
 
the fuck
> Migrant, 20, claimed he raped the boy because it was a 'sexual emergency'
 
Ven
It's easier to steal people's shit that way
 
@nwp I'd be happy with this if this was truly giving you choice.
@Ven Single point of failure is already a thing in the current state.
It's your email account.
 
@R.MartinhoFernandes that's pretty dumb since they hash them anyway
@Abyx repost
 

« first day (2200 days earlier)      last day (2752 days later) »