« first day (269 days earlier)      last day (4665 days later) » 

2:00 PM
Due to strong typing it may or may not be endormorphic
 
I'll just go over there.
 
I don't know; perhaps there's an escape clause.
 
man
haskell already has compile-time function transformation?
 
I'm downloading Brian Beckman
 
2:01 PM
@DeadMG No.
There's Template Haskell though.
It's a GHC extension.
Which makes it pretty much standard.
There's little competition.
 
Anyone uses anything else than GHC, except for learning?
 
What? I learned with GHC.
Some of my colleagues tried Hugs once, but I believe that's kinda dead now.
 
Me too, but I saw some recommendations for that other one, which compiles to its own bytecode.
 
I'm using GCH, but that's different...
 
I don't even remember what it was.
Who cares.
 
2:04 PM
Precompiled headers :-) Very useful -- I was using Boost.GIL and spent 10 seconds on a "hello world" compilation.
 
Ten seconds? That barely gives you time to grab your paper sword!
 
Try Boost.Serialization.
 
Boost.GIL is so awesome and so painful at the same time. I feel like I'm in an abusive relationship when I use it.
 
Haha - haven't had the pleasure yet. One day maybe. Or maybe never.
 
hey, anyone has an idea of how big a full compiled boost lib would be in ARM?
 
2:06 PM
All I want is put some pixels in a grid and write out to PNG.
So GIL looked sufficiently straightforward, interface-wise.
But back on topic, I too would be interested to know if anyone uses Haskell productively.
 
CImg was pretty convenient for that kind of basic stuff
last I used it
header only, clean C++(ish) interface
 
lol Kerrek:"But back on topic..." jalf:"Here, let me go back off-topic" (for certain values of on- and off-topic)
 
@KerrekSB: I am sure that the Haskell site has some references. There are even companies doing mainly Haskell stuff.
 
darcs, the VCS, is written in Haskell.
 
I think darcs was the first DVCS I used.
It had a tonne of problems then, though. Maybe it's better now.
 
2:13 PM
> (...) exponential merges have been minimized. Unfortunately, bugs still remain in which the merging of recursive conflicts fails.
 
Interesting...
Hey, does anyone know about strict aliasing rules?
I want to know if I can ignore a warning.
 
yes
I know about them
 
You can always ignore a warning, duh.
 
I have our pretty printer, for which I can say, int x[12]; cout << x;
Now suppose I have a runtime array, int * a = new int[12];
To print without extra code, I can say, cout << (int(&)[12])a
But that triggers a type punning warning
Can this in any possible circumstance possibly lead to incorrect optimized code?
 
I believe that it would be undefined behaviour
whether or not you actually get something bad is, of course, another issue
 
2:16 PM
Isn't a dereference operator missing there?
 
but you're telling the compiler that a pointer to an int is actually a pointer to an array
 
Yep
Because new guarantees contiguous memory
 
but you can only legally point to an int with an int, or a char* or an unsigned char*
 
@MartinhoFernandes No, why?
 
@KerrekSB Because I got confused. I do that often.
 
2:17 PM
But am I not pointing to an int array with an int pointer?
 
you're pointing to an int
the type is int*, you're pointing to an int
the fact that there is more than one int there is irrelevant, in the C++ type system
 
I also suspect that Martinho is correct and that it 'should' be (int(*)[12]) (still UB mind you)
 
