« first day (2053 days earlier)      last day (2895 days later) » 

user1804599
8:00 AM
How are you going to represent a linked list?
 
@QPaysTaxes you can use a stack as a heap.. but that doesn't change the problems of GC
 
user1804599
User inputs a number of integers and I want to store them in a linked list.
 
user1804599
How do I create the linked list?
 
user1804599
You can't do that on the stack.
 
user1804599
Even if you could, it would make for a very painful stack layout.
 
Ven
8:02 AM
ahoy
@rightfold Kleisli ftw
 
user1804599
And what would happen if you remove the second list node from the stack without removing the first list node? And then traverse the list? Oops!
 
user1804599
Kleisli arrows are super rad.
 
lol.. imagine tree implemented as a stack
 
user1804599
References are easy once you have a GC.
 
References are easy, full stop.
 
user1804599
8:05 AM
Reference counting is very easy to implement, but you have problems with cycles.
 
It's object lifetimes that are hard.
 
user1804599
3 mins ago, by rightfold
And what would happen if you remove the second list node from the stack without removing the first list node? And then traverse the list? Oops!
 
user1804599
Lifetimes.
 
user1804599
The pointer outlives the pointee.
 
User a pool allocator.
Or Boost Intrusive trees.
Or both.
 
8:06 AM
@QPaysTaxes you don't know what lifetime is?
 
I'm off to the office
 
user1804599
@sehe Just target V8 or Lua and call it a day
 
:D Sleep well
 
user1804599
Oh cool
 
user1804599
returnA works for both functions and Kleisli arrows.
 
8:22 AM
yes, hang on
@QPaysTaxes have a look
 
Ven
Of course, clang sanitizers need all the dependencies of your project to be compiled with the sanitizers as well....
 
@QPaysTaxes yeah, examples of such include std::vector<X>::value_type and std::unique_ptr<X>::element_type and so on
 
@Ven Wasn't that the deal only with memsan?
 
yes
inb4 typename/template
@QPaysTaxes maybe, depends what thing is
oh then no
 
Ven
@Griwes we're using address sanitizer
 
8:28 AM
has to be A<int>::T_type or decltype(thing)::T_type if you’re so inclined
 
@QPaysTaxes I don’t follow, but that’s because typename is a keyword in C++ and I have a feeling that’s not what you meant
@QPaysTaxes I don’t know off the top of my head tbh
 
user1804599
@Ven use clang as the C and C++ compiler, and add -fsanitize to CFLAGS in /etc/portage/make.conf, then rebuild everything with emerge -uDav --tree world.
 
Ven
drugs were taken.
 
user1804599
@Ven stropping master race
 
user1804599
8:31 AM
CoffeeAlgol
 
Ven
:D
 
user1804599
@Ven they still haven't fixed throw throw x although the output has changed from throw throw x; to throw throw x;;.
 
Ven
template<typename T>
void apply(std::function<void(T)> fn, T& value)
{
  value = fn(value);
}
apply(uppercase, a.b.c.str);
</rightfold>
@rightfold oh, cool one
DIHWIDT
@QPaysTaxes of course not, why would it?
 
user1804599
@Ven you shouldn't do that with std function
 
user1804599
template<typename F, typename T>
void apply(F&& fn, T& value)
{
  value = fn(value);
}
apply(uppercase, a.b.c.str);
 
Ven
8:35 AM
@rightfold it really doesn't matter
 
user1804599
Do this instead.
 
user1804599
It's much more efficient.
 
Ven
@QPaysTaxes Doctor It Hurts When I Do This.
@rightfold lol duck typing
 
@QPaysTaxes it’s how you enable OCaml mode
2
 
Ven
@QPaysTaxes I'm sorry it didn't cause any of this.
:D
 
user1804599
8:38 AM
 
user1804599
The parser isn't.
 
Ven
??
@QPaysTaxes the where just isn't in the body
lies, utter lies and damned lies.
 
I suggest you stick to value initialization, e.g. foo_type foo {};
that value being what?
right, use value initialization
yeah
yup
 
user1804599
@Ven hey cool Rust playground has a MIR button which shows the desugared form and with all the automatic drops and moves inserted
 
user1804599
like GHC Core
 
8:47 AM
@QPaysTaxes 'binding' is used in the context of references normally, so it’s not needed here—the expression produces a temporary object and that’s it
@QPaysTaxes if f accepts a concrete type you can possibly do f({}), too
@QPaysTaxes yes, which is why I’m setting you straight
how else do you want to learn?
 
Ven
@rightfold oh, cool
it shows SSAF
 
@QPaysTaxes much the same return {};, can work instead sometimes
@QPaysTaxes but the chat transcript will be there
 
