« first day (1260 days earlier)      last day (3674 days later) » 

6:01 PM
shit
why oh why did I consume that food.
 
Xeo
@DeadMG because otherwise you'd die?
 
sounds like a lose-lose proposition to me
 
Xeo
@MarkGarcia Hm, the Robot is 50 fucks behind (2796 vs 2746)
 
user1804599
I should write this down in a formal manner before continuing to prevent my brain from melting.
 
user1804599
It is gonna be fun when passing two arguments of interface static type to a multimethod that expects two parameters of indeterminate type.
 
user1804599
6:07 PM
Cartesian product!
 
@Xeo Fucking robot. ^^
 
Hello everyone
 
Xeo
Btw @rightfold, aren't multi-param type classes basically multimethods on the type level?
 
user1804599
@Xeo But no runtime polymorphism. :<
 
Xeo
maybe you could get some inspiration from that
like fundeps
 
user1804599
6:12 PM
In the past I was thinking of allowing type classes as types through CRTP. :P
 
user1804599
To some extent. But meh.
 
I need to make simple real life application on any data structure like Graph, Trees , Stack , Queue ,, any advice
 
user1804599
I never quite got how to do runtime polymorphism in Haskell.
 
user1804599
I know there is existential types but it’s not very flexible.
 
Xeo
@sabsab I need to make simple real life cheese, like Edamer, Tilsitter, Gouda, Gorgonzola - any advice?
 
user1804599
6:13 PM
@sabsab Use a queue to implement a downloader that downloads a single file at a time.
 
user1804599
User can add files to the queue at any time.
 
Xeo
@rightfold aren't those extremely flexible?
 
user1804599
@Xeo Dunno.
 
@rightfold sorry can you explain more I didn't git it
 
user1804599
Say I have a database that stores different kinds of content, say HTMLPage and PortalPage. I want to add more types easily later.
 
Xeo
6:14 PM
we're not here to give you programming ideas
 
user1804599
I’d have a function fetchPage :: PageID -> ???. I need runtime polymorphism!
 
@Xeo if you don't want to help so please shut the fuck up
 
user1804599
Existential typing to the rescue! class Page P where …; data AnyPage = forall a. Page a => AnyPage a (or w/e the syntax was).
 
user1804599
Oh hey let’s add a new operation to this thing; toHTML :: Page a => a -> String.
 
user1804599
But I cannot call it on an AnyPage!
 
Xeo
6:17 PM
right, operations need to be part of the type class
 
