« first day (390 days earlier)      last day (4558 days later) » 

4:01 AM
I'm liking clang more and more each day :) hackage.haskell.org/package/LibClang-0.0.8
 
is that free?
 
Yes.
Open-source even.
 
nice
that's really quite nice
lol WTF
in debug mode, MSVC locks all their containers in every operation?
 
NFI
humph
it all compiles, and it only took me like, ten minutes, but for some reason, I'm getting the wrong result
 
4:08 AM
I suspect that "some reason" is that you've got a bug somewhere.
 
yeah, I suspect that too
 
Time to put it on the vivisection table.
 
I like the mixin approach to fake extension methods to a certain extent, but the real thing is a bit better :) Will WideC have some form of extension methods?
 
absolutely
 
4:12 AM
    if (f(a, b)) {
        return n(++a, b);
    }
 
the thing is, I'm sitting looking in the Debug window, and the final type is fine and valid
 
Why ++a?
Certainly f could consume more than one token.
 
good shout
in fact, that's exactly what happens
I'd expect
fixed
now to debug the alternatives
well, the operator chaining seems to be working fine
but the actual result is false, which is not what I was hoping for
 
wow, everyone is up early.
 
How did you fix that bug?
 
4:17 AM
simple
 
@IntermediateHacker Hi.
 
I turned the operator() into taking references
 
Well, now you've got another problem then.
 
yes
 
(a >> b) || c.
 
4:17 AM
not all of them take references
some are values
 
If a passes, but b fails, you changed the iterator.
 
in fact, the compound ones tend to be values
but then they won't propagate up properly
owch, this is harder than expected
 
easier than Spirit, though
 
In return lhs(a, b) || rhs(a, b); you need to pass a different copy to each side, so that modifications won't affect stuff.
 
4:19 AM
yes, I agree
and voila, it worketh
 
:)
It helps that I've been working on something like this last week.
 
I just did that in the wrong one, I did it in next instead of or
 
you know, frankly, I am scared of the WinApi.
 
lol
 
especially all those ::GetWindowLongs , ::SetWindowLongs and WNDPROCs
 
4:21 AM
Though I wonder why the default in Parsec is to indeed let a consume the input in that scenario I described.
Probably speed.
 
it's ::GetWindowLongPtr
 
I get nightmares because of the WinApi.
 
::GetWindowLong = bye bye nasty death on Win64
 
@IntermediateHacker you don't need to use that stuff at first
 
uh
creating a window and responding to window messages is Windows API 101
 
4:23 AM
@AlfPSteinbach I didn't use it at first, but now, the more I advance , the scarier it gets. especially abstracting the WinApi into classes....
 
sure, but once you're done, then you never have to see it's incredibly ugly ass again
 
thats what I'm hoping for.
 
Ah, found the justification. "For reasons of speed, the (<|>) combinator is predictive; it will only try its second alternative if the first parser hasn’t consumed any input." It's indeed for speed reasons.
 