Ven
introducing bookmarks...
 
user1804599
ok so
 
user1804599
I'm not gonna do the C API of iron yet, instead I'm gonna do textual IR representation
 
user1804599
8:50 AM
How about XML?
 
user1804599
Or maybe YAML?
 
Ven
oh cmon.
 
user1804599
It has to be human-writable.
 
Ven
gee, son.
 
user1804599
@QPaysTaxes iron is a library I'm working on
 
user1804599
8:54 AM
It generates PHP code.
 
user1804599
Good, good. Let the hate flow through you.
 
Ven
minecraft is tough life
4
 
@Rapptz ping
 
whenever I'm stressed and want to relax I like to watch unedited footage of a bear
 
user1804599
9:12 AM
lol PureScript compiler is bad at lexing JS github.com/purescript/purescript/issues/2172
 
Ven
@rightfold have you seen that next versions of Perl might allow my ($x, \@y, \%z) = ...;? (i.e. buffer refaliasing)
 
user1804599
That already works with scalars, but no.
 
Ven
only \my @a exists
 
user1804599
I'm pretty sure my (\$x) = @_; $$x = 1; works.
 
Ven
9:27 AM
try it
 
nwp
programming languages should have the concept of sort_of_const
 
mutable
 
user1804599
@nwp what does that mean?
 
nwp
for example you have a list and want to find an entry in that list, then the find algorithm conceptually takes a constant list
 
Ven
..yes
 
user1804599
9:34 AM
Yes, it does not need to mutate the list.
 
well it should really take a range
 
user1804599
In C++ this works by implicit conversions to const&.
 
nwp
but in the implementation it adds the object to find as the last element to the list, runs find on it without having to check for the end and then remove the sentinel again
 
that's what mutable and const_cast are for.
but that's not actually correct
 
Ven
find [] x = Nothing; find (x:xs) x = x; find (x:xs) x' = find xs x : ^)
 
9:35 AM
imagine what happens if two threads are finding on the same list at the same time?
 
nwp
yeah, or the list is toplevel const
 
Ven
@nwp why do you care about implementation details
 
user1804599
@nwp that's a retarded algorithm
 
Ven
:D
 
or e.g. in the unusual case of exception?
 
user1804599
9:37 AM
The sentinel first of all has to be of the element type, which is unknown because good programmers assume parametricity.
 
nwp
I care about making a language that doesn't prevent useful optimizations by being poorly specified
 
that algorithm is certainly not a useful optimization in any way.
 
Ven
^
 
@nwp your sort_of_const is exactly_mutable
 
user1804599
@Ven What programming language is that?
 
nwp
9:38 AM
well, alexandrescu reported a speedup of 10% or so, which for generic algorithms such as std::find is worthwhile
 
Ven
@rightfold haskell with erlang-like name matching :P
 
there are several options to express the post-condition the_value_before == the_value_after though
 
user1804599
:'(
 
nwp
@LucDanton what is exactly_mutable?
 
@nwp Alexandrescu is a moron.
 
9:39 AM
@nwp the opposite of const
 
user1804599
@Ven I like Mercury:
 
user1804599
find(X :: Xs, X, X).
find(_ :: Xs, X, find(Xs, X)).
 
he probably neglected to consider the concurrent case, for instance.
 
Ven
oh yeah, that works in Prolog-style langs.
 
user1804599
It's not partial. It's semidet.
 
Ven
9:40 AM
well, you'll get all the answers
 
user1804599
No, you won't.
 
user1804599
You'll get the first one.
 
also
is find() really a useful algorithm?
seems to me like it's just filter and then head, more or less.
 
user1804599
No, it's broken entirely @Ven
 
nwp
the concept also works for algorithms such as lower_bound
 
Ven
9:41 AM
@Puppy it is
 
user1804599
It should be:
 
user1804599
find(X :: _,  X, X).
find(_ :: Xs, X, R) :- find(Xs, X, R).
 
2 mins ago, by Puppy
he probably neglected to consider the concurrent case, for instance.
 
Ven
@rightfold you don't reduce on Xs
 
@nwp why would you need to insert anything for lower_bound?
 
user1804599
9:42 AM
@Ven I do.
 
Ven
find(X :: [_, Xs], _, R) :- find(Xs, X, R).
 
and furthermore it's really a massive overspecialization of find() in the first place to require that you're looking for an element that's equal to another object of the same type.
 
user1804599
@Ven what
 
user1804599
that makes no sense at all
 
user1804599
:: isn't @ and , isn't cons
 
user1804599
9:43 AM
:: is cons
 
instead of just find that takes a function that returns if this element or not.
 