user1804599
:(
 
user1804599
This has really bothered me a lot.
 
Xeo
you have the same problem with OOP-style interfaces though, unless you have multimethods
 
user1804599
I mean, I could add toHTML to Page, but meh SRP.
 
user1804599
@Xeo Indeed. :D
 
user1804599
6:19 PM
We have this exact problem at work, with but PHP interfaces.
 
@Xeo extension methods?
 
user1804599
No runtime polymorphism.
 
Xeo
or not even multimethods, just free functions that allow virtual dispatch on the first argument
 
eh
 
okay... this is a bit odd and I think I figured out what was going on
 
user1804599
6:20 PM
@Xeo Oh, now I want to store different kinds of pages in different kinds of data stores, DB for production, RAM for unit testing. :P
 
user1804599
But yeah with some more indirection that could also work.
 
user1804599
But I prefer multimethods here.
 
Xeo
@rightfold that sounds like a simple Store interface
 
user1804599
Nope.
 
user1804599
public interface PageRepository {
    public PageID insertPage(Page page); // oops; requires ugly type switch
}
 
user1804599
6:22 PM
public interface PageRepository {
    // no dynamic dispatch :<
    // even then, not extensible with modifying this interface :<
    public PageID insertPage(HTMLPage page);
    public PageID insertPage(PortalPage page);
}
 
eh
you can't implement a new method for every possible implementation that ever implemented the old interface.
(also that's a terrible interface)
 
I was right from the start. All women, females are exactly the same. Worthless, LYING whore pieces of shit. Fuck you, Rainbow Dash
 
I'm in a comment war with a guy with 40k rep who's arguing that the right tool for the job of storing money as cents is unsigned int, and that "fixed point is the wrong tool for this job"
 
user1804599
So what I want is this:
 
@MooingDuck Did you tell him that using unsigned int for cents basically is fixed point?
 
user1804599
6:26 PM
meth InsertNode node repository : NodeID

impl InsertNode (node: HTMLNode) (repository: DB); …; end
impl InsertNode (node: PortalNode) (repository: Memory); …; end
 
user1804599
With runtime overload resolution.
 
@Griwes it's not, because unsigned gets conversions, multiplication, division, input, and output all wrong. It should be wrapped in a class
 
Xeo
@rightfold no type annotation on the multimethod itself?
 
I still don't see how this is going to permit you to extend interfaces without having to change all the implementations.
 
Xeo
seems kinda necessary
 
user1804599
6:27 PM
@Xeo Well, for the return type.
 
@MooingDuck The point is definitely fixed for unsigned int vOv
 
Xeo
I mean for parameters
 
user1804599
@DeadMG I don’t, and that’s not my point.
 
@Griwes at the wrong place, but technically you're right
 
then what is the point?
 
user1804599
6:27 PM
My point is extending interfaces without changing existing code.
 
user1804599
You can add new code, but I don’t consider that changing existing code.
 
@MooingDuck I never meant to be right more than technically on this one :P
 
user1804599
I.e. no manual type switches, no visitor patterns or anything like that.
 
so what you're basically saying is, "I want to replace type switches with a compiler-generated type switch", and it has absolutely nothing useful whatsoever to do with method overloading.
 
user1804599
@Xeo If you add a type for a parameter, then it won’t do runtime lookup on that argument.
 
Xeo
6:29 PM
meth Foo a b : r
impl Foo (a:T) (b:V) : r
impl Foo (a:X) (b:Y) : r
// T & X unrelated, V & Y unrelated
or does the first impl determine the interface for each parameter?
 
user1804599
Parameters with explicit type names on meths are static.
 
user1804599
@Xeo No. You can overload on any parameter type.
 
user1804599
There are no restrictions for that.
 
user1804599
It’s perfectly fine to overload Foo on both (Int, Double) and (String, User) if you want.
 
user1804599
You cannot overload on interface types, though. Only on struct types.
 
Xeo
6:31 PM
oh, ok. Because your last example used a baseclass TorX to pass either T or X
 
user1804599
So interface I; end; impl Foo (a: I) : r; end is illegal.
 
Oh FFS
533
Q: Why should I use a pointer rather than the object itself?

gEdringerI'm coming from a Java background and have started working with objects in C++. But one thing that occurred to me is that people often use pointers to objects rather than the objects themselves, for example this declaration: Object *myObject = new Object; rather than: Object myObject; Or in...

This question man
 
user1804599
Kudos to you for questioning this practice rather than just following it. Most of the time, pointers are over-used. — Luchian Grigore Mar 3 at 11:56
 
user1804599
Be proud of OP. vOv
 
I've seen this question when there were no answers and I just though: "Just another question about pointers, moving along". If only I had answered that I would be having so much reputation...
 
user1804599
6:33 PM
@Xeo I have no base classes, unless you consider interfaces to be base classes. :P
 
user1804599
For example:
 
Xeo
1 hour ago, by rightfold
meth f a b : int // dispatch based on runtime type of a and b
impl f (a: T) (b: U) : int { … }
impl f (a: V) (b: W) : int { … }
a: baseOfTAndV = random [makeT!, makeV!]
b: baseOfUAndW = random [makeU!, makeW!]
f a b // error; f T W and f U V not implemented
Right back at ya
 
user1804599
Lemme implement those types. Sec. :P
 
Xeo
What is baseOfTAndV, if not a base class?
 
user1804599
6:36 PM
It is an interface.
 
user1804599
Interface specifies which multimethods must be overloaded on which parameter types. _ denotes the implementing struct type.
 
user1804599
Interfaces are implicitly satisfied for now; though I’m not 100% sure if I want that (probably not).
 
user1804599
(! is same as (), except foo!.bar would be (foo ()).bar, not foo (().bar).)
 
We're seeing ~4-10x JavaScript performance speedup with SIMD.JS: https://01.org/blogs/tlcounts/2014/bringing-simd-javascript Landed in Firefox Nightly, soon in Chromium.
lel
 
user3010322
Mmm.
 
user3010322
6:45 PM
SIMD operations, hoorah.
 
So. What have you got for me?
 
user3010322
Drugs.
 
user3010322
More drugs than you can possible imagine.
 
Why would you compile bytecode to JavaScript? developer.mozilla.org/en-US/docs/Emscripten
 
user3010322
Because LLVM Bytecode doesn't run in a Browser.
 
user3010322
6:50 PM
But Javascript does.
 
user1804599
Emscripten!
 
So write JavaScript
 
Xeo
what kind of conclusion is that?
 
user1804599
I would implement styxc in Haskell, but …
 
I fail to understand why you would ever write C++, compile it to byte code, then compile the byte code to JavaScript, then execute the JavaScript. You would write JavaScript in the first place. No?
 
user1804599
6:52 PM
I would have trouble with stuff like recursive types. :V
 
user3010322
It's for people with preexisting codebases.
 
user1804599
No idea how to represent that.
 
Xeo
This card seems increadibly evil
 
user1804599
I could give every type an ID or something.
 
user3010322
And for people who don't want to learn Javascript.
 
6:53 PM
@ThePhD Still seems pretty derpy. How much application code can just be compiled into JavaScript and hey presto it does all the same stuff on a browser now?
 
user3010322
@LightnessRacesinOrbit People are trying that with Qt. I don't think it's at the point where it works as fully intended, but there are samples of Qt programs working in the browser.
 
i'm completely confused.
 
That's a bit like automating the conversion of PHP to French. It just makes no sense.
 
user3010322
Now, whether they're responsive or fast or useful.... I'll leave for someone else to decide.
 
user3010322
But the possibilities there, and it can only get better the more money/time people throw at it.
 
6:54 PM
@ThePhD I suppose if they can slot the final result into some Qt JavaScript API, then the differences in platform are abstracted away
Beyond that, it makes no sense to me
oh well
 
user3010322
I'm not saying I think it's useful either.
 
They do it, so people must have use cases shrug
 
user3010322
If anything, Javascript should compile to LLVM Bytecode.
 
now you're talking
 
user3010322
And there should be an LLVM bytecode runner for the browser.
 
user3010322
6:55 PM
But of course, Security Issues™
 
user1804599
Don’t interpret LLVM bytecode.
 
user1804599
AOT or JIT compile it to JS.
 
@ThePhD I've been saying this for ages.
they should cut the crap and just support LLVM IR directly.
 
user3010322
If you support LLVM IR, then you can program in the web for anything that supports LLVM IR compilation...
 
user3010322
.... I.E., every-fucking-thing.
 
user3010322
6:57 PM
C++, C, COBOL, Fortran, and all manner of other things.
 
user3010322
Doesn't Haskell have an LLVM IR compiler too?
 
yep.
 
Xeo
GHC has an LLVM backend, yes
 
user3010322
If I could write my websites in Haskell...
 
Xeo
you already can...
 
user3010322
6:58 PM
.... ;~~~; the dream gives me tears of joys.
 
user1804599
Fay!
 
user3010322
Fya?
 
user3010322
Hya!
 
user3010322
 
@Xeo If you wanna go Haskell -> LLVM IR -> Emscripten, I guess.
 
Xeo
7:00 PM
there are other ways
 
There's no need to go through Emscripten
 
user3010322
Haskell compiles directly to JScript?
 
user1804599
lol JScript.
 
Xeo
@ThePhD also, do you even know Haskell? beyond what is thrown around in the Lounge at times?
 
user3010322
@Xeo Maybe. >.>
 
user3010322
7:03 PM
I can sort of read Haskell!
 
Xeo
Write Tic Tac Toe in Haskell :P
 
user3010322
That counts, right?
 
user3010322
Tic Tac Toe is... is too boring to write!
 
@BenJackson: I don't think you can reasonably claim that this is "due to Stroustrup"; more like, it's down to common sense (regardless of the internal parse tree, which is highly irrelevant). And, please, for the love of god, don't give me that overrated multiple-declarations argument again. I've heard it enough and it's still entirely unconvincing. :-) — Lightness Races in Orbit 1 min ago
Here goes!
 
user3010322
I will instead write FizzBuzz. >.>
 
c++ sucks.
 
we know
 
I know we know :)
 
user3010322
But do we really know that we know?
 
yes.
 
user3010322
7:06 PM
Hm.
 
Absolutely.
 
user3010322
RealtimeAudioDevice, if you submit a big enough buffer,
 
user3010322
can take over a minute to chunk the big buffer into smaller chunks to play it in real time.
 
user3010322
So it'll block in that call for a whole minute.
 
user3010322
Since there's no other threads on the rPi, that's... not the worse thing that can happen?
 
user3010322
7:07 PM
Hm.
 
Keep us informed
 
user3010322
Hah. Sorry. :b
 
user3010322
new takes 8-12 ms. Unacceptibru.
 
is this still the "without optimizations" irrelevance
 
user3010322
Well, yes.
 
user3010322
7:13 PM
But new times wouldn't really change from debug to release, would it?
 
er, of course it would...
memory allocations is one of the things most affected by debug vs release.
the debug heap is full of debugging machinery to catch heap corruptions, double frees, and similar.
 
user3010322
Ah.
 
user3010322
Well, even in the case of just a plain heap, I'd still have to ask the operating system for data. I think it might be better if I front-load the request by allocating some 100 MB ahead of time.
 
user3010322
A memory buffer, so to speak.
 
you're designing your program based on debug timings.
 
user3010322
7:15 PM
Memory pool?
 
user3010322
Memory arena.
 
you know that's fucking insane, right?
 
@ThePhD No. -O3.
 
ah, now at least 52 fucks ahead of robot.
 
user3010322
Alright, alright.
 
7:16 PM
robot, why didn't you tell me the Mainsail has such great TWR?
 
user3010322
Turning on O3, waiting until this shit finishes compiling. ._.
 
user3010322
........
 
user3010322
u______________u I REMEMBER WHY I WASN'T USING RELEASE
 
user3010322
IT HAS TO RECOMPILE THE UCD
 
I could'nt understand what vector is? I've no idea about it. — user2922683 1 hour ago
blah
 
user3010322
7:17 PM
Do you know how long that takes on release?
 
user3010322
HOURS. HOOOURS MAAAN.
 
@ThePhD Unicode Character Database?
Urine collection device?
 
user3010322
The first one.
 
Universal Child Database? (not sure why you're compiling that, son)
 
I don't know why you bother recompiling something that 1) doesn't change; 2) you don't use.
 
user3010322
7:18 PM
I do use it!
 
user3010322
And it changes when I change buffer_view sometimes.
 
Aren't you doing some DSP thing?
 
user3010322
I haven't compiled in release for a long time.
 
user3010322
Inbetween that time, buffer_view got changed with all the bounds_iterator and bounds and index crap.
 
user3010322
So, UCD got affected.
 
7:19 PM
How do you use the UCD for DSP?
 
user3010322
I don't use it per se; it's just part of Furrovine since the string implementation relies in the ucd:: stuff, and the ucd:: stuff has all the unicode properties in it.
 
Sounds like a good reason to me
Spend three hours recompiling something you don't use and that hasn't changed, because you need it for a string library you don't use either
 
sounds like Furrovine has a painful monolithic problem.
 
@rightfold: Did you eventually read that book on use cases? Is it worth buying?
 
Try adding a macro to Furrovine that disables those functions.
Or, y'know, don't require that it all be linked in
 
user3010322
7:21 PM
I could split Furrovine up into modules.
 
Yes you could
 
@LightnessRacesinOrbit Yeah, better to just separate it out into proper submodules.
 
user1804599
@AndyProwl Oh, I haven’t read it since ages.
 
user1804599
I’ve been too busy.
 
I see
 
7:22 PM
@DeadMG Agreed
 
@DeadMG I bothered him before about it. He pretended it didn't matter.
 
user3010322
Whaat
 
it quite clearly does.
 
user3010322
Hey, you all bothered me about using Unity builds, not splitting it up into submodules. :cc
 
user3010322
At least, I don't remember...
 
7:22 PM
er, we did?
 
user3010322
Well, in either case. Uh. I can't really separate the string implementation since it's fully templated.
 
it's one thing to not split it up as far as it'll go, I have parts of Wide that are like, concurrency helpers and stuff, but it's another to not split it up when some components have fucking huge dependencies.
 
user3010322
The UCD has its own module (Furrovine++.Ucd.dll), but it relies on some common core template classes (e.g., buffer_view).
 
Then why is this even a problem? Just don't include the string header
 
user3010322
7:24 PM
@LightnessRacesinOrbit Uh. Furrovine as a whole depends on Furrovine++.Ucd.dll, so.
 
user3010322
Really it only recompiles because I changed buffer_view.
 
user3010322
Because Furrovine++.Ucd.dll uses buffer_view to store large contiguous arrays.
 
user3010322
7:26 PM
Of characters and other stuff.
 
@R.MartinhoFernandes I suggest: incremental re-analysis and recursive type inference are the same problem, give or take.
 
o.O
Well, good luck!
 
user3010322
u.u;
 
user3010322
If I never change buffer_view again (I shouldn't),
 
user3010322
then it should be all okay
 
Xeo
7:27 PM
@DeadMG you might want to get rid of the habit that you tend to reply to totally unrelated messages if you introduce a new topic
 
eh
I was just gonna do my usual "robot: x" format, but I figured it's getting a little old.
I think he's starting to ignore me anyway
 
Xeo
you do the fake-reply all the time
 
really?
well, my bad then.
 
Xeo
ye
 
@DeadMG What is this about?
 
7:28 PM
well I was thinking about implementing incremental re-analysis in Wide.
and it seems to me like it's logically the same problem as recursive type inference.
 
That's interesting. How so?
 
in both cases, you can't be certain that the facts you have right now are going to stay that way.
for example, if I have f() { local := 5; if (true) return null; return &locall; }.
when I'm analyzing my return expression in the if branch, I can't assume that f() actually returns decltype(null), because it might change later.
 
@DeadMG Sorry, it's just that I've had too much on my head lately, and too little time to handle everything. It's not you, it's me ;)
 
and this would be the same if I had, say, f() { if (true) return null; return g(); }.
if g()'s return type is changed, f()'s return type is changed, so when I'm looking at return null; I can't assume that I actually know what f's return type actually is.
 
@Xeo Yeah, cheese is a bit hammy
 
7:32 PM
@DeadMG You need it to be multi-pass, or to accomodate incomplete information.
The latter is probably better.
 
@R.MartinhoFernandes Oakydoaky.
 
Xeo
@DeadMG Just let it be Pointer(T) until you know more.
 
@DeadMG Is this why C++ only cares about the first return statement?
 
@Xeo That assumes that there's no other useful things that null might be converted to.
 
Xeo
(i.e., have it work like Nothing in Haskell and have null be polymorphic!)
 
7:34 PM
@LightnessRacesinOrbit Give or take.
 
cool
I got something!
 
Xeo
@DeadMG Are you saying null might not just be for pointers?
 
well, I've been wondering about whether I really want separate null objects/types for everything nullable, like optional, as well as pointers.
 
Y'know, I always found "more or less" to be an interesting phrase. If I say to someone "the number of children you have is three, right?" and they say "more or less", I am supposed to interpret that as "you are at least approximately correct". But, really, all that person has done is entirely rejected the idea that I may be spot on, so they actually said "no, it is not three. It is either more or less than that". Stupid language.
 
Xeo
then have it be of type Nullable t => t
and specialize later on
 
7:36 PM
@DeadMG I think it's a good idea.
 
@R.MartinhoFernandes What, having them all be the same null?
 
Xeo
in either case, let it be polymorphic
 
or keeping them separate?
 
"Give or take" is far more sensible.
 
@DeadMG Yes.
@LightnessRacesinOrbit "Give or take" is adjustable.
 
7:37 PM
"More or less" presumably originated as something like "yes, if one accounts for a small adjustment resulting in either more or less"
 
"Give or take a few", "give or take a lot" (ok, no)
 
@R.MartinhoFernandes Right :) Jinx
 
