« first day (272 days earlier)      last day (4693 days later) » 

11:00 PM
@DeadMG Btw there is also the Interpreter design pattern from the GoF book.
 
Replacing a method/class for test purposes is mocking.
 
Cam
Agh lol this is bugging me to no end. Maybe pattern isn't the right word - what's it called when you do that? Might have ended with 'ing'
I mean those things definitely fit
 
ok
I think that maybe, I should just roll a custom parser
 
There's definitively mocking going on. But I've never heard of subclassing the mocked interface to huh provide behaviour.
 
Cam
Particularly mocking, but that's not the word. Thanks though guys :)
 
11:01 PM
it's just so much easier to think when your logic is written in C++, in my experience
 
Cam
So for example suppose I have a class DateTool that has a function getTime()
 
@DeadMG A custom C-like parser?
 
@Cam I think I remember "The seam model" from the book "Working Effectively with Legacy Code"
 
I'm not actually sure how many structural similarities my grammar can have with C
 
Cam
I might create a subclass DateToolTest with a function getTime() that returns test values instead, and then once i'm done testing i can use DateTool again
 
11:02 PM
I think that having types as expressions is complicating things for me significantly
and honestly? I find BNF to be utterly unreadable
 
> A seam is a place where you can alter behavior in your program without editing in that place.
 
if I'm going to have to manually specify the order of operations anyway, I may as well do it in a language I understand
 
Cam
Yes that fits, but sadly it's not the word I'm looking for :/
 
@Cam I think the concept of "seams" describes your problem very well.
 
@DeadMG Did you have language theory?
 
Cam
11:04 PM
Definitely
not the word though :(
 
yeah, I've done some language theory
 
Cam
does anyone know of a giant list of design patterns i could do a linear search on? :)
 
Decorator?
 
Cam
YES
 
mocking
it's the mocking pattern
you mocked DateTool
 
Cam
11:05 PM
false alarm
not decorator :(
 
@DeadMG BNF is unreadable because what it expresses can be powerful.
 
Adapter?
 
Cam
hmm
 
Bridge pattern?
Strategy?
 
Is this design pattern bingo?
 
11:05 PM
Singleton?
 
@LucDanton play along?
 
Cam
lol
 
@StackedCrooked Too tired!
 
@LucDanton: Well, honestly, I'm pretty much writing a parser here
 
Curiously recurring template pattern?
 
11:06 PM
I like C++, it's my comfort zone, I'll be more productive
 
Cam
lol
 
Policy based class design? (This could actually be used for your problem.)
 
and I have a "rough" grammar to work with
actually
oh shit, I'm context sensitive
 
Cam
I think it was one word
And it was specifically related to testing
 
@DeadMG Oh I don't want to put you off C++. But I don't think that any difficulties you encounter with BNF is to blame on the notation. (For one, it could be the wrong tool.)
 
Cam
11:08 PM
you wouldn't do this if it wasn't for testing
 
@Cam: Mocking
 
Cam
Mocking is it but are there other words for Mocking
 
Mocks, Fakes, Stubs,
 
dunno
google a thesaurus
 
11:09 PM
There's a ton of slightly different denominations, and everyone has slightly different meaning for each one.
 
@LucDanton: Well, it could just be that my grammar IS CONTEXT-SENSITIVE
I'm gonna cry
 
Cam
Hmm
 
If only you had ditched statements.
 
Cam
Alright g2g but thanks for trying guys
:)
 
no
it's implicit-auto that's doing me in
i = 1; variable definition or assignment expression?
 
11:10 PM
v := expr!
 
that can totally work for me
 
Disambiguate like @Luc said, or leave the decision for semantic analysis (which makes the parser less useful, and analysis more complex)
 
I was considering using it anyway
 
Speaking of grammars, anyone has a good notation for storing move-only objects in a lambda?
Currently you have to use e.g.g std::bind to bundle a move-only type with a functor, you can't write the lambda outright.
 