(Actually, the example is contrived, because the only time I'd actually really need a wrapper is if the array size is a runtime value.)
 
or dereference
 
No.
*a is an int, the same as a[0]. You can't cast that to int(&)[12].
 
2:19 PM
The prettyprinter takes U = T[N] as a container via const U &
 
you cannot cast it like that
not the least of which is that you've got no way of determining the size at run-time
 
@MartinhoFernandes What a weird argument. a is int*, the same as &a[0]. You can't cast that to int(*)[12].
 
You're agreeing or disagreeing with me?
XML is eating my brain away.
 
I think that what is intended here is actually a cast to int(*)[12], or equivalently and as you said previously, dereferencing a before casting to the reference type.
 
I'm lost amidst *s now, but a) cout << (int(&)[12])a does work, i.e. it prints 12 elements, and b) I was thinking like this: When I have int x[12], x decays to a int*. So conversely if I have a int*, I should be able to develop it into a int[].
 
2:22 PM
it does not work, it is undefined behaviour that happens to work
these are two very different things
 
Hmm. Sad.
 
and secondly, the decay from int[] to int* is only Standard-defined to go one way
 
And how you do print int* a = new int[foo()]?
 
Ignore decay. It's an implicit conversion but it's still a conversion.
 
it's an abomination that should be banned
 
2:23 PM
Hmm.
 
and anyone doing new T[x] gets what they ask for
 
@MartinhoFernandes At the moment I have a wrapper, cout << pretty_print_array(a, 12). Works for runtime sizes, of course.
@DeadMG Why what how what are they asking for?
 
Oh, much prettier.
 
But as I told STL, I am really afraid of having to remember names.
I just want to say << in any situation and get the right result
 
@Kerrek: Well, by using such a hideously type-unsafe system when there's a perfectly good vector to use, then any problems that result are their own fault
 
2:25 PM
So now this mostly works, with the exception of dynamic arrays.
The printer does for for static arrays thanks to the global functions std::begin() and std::end() about which I learnt yesterday.
 
I wonder if you guys are familiar with topcoder..
 
Say, if you're implementing a string class (which seems to be something popular), a dynamic array might be useful, no?
Any better alternatives?
 
yeah
vector
 
0
Q: Proper development environment for topcoder

NilsI tried out topcoder today. While I liked the problem I absolutely hated the Java editor they provide. So I ended up coding it in eclipse and the pasting it into the topcoder window. It also annoyed me that you cannot run all unit tests at once and the remote compilation times seem very high. I ...

Hello btw :)
 
String is basically a vector of chars with additional convenience stuff.
 
2:31 PM
@MartinhoFernandes I don't think so, Java has a much bigger standard library
 
FWIW I can get (int(&)[4])a (where auto a = new int[4]) to print garbage where dereferencing behave as expected.
 
So a direct comparison is not fair.
 
@Nils: He wasn't talking to you
 
yes he was
 
2:32 PM
@LucDanton Should it be auto * a = new int[4]?
Revival of the auto_ptr!
 
@Kerrek: auto can cope with both
 
It's the distinction between template<typename T> void f(T); and template<typename T> void f(T*); (it's the same rules).
 
@LucDanton How are you printing this?
@DeadMG I see
 
2:34 PM
@LucDanton It works fine for me
@LucDanton Do not say a[i] -- say std::begin(a) :-)
 
@KerrekSB GCC 4.5 on Ideone. My original code has a range-for.
 
ok, here's a question
in my language grammar, do I have to specify all the escapes and stuff in string literals?
 
Note my iterator microtrait to handle T[N]: https://github.com/louisdx/cxx-prettyprint/blob/master/prettyprint.hpp#L159
 
@DeadMG I'd expect escapes to escape.
 
?
 
2:38 PM
Say, "\"" should work.
Otherwise string literals suck big time.
 
sure
but do I have to specify all of that in my grammar?
 
Ohhh
 
You can be a little lenient and allow any character to be escaped, and maybe treat that later.
 
Sorry, you're right! It should be *a!
 
Say... "(\\.|[^"])+", maybe?
 
2:39 PM
(I never checked the content of the array, and since I didn't initialize it I just thought some random numbers where OK.)
 
@KerrekSB What? I was right all along?
I convinced myself I wasn't.
 
I think you were! Apologies aplenty!
 
Stop doing that.
 
just grabbed
L?\"(\\.|[^\\"])*\"
from the C grammar
 
So we have to say, int * a = new int[12]; cout << (int(&)[12])(*a);
 
2:41 PM
Well, 'have to' is strong here. I say it has more interesting results.
 
@DeadMG Yes, that's it. I forgot to exclude backslashes on the right. And forgot empty strings.
 