@LightnessRacesinOrbit I always considered it to be, "You are essentially correct, but there are some details about which I feel you don't need to know or care."
 
@R.MartinhoFernandes: Your note about broken Visual Studio <chrono>, does it include Visual Studio 2013?
 
7:38 PM
@Xeo I actually don't see how that's supposed to work. How could you call a function returning a Nullable(T) for some random T where you have no idea what it is?
 
@DeadMG That's what it means colloquially, but if you look at it as a language lawyer I mean
 
I mean, what would decltype(f()) be?
 
@DeadMG Didn't you have some sort of concept thing?
 
It's kind of a strange idiom
@DeadMG decltype(null)
next problem
;)
 
@VáclavZeman That's the only one I tested.
Mixed arithmetic doesn't work.
 
Xeo
7:39 PM
@DeadMG Propagate the polymorphicity until you can specialize :D
 
@R.MartinhoFernandes OK.
 
@R.MartinhoFernandes I did, but T isn't arbitrary or unknown; it has to be either a value or a constraint. And furthermore, you cannot have values of concepts themselves; only types derived from concepts. In this sense, what's being suggested seems kinda like having a value of an abstract interface.
 
> As recently as 2007, the [colour] term nigger brown reappeared in the model label of a Chinese-made sofa, presumably from an outdated translation source.
 