unfortunately, no
 
11:12 PM
Anyone used the "Interpreter design pattern" before? It seems pretty cool actually.
 
Cool? What for?
 
I think the Committee briefly toyed with the idea of arbitrary expressions in capture lists but time was short.
 
For writing a parser.
 
e.g. [std::move(p)] { return *p; }
 
boost::spirit is probably based on the same ideas
 
11:14 PM
[&&p] { return *p; } would be an eyesore and inconsistent (or would it?).
 
really? I don't see that
 
And [std::move(p)] { return *p; } is consistent?
 
[&&p] { return *p; } seems pretty honest to me.
 
@MartinhoFernandes It never went beyond the idea stage. On the other hand, the [&&p] notations builds up on [&p] instead of allowing arbitrary things.
 
Exactly my thought.
 
11:16 PM
I guess I should have said [&&p] is as inconsistent as [&p]
 
That's true.
 
Oh and it should probably a good idea to not allow [&&] { ... }
 
That would be inconsistent.
 
...
 
11:17 PM
I am tired after all :(
This reminds me that I keep telling myself that [&] is bad style but every now and then I use it.
 
But you can't write [=p]{ return *p; } can you?
 
Nope. It's [p].
 
Hmm, that's also inconsistent then.
Also, it would be a smiley.
 
Either that or [&] is
[member] is not allowed right?
 
Is it possible to solve the eight queens problem using template meta programming? (Solution generated at compile time)
 
11:20 PM
I guess.
TMP is Turing-complete after all (given infinite tape).
Would it be easy?
That's another question.
 
Actually there seem to be solutions on the net. Checking them out right now.
 
[member] is allowed. I misremembered.
 
You can solve it would linear programming.
 
@MartinhoFernandes I think it would be easier to first solve the problem in ML or Haskell and then try to convert the resulting code to C++.
 
Not sure if how easy that is to implement in TMP.
@StackedCrooked Definitely.
 
11:22 PM
I should give this a try.
 
That's odd, I wrote code today that does derived d = base(); and I'm not sure why it works.
(Implicitly generated code is bad! I can't control what's happening!)
 
Conversions ahoy?
 
Well, I'm going to try writing a base minimal case.
Because the derived type is struct derived: base {};, and I sure didn't write any conversion operator.
 
that code shouldn't compile
 
0
Q: Solve the eight queens problem at compile-time

Martinho FernandesCan you solve the eight queens puzzle using template metaprogramming? Pick any suitable input format. You're allowed to use C++11 and its standard library.

 
11:26 PM
the derived type doesn't inherit the implicit constructor
 
This is embarassing.
I didn't write derived d = base();
I wrote auto d = base(); and hoped very hard that I'd get a derived
 
@MartinhoFernandes congrats for posting the 5th C++ question on Code Golf
 
@LucDanton lol
Hope-oriented programming doesn't work very well.
 
The "Fingers crossed" programming language.
Tagline: It might just work!
 
I think I just may keep that solution.
 
11:30 PM
Typinjgne wirh your finger s crosserd is ujard-.
 
not it;s mot
 
Wow, I got "your" right.
 
You are supposed to cross your fingers just after clicking the build-and-go button.
 
Do you think serendipity programming can take off?
 
martinho you pussy, it's easy to type with fingers crossed
 
11:33 PM
@LucDanton if reality were subjective
 
Yeah, with edits.
 
I guess it's a fine line between that and cargo-cult programming.
 
And no capitals, or punctuation.
 
especially for alol those keys thst id' normslly use my other fingers for
 
The shift key is bifg enoguh nit ti miss it thougj.
 
11:34 PM
Cargo cult programming: if (p != 0) { delete p; p = 0; }
 
which includes backspace
@StackedCrooked: What's wrong with that?
 
The backspace programming language. It only has backspaces!
 
@DeadMG It's not wrong, but many people believe that deleting a null pointer is not allowed.
 
how about the "error" programming language- you can only program in it by making C++ compilers issue errors
@StackedCrooked: That's not the point of the segment
 
11:35 PM
Segment?
 
program segment
section, example, whatever
 
Programming with speech recognition is hilarious.
 
@MartinhoFernandes This is getting angry quite fast.
Speech recognition needs a sarcasm detector. Think you!
 
oh man
that's good
 
Boost continues to amaze me. Fucking boost::is_pod, how does it work?
 
11:38 PM
@StackedCrooked Pretty much like std::is_pod, with a fallback.
 
I love how he keeps having to delete his previous delete commands.
 
I.e. compiler magic and the fallback is boost::false_type
 
std::is_pod is in C++11?
 
sbi
@MartinhoFernandes So you can only feel old if I'm not around?
 
@StackedCrooked Yes.
 
11:42 PM
@Martinho I just forwarded your 8 queens TMP to a big group of guys here
 
@sbi Not what I meant.
Just commenting how everyone was feeling old. Below age 30.
 
I hope they make a good showing :)
 