ok, I screwed up a bit
I changed my or struct as follows:
template<typename Iterator> bool operator()(Iterator& a, Iterator& b) {
    auto begin = a; auto end = b;
    if (lhs(begin, end)) {
        a = begin;
        b = end;
        return true;
    }
    if (rhs(begin, end)) {
        a = begin;
        b = end;
        return true;
    }
    return false;
I realized that I do actually completely need to propagate up the changes that did occur
but now it doesn't work :(
 
lhs can consume input but fail?
 
4:29 AM
yes, but then the changes aren't propagated back to the argument
 
Oh, right.
But they're propagated to the rhs call, because it changes begin.
 
good shout
still no dice :(
this shit is hard to debug
 
@IntermediateHacker u can just ask me about that. or @sbi. i think we've both done that a number of times (it used to be a common thing to do many years ago).
 
no, wait, that was it
I just messed up resetting begin and end
 
@AlfPSteinbach you mean about wrapping the winapi into classes?
 
4:32 AM
yes
 
It's a lot less simple than the original one-liner now :)
 
basically there are two approaches: the old two-phase initialization used in mfc and vcl etc., and more modern single initialization (the c++ way)
afaik there's only one framework using proper C++ construction
 
yes
but it works much better :D
 
the guy wrote about it in some C++ journal while he developed it
 
@AlfPSteinbach WTL?
 
4:35 AM
I see. but for single initialization will I wrap both WNDCLASSEX and the mainwindow HWND into a single class?
 
free choice
you can use a singleton for the windows API window class
i mean for each
 
semantic actions
the WinRAR: I am one
 
You can set the WindowLongPtr to this
there's no need to have singletons when dealing with HWNDs, as far as I know
 
@DeadMG Yes I've already done that. and then I use GetWindowLongPtr in the message handler?
 
4:38 AM
yep
ok, now I have a new problem
no, wait, no I don't
 
another thing that's confusing me, what in the world is HWND anyway? is it a struct ? or a typedef? or something else?
 
Will you decide yourself?
 
lol
 
30 secs ago, by DeadMG
no, wait, no I don't
lol. :D
 
@IntermediateHacker A window handle.
 
4:39 AM
it's an opaque system handle
 
You need to familiarize yourself with the idea of opaque handles. They're everywhere in the WinAPI.
58 mins ago, by DeadMG
no, wait, I do totally need right precedence
It's not the first time he does that.
 
why don't u need a pointer for it? for example myfunc(HWND window) works as well as myfunc(HWND& window) or myfunc(HWND* window)
 
because HWND is already typedeffed to be a pointer
that's how opaque handles work
 
It's copyable.
 
I see. thanks, that solves one or two problems I was having.
 
4:45 AM
ok, it doesn't work
 
@IntermediateHacker This page may be of help msdn.microsoft.com/en-us/library/aa383751.aspx
 
template<typename Original> struct zero_or_more
: public interface_mixin<zero_or_more<Original>> {
    Original o;
    template<typename Iterator> bool operator()(Iterator& a, Iterator& b) {
        while(o(a, b));
        return true;
    }
};
 
Assuming all other parsers don't consume on failure, it seems like it should work.
 
yes, that was my thought
so I expected that some other parser must consume on failure
 
Do they all consume on success?
(Though that would give infinite loops instead of failure)
 
4:49 AM
yes
hmm
now I got the expected two outputs, but they were the next token's value :P
the action is bugged
fixed'ski
I didn't properly save and restore in the action operator itself
 
now here's a question
how on earth am I going to deal with semantic actions that might want values from more than a single token?
 
How so?
(a >> b)[action here that needs a and b]?
 
sure, but you don't get both tokens, you only get one
the parser rules don't currently function like, well, like functions
so you can't really do much except read the value of a single token in an action
 
Instead of returning bool, you'll need to return a tuple for the case of sequencing.
 
4:56 AM
yes
 
Maybe a variant for the case of alternatives.
 
actually, I had something somewhat different in mind
 
And make that optional so you still get to handle failure.
 
I could just keep the return value of the semantic action in-class
 
That could work too.
 
4:57 AM
I mean, my current structure allows for you to access whatever what you want
so this should be fine
unless you had recursive grammars, in which case it would not be fine at all
the only way to express a recursive grammar is to use something like a std::function<bool(iterator, iterator)>
but that will get rid of the semantic return values
I guess that you could do something like if (func.as<decltype(rule)>())
 
Do you need that for your grammar?
 
you do if you want to express something more complex than infinite using statements
 
I thought your grammar wasn't even context-sensitive.
 
it isn't
 
So what am I misunderstanding?
 
5:03 AM
but I'm pretty sure that all grammars which are more than regular are recursive
everything -> context-sensitive -> recursive -> regular
 
Context-sensitive grammars are recursive.
 
they probably are, but recursive grammars are not context-sensitive
 
Right, but you don't need to parse all recursive grammars. You only need to parse yours, right?
 
namespace := shit { namespace_contents }; namespace_contents := shit namespace;
absolutely
 
@DeadMG And your current scheme can't parse that?
 
5:06 AM
of course not- you can't refer to an rvalue expression
well, obviously, you can store it- in std::function, and then refer back to it later
but as I just said, that loses you the context information you need to access the values from the semantic actions
I think, though, that this could be a viable approach, using the as() member
 
Oh, I think I get it. You can't store the data in the parser object. That it?
 
yeah
 
auto identifier = (idStart >> *idChar)[([](char a, std::vector<char> b) -> std::string { std::string s (1, a); s.append(b.begin(), b.end()); return s; })] I think something like this would work.
And the operator() of the semantic action would return boost::optional<std::string>.
Yeah, I got that mixed up.
 
that still won't work
you'll lose the type information when doing recursion
it occurs to me that I haven't seen anything about this in Spirit
maybe they have a solution that's stealable
what I could do is just add an extra "context" argument
 
5:24 AM
That will likely be needed anyway for the line and column info.
 
no, those are contained per token
 
Ok, this is an example of the problem, right: auto nested_parens = lparen >> opt(nested_parens) >> rparen;?
(Whatever is the syntax for optional)
 
yep
that should function, I think
ok, now I've come across an interesting problem
apparently std::vector<T>::iterator rvalues will bind to std::vector<T>::iterator&, but int rvalue won't bind to int&
 
5:48 AM
what you need is the ability to change the context argument
not just accept it
what you need is the ability to say "obtw, now, I'm the new Context"
mb boost::optional would work for that?
 
6:02 AM
Sorry, Internets broke.
 
it's ok, I didn't come up with many epiphanies
oh yes, I forgot about the constructor fun
just strange compiler errors
 
0
Q: Norwegian keyboard keys don't work with Ubuntu in VirtualBox

Alf P. SteinbachI just installed VirtualBox (from Oracle) in Windows 7, and created a virtual machine with latest Ubuntu. Here in Firefox I can use the left Ctrl key, while the right one doesn't have any effect. However, I can't use the AltGr key (also known as Right Alt) to produce e.g. curly braces like {} (I...

 
> So that intelligent input method is apparently not particularly intelligent. Even the acronym fails to make sense.
hehe.
@AlfPSteinbach I see that you're also a fan of multi-line prompts :)
 
lol
 
@RMartinhoFernandes well i don't like having too much text in the prompt on the line i'm writing
 
6:18 AM
It also leaves you space for more stuff in the prompt.
 
ok
instead of having Context functionally passed, I could make it a state member
 
Is delete x; an expression or a (non-expression) statement?
 
it's a statement I believe
I know that the news are expressions, obviously
but I think delete is a statement
 
no wait
it has to be an expression
else how can you have ::operator delete?
 
6:27 AM
That doesn't force delete x; to be an expression.
 
true true
 
But it seems like it's an expression of type void: ideone.com/cNjBQ
 
yep
 
Cool, that means I can expand it with ellipsis (not sure where I'd need that, but...).
 
having an unexpected problem with nested namespaces
for some reason, if you feed it a nested namespace, it won't parse past it
 
6:31 AM
I think I've heard this before :)
I can't help without more info, obviously.
 
lol
that's what I've got as my "grammar" right now
but for some reason, the Kleene Star isn't functioning correctly
I checked the final value of the input iterator, and it's sitting happily on a perfectly valid Namespace token
 
It parses "namespace foo {}" and "namespace foo { namespace foo {} }", but not "namespace foo {} namespace foo {}"?
 
yep
 
Neither "namespace foo { namespace foo {} namespace foo {} }", right?
 
and, infact, namespace foo { namespace foo { namespace foo {}}}
valid
I get a nice foo foo foo output on my command line so I know it's matched them
 
6:35 AM
Did you change the implementation of the star? Or is it still that simple while loop?
 
no, that's still just the while loop
ok, I added a trigger to run when it closes the namespace, and it only ever notices the closure of the first namespace
 
You mean, it stops at "namespace foo { namespace foo { namespace foo {}", leaving "}}"?
 
oh, by the way, I lied
yeah
 
namespace foo {} namespace foo {} is valid
it's only namespace foo { namespace foo {} } namespace foo {} which fails
 
6:37 AM
Good time everyone!
 
I just ran namespace foo {} namespace foo {} namespace foo { namespace foo {} }
 
Hey! how are you @RMartinhoFernandes ?
 
@DeadMG Did it consume the last curly?
 
nope
 
6:38 AM
@OmeidHerat Doing fine, thanks.
Ok that's weird.
 
I know the whole idea of using std namespace is not considered good, but what about something like this:
using std::cin;
using std::cout;
using std::endl;
using std::setprecision;
using std::string;
using std::streamsize;
 
whenever it meets a nested namespace, it will stop after the first curly of the most nested namespace
if it's e.g. triple-nested, then only the innermost namespace gets closed
 
@OmeidHerat Dunno, I'd probably just drop using namespace std; in local scopes.
 
I just explicitly qualify every time
 
Well, actually, that's what I do too.
Sometimes I use namespace snnib = some::nested::namespace::inside::boost; too.
@DeadMG The only think that could prevent the parser of the last curly from running would be if std::ref(namespace_rule) returned false.
Are you sure that's not happening?
 
6:42 AM
the only way that would happen is if either the input ended, which I can guarantee it didn't, or if it failed to match something
but the input is most definitely valid, I checked the token stream
hard to debug this stuff
you're right, namespace_rule must be returning false
 
Of course I'm right.
 
but why?
what I might do is break on all comparisons
 
It does consume one closing curly. What does that one return?
 
when it consumes the closing curly, it'll return true
and then it should simply continue to the next token, which is another closing curly
 
Right, I know the theory :)
I was asking if you checked that was working correctly.
 
6:47 AM
on it
ok
I'm all the way to the most nested { and it's fine
comparing namespace to } ... fail
compare } to }... success
now.. comparing namespace to } ... fail
huh
I'm not sure what happened- it looked for } and found namespace
 
Ha!
It's the iterators.
 
yeah, I got that far, else it'd work
 
You're restoring something you shouldn't.
 
yeah
I just stepped past that
the iterator jumps back a couple lines
from line 20 to line 18
now the thing is looking for a curly bracket, but the start of line 18 is the namespace so fail
 
So, where are you not setting an argument when you should?
 
6:53 AM
good question
I'd love to step through, but stepping through the STL source is a bitch
 
Well, you're better equipped to answer, given that you have the code :)
 
yeah- if there are two nested namespaces, it jumps back twice
it's got to be in the kleene star itself, the while loop is the only one that's not protected by a copy
or maybe not
 
Hmm, I thought we had that one cleared, assuming the others were correct.
 
yeah, me too
but protecting it with a copy so it didn't consume if failed didn't change anything
although I don't think it was necessary on reflection
 
Well, it never fails :)
 
6:58 AM
oh no wait
it did fix one of the jump backs
but I've still got to find the other
no wait, that was just the debugger being a moron
I hate it when that happens
 
No wait... no wait... no wait... I'm lolling.
 

« first day (390 days earlier)      last day (4558 days later) »