Ven
why didn't they keep prolog syntax :[
 
user1804599
Actually [|] is cons.
 
user1804599
find([X | _ ], X, X).
find([_ | Xs], X, R) :- find(Xs, X, R).
 
Ven
ah, that makes much more sense now
 
nwp
9:43 AM
@LucDanton I don't remember, it is somewhere in the talk linked a week ago or so
 
Ven
@rightfold though it's just a "is element X in Y"
 
user1804599
Yeah, and also return that element.
 
@nwp did that explicitly mention lower_bound or is that you extrapolating from the talk mentioning find?
 
Ven
you already have it, you supplied it. :P
 
nwp
@Puppy well that's what optimization does, it looks at the specific case and takes otherwise invalid shortcuts and a language should allow that as much as possible
 
9:45 AM
> no goto users are allowed in this room
I love Andrei's talks.
 
user1804599
:- pred find(list(A)::in, A::in, A::out) is semidet.
 
user1804599
Yeah, it's better to do it :- pred member(list(A)::in, A::in) is semidet..
 
nwp
@LucDanton I think it was extrapolating. Now I remember it was not about lower_bound, it was about the partition algorithm used for quicksort
 
@nwp Optimizing a rarely-useful algorithm in a rarely-useful case in a non-concurrency-safe way is not really an argument in favour of that stuff.
there's plenty of them, but that is certainly not one of them.
 
@nwp cos that doesn’t make too much sense, you get value out of lower_bound on a random-access or bidirectional sequence in which case the optimization doesn’t make sense; or it reduces to find
 
nwp
9:48 AM
@Puppy well you wouldn't hand-optimize everything like that, you would want to specify algorithms precise enough that a compiler can do it automatically, hence sort_of_const
 
right, but there's no way in hell the compiler can do that automatically, because it breaks the public interface in 99 ways.
 
Ven
yawns
 
nwp
@LucDanton yeah, the lower_bound thing was stupid, sorry
 
user1804599
cool Mercury has rewrite rules
 
user1804599
:- promise all [L, H, T] ( append([H], T, L) <=> L = [H | T] ).
 
9:50 AM
@Ven why didn’t they prolong the syntax
 
Ven
@LucDanton 0
 
I see that you are proshort
 
user1804599
Logic programming is wonderful.
 
user1804599
And with mode checking it's efficient too.
 
Hey folks!
 
Ven
o/
 
New favorite SO question:
457
Q: Undoing git reset?

drozzyWhat's the simplest way to undo the git reset HEAD~ command? Currently, the only way I can think of is doing a "git clone http://..." from a remote repo.

 
And helo
 
10:13 AM
Ah yes, git reflog, the most important git command in existence.
 
git relfog
 
Interesting how there's flog in reflog
like you're whipping Git
 
Ven
10:49 AM
Some gits need a whippin
 
user1804599
I like whipping
 
Xeo
I like whipping cream
 
user1804599
I want to try it one day
 
nwp
can I watch?
 
user1804599
I mean butt whipping
 
10:55 AM
@rightfold damn
 
Ven
11:10 AM
I'm gonna do Perl at work in a few weeks :D.
 
user1804599
Nice
 
hello friend
 
11:33 AM
@Xeo Is that like shaving cream but for whipping?
 
Xeo
@Borgleader are you trying to make a joke or have you never heard of whipping cream?
 
@Xeo Lame joke attempt yes.
I interpreted whipping cream as a noun, not the act of making whipped cream.
 
Xeo
it is a noun too
.. I think.
yeah it is
it's what you make whipped cream out of :P
 
user1804599
slagroom
 
11:48 AM
oh boy
 
huh, TIL, I just call that... cream =/
 
user1804599
@Ven is it possible to write a goto macro with sweetjs?
 
Ven
@rightfold C-style or C++-style goto?
 
user1804599
What's the difference?
 
Ven
crossing scopes
 
user1804599
11:53 AM
C++-style.
 
Ven
I'd say yes, but you're going to have to rewrite code agressively in your "label" macro
 
user1804599
hmm
 
why would you goto
whyyy
 
Ven
goto is good
 
For what?
 
Ven
I'll watch this movie one day.
 
:D
 
I want to assert that goto is bad
 
Ven
I assert you're wrong
 
I want to hear why O.o!!!
 
nwp
11:57 AM
assertion failure
 
<no response>
 
Ven
Because goto is obviously the best control flow structure.
Except for comefrom, but not enough languages have that.
 
i see what you did there
and I raise you a donger
 
Ven
you can ask @rightfold why goto is amazing
 
@rightfold LAMBDA WHY IS GOTO AMAZING
 

« first day (2053 days earlier)      last day (2895 days later) »