Comically, the type punning warning disappears and all is in order. D'oh!
 
except I obviously cut the L? part, since I definitely don't have that crap
 
DeadMG had it right all along.
 
of course I did
 
2:42 PM
:-)
 
UNDEFINED BEHAVIOUR is the right answer to nearly every question asking
the general rule is, if you don't know for sure it's defined, call it undefined and you'll almost always win
 
I meant about pointer to int and pointer to array -- is it still UB now?
 
Yes.
 
Oh.
 
yes, it's still UB
you can only point to an int with a pointer to an int, a pointer to character, or signed or unsigned character
anything else breaks type pun rules
 
2:44 PM
Puns don't have rules. Puns are like the wild west.
 
It it were applied to an int* that pointed to the first element of a static int[12], then maybe it wouldn't be UB but I don't want to crosscheck whether an int[N] is a standard layout type or C compatible layout or whatever and I don't want to crosscheck the C rules about this sort of things either. But since it's the result from a new expression there's no hope anyway.
 
pretty sure that it's actually called type punning rules and type punning
 
I see. That's a good way of putting it.
Btw, syntax overkill: int (&rrr)[12] = (int (&)[12])(*new int[12]); :-)
 
That's what auto& is for!
 
Frig, if that's how you have to write dynamic arrays to pretty print them, you're sacrificing pretty code, for pretty printing.
 
2:47 PM
Oh, right
Haha, true.
OK, I'm happy to accept now that it's UB, so none of this will be mentioned anywhere as recommended practice. Thanks!
 
Hi all
 
Ohh, valgrind gives me heaps of errors if I use even a single line of that stuff.
 
but you can still do dumb things in for statements
I don't have variable definitions as expressions, which they should be
 
Are there any blogs you all follow for algorithms ?
 
2:51 PM
@DeadMG To allow what, exactly?
Oh, for for.
 
things like
 
What's that -- a context-free grammar?
 
if(int i = GetSomeValue()) for example
I should hope so
I managed to cut typedef from the language too
 
What's the project? A new language, 'E'?
 
heh
I usually informally refer to it as "DeadMG++"
 
2:52 PM
@DeadMG You can just declare a new variable, right?
 
@Martinho: Not currently, you'd have to have variable definitions as expressions for that
 
Ugh, you added goto.
 
which I have just changed
hey, I hate goto as well, but it's not my place to tell you that your use of goto is bad or something
 
I see that you put empty catch blocks back in.
 
I'm not completely sure that it's context-free but I hope it is
yes
 
2:54 PM
@DeadMG it isn't? As language designer?
 
again, I think it would be better if they were cut, but
@jalf: Of course not
 
He is always saying that the language should not be telling you what you can or cannot do.
 
that's pretty much the point in designing a language. Any language is defined by the things it prohibits
 
you yourself gave the analogy of C++ as a shop selling candy
should the shop owner tell you that you can't eat too much at once?
 
If you're very young, yes, they probably should tell you.
 
2:56 PM
bars will do that, so think of c++ like a bar selling alcohol
 
@DeadMG nope, but the candy manufacturer is free to decide what kinds of candy to make
 
lol
 
especially if he decides to make lots of liquorice
 
what's function-call?
 
well, I believe that, whilst it's one thing to actively encourage the use of poor practice, it would be quite another to restrict things just because they can be used badly
 
2:57 PM
That would probably be better named as argument-list or something.
 
hm? I cut function-call, I think
 
You forgot to do search and replace.
 
yeah
 
Guess it's function-arguments now.
 
that segment doesn't need to exist anymore
 
2:57 PM
but my point is that any language, whether C++, Python, Lisp or your own, prohibits hundreds of features. That's what distinguishes languages, and cutting features is basically what language design is
 
variable-definition := ['static'] [type-definition] identifier [expression]
no, wait, that's still kooky
now you could do something like int i >> int x
 
Missing a =?
 
constructors?
 
Or double i > float x.
 

« first day (269 days earlier)      last day (4665 days later) »