For the record, it was not my idea.
It was @StackedCrooked's
23 mins ago, by StackedCrooked
Is it possible to solve the eight queens problem using template meta programming? (Solution generated at compile time)
 
sbi
@MartinhoFernandes Yeah, that was a plural "you". Sorry, I failed to properly get this across.
 
Well, he didn't post it to code golf, so you're going to be the guy eternally in google's cache, and therefore you will be the graham bell in this situation
 
11:44 PM
@MartinhoFernandes viewed 6 times. This website isn't really popular.
 
It's 99% codegolf.
Which means about four people are interested in it.
 
@sbi I don't think we've ever compared birthdays, but as far as I can tell, @sbi and I are pretty close to the same age...
 
I expect it to be fail beta.
 
sbi
@JerryCoffin Why do you think so?
 
@sbi: OH HAI
 
sbi
11:46 PM
@DeadMG Shark!
In other news, this was the last day of my vacation, and I just traveled 17hrs with two kids, arriving home at 1 am. In the end I carried 4 bags, and I almost had to carry the kids... I'm really exhausted.
 
@MartinhoFernandes This should serve as a cautionary tale for carpal tunnel syndrome and related ailments.
 
@sbi: GOING HOME MONDAY TO SEE MAH PUPPY!
 
"IT COULD BE YOU DICTATING"
 
@sbi are you going to teach your kids programming?
 
@sbi: ALSO I GOT MY EXAM RESULTS AND THEY'RE NOT AN INCREDIBLE FAILURE
 
sbi
11:47 PM
@Dead: Will you stop yelling?
 
oops
 
sbi
@DeadMG Cong-rats, and other rodents! May your reign be long and prosperous!
 
@DeadMG You are a credible failure then?
 
sbi
@DeadMG But how much is it really yours if you#re only seeing it about thrice a year? (Sorry for party-pooping.)
 
@sbi: That's completely not the point.
@StackedCrooked: Heh, I'm an incredible success and C++ expert, like we all know.
 
sbi
11:51 PM
@StackedCrooked Only if they want and show an affinity to solving puzzles. My teenage daughter does neither. The others are undecided as yet.
 
I never doubted you.
@sbi I see, not forcing it down their throats.
 
I'm gonna get some sleep now
hopefully attempting to sleep will not horrifically fail like last night, where I was mysteriously very sick for no apparent purpose
 
Being sick has a purpose?
 
sbi
@DeadMG So what is?
 
I once asked my Dr about the purpose of dreams. He answered that thinking in terms of purpose is wrong.
 
11:58 PM
Did he say why?
 
Well, purposes are not falsifiable.
 
@MartinhoFernandes he briefly mentioned that it was unscientific and that dreaming should be regarded as a phenomenon.
But he didn't really explain. He quickly brushed the topic away.
 

« first day (272 days earlier)      last day (4693 days later) »