@Xeo This just seems like propagating the problem :P
 
Xeo
well, you'll have to specialize at some point
 
7:44 PM
@DeadMG Can't T just be a template argument?
 
@R.MartinhoFernandes Sure; but then the function that instantiates the concept cannot not provide T.
 
Xeo
really, if f returns Nullable(T), and g calls f, how is that different from g using null directly?
 
well, right now, I've used a system not unlike C++'s nullptr_t.
 
Aaaaaaaaaaah
 
Xeo
right, with conversions
so change that :P
 
7:47 PM
I dunno
I feel like there's a difference between "This expression's type might be determined elsewhere" and "This expression does not have a useful type".
@R.MartinhoFernandes Oh wait, I just realized what you actually meant.
 
Xeo
I find Nullable t => t to be a perfectly usable type :p
 
there's no logical reason why not, except the callers didn't provide one.
 
You don't have type deduction that can pick return types?
 
you can't infer the return type of f() from it's uses, no.
brb
 
Say Optional(int) = f() would call the Optional(int) f() specialisation.
 
Xeo
7:50 PM
of course, since Nullable has only one fully polymorphic member null, I don't think you're going to see that type all that often anyways. You'll rather see the specialized Pointer(T) and Optional(T) (etc) types.
If a function has, after full analysis, still Nullable t => t as it's return type, that would be pretty useless, I find.
of course during analysis, especially with (mutual) recursion, that is another topic.
 
@R.MartinhoFernandes Now consider something like Optional(int.pointer) = f().
did I just empty my optional, or did I just put inside it an empty pointer?
 
Xeo
empty optional
 
and furthermore, how do I even describe a function which takes null as a valid parameter?
@Xeo How do you define that? operator= for Optional(T) has two overloads taking a valid nullable type, when T = a nullable type.
 
user1804599
> So we should write our own [lexer], because it’s easy, right? Anybody can write code—especially programmers.
 
user1804599
lol
 
Xeo
7:56 PM
I'd consider that to make the most sense, so rather arbitrary, I guess? I'll give you that overloaded assignment makes that interesting.
@DeadMG However, don't you, again, have the same problem with Optional(int.pointer) = null, even with the C++-style null_t?
 
well, Optional can make the choice here by providing operator=(null_t) and then implementing that however they choose (which would probably mean empty optional so that it's consistent across all instantiations).
 
Xeo
I'd also consider that to set an empty optional, and only Optional(int.pointer) = Just(null) to set an engaged optional with null-pointer
 

« first day (1260 days earlier)      last day (3674 days later) »