« first day (490 days earlier)      last day (4441 days later) » 

1:00 PM
unsigned int?
 
Ell
Would a string be a token?
 
@Ell yeah
 
Ell
so if a string contains whitespace, how does that get parsed?
 
but lexing is basically done with a state machine. When we're in this state, the following sets of tokens are expected, so let's see if the next input matches it
@Ell you encounter a ", and then you continue until you get to the next "
and that's your token ;)
 
Ell
okay :s
So we don't do it with a regex? or am I just not getting it?
 
1:02 PM
you usually specify a series of rules, each of which is a regex
 
Ell
hmm
 
as in, it uses regex syntax. Then the lexer (conceptually) feeds a character at a time to each of these regexes, and sees which ones will accept it
most of the rules will fail (pass it a w, and the if rule will error out, but the while rule will accept it, and expect a h next)
 
Ell
what if one rule is "int" and one is "int16", wouldn't it stop at "int" and then lex "16" as a sepearet token?
 
so it's not your ready-made standard library regex class
@Ell it typically tries to continue as far as possible
the maximum-munch rule (or is it maximal?)
 
Ell
as in, greedy?
 
1:05 PM
yep
that's the reason for the > > vs >> problem in C++03 too :)
 
Ell
right i think im sort of getting there
as in vector<vector<int>>
 
exactly
 
Ell
the >> is a right shift instead of 2 >'s?
ahh kk
 
yeah
and it prefers the longer token
except that in C++11, the made an exception for that case :)
but a naive lexer will prefer >>
 
Ell
cant it realise that a >> isnt a right shift based on the context, or does context only come into the parser part?
 
1:06 PM
that's what the parser does
 
C++ has a context sensitive parser
 
the lexer usually doesn't know anything about that
it just tries to recognize tokens
 
Ell
so the fact that it depends on context makes c++ a non-context free grammer?
or have I completely made that up?
 
true
in C++'s case, it's also known as a "completely fucked up grammar"
 
Ell
yay im getting somewhere :D thank you :L
haha!
but in all seriousness, what kind of grammar is c++'s? context-sensetive grammer?
 
1:09 PM
yes
context sensitive, otherwise how could it tell whether you have a std::vector<std::vector<T>> and a >> right shift?
because in C++11 you don't need anymore spaces between the template >>
 
Ell
does "context" refer to anything outside the current token?
 
it's just the normal english definition of context
> The parts of something written or spoken that immediately precede and follow a word or passage and clarify its meaning.
 
a context-free grammar still relies on knowing more than the current token
say, a left-parenthesis can be part of a function call, or it can be part of a function definition
 
true too, but probably not as much as the context sensitive grammar
though, I'm no expert in this field, and whatever I say may be wrong
 
A context-sensitive grammar has multiple symbols on the left side of the expansion rules. That's all there is to it.
 
Ell
1:15 PM
to me, the fact that it relies on stuff outside of the current token makes it sound context-sensetive?
 
C++ is even worse then context-sensitive, because sometimes it has to look into the symbol table whether an identifier names a type or not. That's outside of syntax alltogether.
 
lol
long live C++ grammar
 
@FredOverflow isn't that basically what context-sensitive means? You can't just look at the token stream, you have to remember that "we already declared this name to be a type, and this name to be a variable", in order to parse subsequent tokens
 
Context-free means non-terminal A is always expanded in the same way, irrelevant of where it is.
 
For example, Foo x(Bar); is an object definition if Bar is an object, but a function declaration if Bar is a type.
 
1:17 PM
In context-sensitive grammars productions might be of form aA -> ..., bA -> ...
 
and context-sensitive by that then means that non Terminal A will be expanded depending on context
 
Yes.
Hence the name.
 
ok, makes sense :)
thanks @CatPlusPlus
 
Context-free stuff can be parsed with push-down automata. How do we parse context-sensitive stuff?
 
Ell
okay im confused now :S
 
1:19 PM
"Linear-bounded non-deterministic Turing machine".
No idea what that really means, but there you go.
 
Non-determinism doesn't sound terribly efficient.
You can convert non-deterministic automata to deterministic automata. Is that not possible with Turing machines?
 
@Ell you encounter the following C++ expression: foo(). What does it mean? We can't know unless we look up foo in the symbol tables we've been building
it could be a function call. Or it could be constructing an object
 
8 mins ago, by FredOverflow
For example, Foo x(Bar); is an object definition if Bar is an object, but a function declaration if Bar is a type.
 
we don't know just by looking at the expression. Thus, it is context-sensitive
@FredOverflow yeah, that :)
 
Ell
but doesn't that apply to java or c# or many other languages?
 
1:25 PM
@jalf No, context-sensitive means something else entirely.
 
ok, I'll shut up then :D
 
A context-sensitive grammar (CSG) is a formal grammar in which the left-hand sides and right-hand sides of any production rules may be surrounded by a context of terminal and nonterminal symbols. Context-sensitive grammars are more general than context-free grammars but still orderly enough to be parsed by a linear bounded automaton. The concept of context-sensitive grammar was introduced by Noam Chomsky in the 1950s as a way to describe the syntax of natural language where it is indeed often the case that a word may or may not be appropriate in a certain place depending upon the context. ...
 
Context-free grammar might depend on a symbol table, too.
 
10 mins ago, by FredOverflow
C++ is even worse then context-sensitive, because sometimes it has to look into the symbol table whether an identifier names a type or not. That's outside of syntax alltogether.
 
That's outside of language theory AFAIK.
 
1:26 PM
What does ZOMGPONIES mean?
 
It's an exclamation of great joy upon witnessing a pony.
 
oh my god ponies, in a very excited way
 
@StackedCrooked "Oh my god, ponies!"
 
And the Z?
 
What I said.
 
1:27 PM
@CatPlusPlus multiple ponies
 
Internet thing.
 
@jalf What's better than 1 pony? :D
 
@StackedCrooked The prefix Z is like the postfix !!!!!oneoneeleven
 
1+i ponies.
 
Ell
1:28 PM
i thought z was zombies?
zomg = zombies oh my god!
 
> The "z" was originally a mistake while attempting to hit the shift key with the left hand, and type "OMG"
Ah, that explains it.
 
@CatPlusPlus Oh, interesting. On German keyboards, the Z is not right next to the left shift key, so I didn't make that connection.
 
Now that this is cleared up I can continue my reading.
 
Reading of what?
 
1:43 PM
Just realized that half of Apple's cat-based code names have referred to the same species. Puma, jaguar, panther, and mountain lion are all genetically the same.
 
They are all cats?
 
@StackedCrooked They're all the same species.
Lions, tigers, cheetahs, leopards and snow leopards are all distinct on the other hand.
 
Even / odd numbers lion/tiger variants?
 
Doesn't seem to be any pattern. First was cheetah, then the next 3 were New World cats (all apex predators are the same), next 4 were Old World "big" cats, now we're back to the New World.
 
@StackedCrooked Is there any chat about programming on reddit?
 
1:48 PM
@DzekTrek Reddit doesn't have chat rooms afaik.
 
They use IRC mostly.
 
@Potatoswatter Are you sure they're the same species (doesn't sound quite right)? Then, by definition, a mixed pair should be able to spawn grandchildren... ...which two do you think are the same species?
 
The cougar (Puma concolor), also known as puma, mountain lion, mountain cat, catamount or panther, depending on the region, is a mammal of the family Felidae, native to the Americas. This large, solitary cat has the greatest range of any large wild terrestrial mammal in the Western Hemisphere, extending from Yukon in Canada to the southern Andes of South America. An adaptable, generalist species, the cougar is found in every major American habitat type. It is the second heaviest cat in the Western Hemisphere, after the jaguar. Although large, the cougar is most closely related to sma...
 
So they are the same family - not species?
 
How to join IRC c++?
 
1:49 PM
Ah, the jaguar is different. But I think the name jaguar regionally might reference the cougar as well, say in northern Mexico.
 
eg a Donkey and a horse are not of the same species because a cross (ie a mule) cannot spawn
 
There's ##c++ on Freenode.
 
@kfmfe04 No, a mountain lion and a puma can have grandchildren.
 
@CatPlusPlus Thanks.
 
A lion and a tiger cannot.
 
1:51 PM
I've been spoiled by this chat's features. Can't go back to irc now.
 
@Potatoswatter so are you saying all the cats (named by OSX) can be divided into only two sets of species?
 
@kfmfe04 What? No.
I said that half the code names refer to a single species. The remaining code names are each distinct species.
 
ok - that's clearer - thx
 
And the jaguar is genetically closer to the Old World cats, so it's actually 3 code names vs 5.
 
^ Slightly unnerving..
 
Bob
2:03 PM
I am trying to make an aggregate class named Question. This class has reference to Answer and so the Question will be seen as one "unit". However each question may have one or multiple feedbacks associated with them. Would the Feedback class only be a reference to the Question or should it be part of the Question aggregate?
 
In C++ I tend to think in terms of ownership.
 
Bob
As if a Question owns a Feedback?
 
Indeed, or vice versa.
It's crucial for memory management.
Although, your question seems to be more general.
 
Bob
When you say it like that I feel that it doesn't own the Feedback. What do you think?
 
If you delete the question, then should the feedback also deleted?
 
Bob
2:08 PM
Yes, probably. Not any reason for keeping the feedback around if it is not attached to a question.
 
Then I would make the question-object the owner of the feedback-objects. Assuming that a feedback-object can refer to only one question.
 
@Bob The question might include a container, say std::list< feedback >.
 
Bob
Yes, a feedback only refer to one question.
So, you would include the Feedback in a Question. That is what I have now: Question being an aggregate root over Answer and Feedback
 
Indeed. I think that's right.
An answer cannot exist without a question. It almost sounds philosophical.
 
Bob
Thank you @StackedCrooked.
 
2:14 PM
Except in Jeopardy
 
2:25 PM
@StackedCrooked ok, I can reproduce the problem, at least. Will try to figure out what's going on
 
Bob
@StackedCrooked So the way you normally "checks" if an class should be part of the aggregate is to ask yourself: Does this class own the other class, and would that class get deleted when the parent is deleted?
 
@jalf Cool!
@Bob It's one way of figuring out relations. I'm not saying it's the best way.
 
Bob
Do you have other recommendations, I would like to hear and learn :)
 
Since defining the ownership roles is crucial in C++ I usually end up doing it like this.
 
@Bob Careful with the uses of the term 'class'. I think in this case e.g. you meant "Does this class own an object of the other class'".
Classes don't get deleted, objects do.
 
Bob
2:38 PM
yes
that was what I meant:)
 
Imagine you're designing a database.
 
I learned about the "disown" command yesterday. It allows me to start a command in the terminal, put it in the background, and then close the terminal application while the job keeps running.
 
If you disown your children you don't get zombies you need to kill. Convenient.
 
isn't that more or less what nohup does too?
 
@jalf Yes, but on OSX the application started with nohup will still terminate when exiting Terminal.
32
Q: Difference between nohup, disown and &

lesmanaWhat is the difference between $ nohup foo and $ foo & and $ foo & $ disown

 
2:42 PM
Doesn't seem terribly useful.
 
ah right
 
According to above answer nohup and disown are essentially the same.
 
that reminds me, can anyone tell me how you're supposed to remove/uninstall apps on osx? I'd installed xcode 4.2 via the app store, and since it didn't seem inclined to update to 4.3, I dragged it to trash and installed 4.3. But seems like that wasn't what I was supposed to do. Now macports gives warnings like
Warning: xcodebuild exists but failed to execute
Warning: Xcode does not appear to be installed; most ports will likely fail to build.
 
.app bundles are supposed to be removable by just removing it.
 
sudo /Developer/Library/uninstall-devtools --mode=all
@CatPlusPlus As long as they are self-contained. Which they should be. But Apple seems to like breaking its own rules when it comes to this.
 
2:45 PM
Apple apparently just figured out that Xcode should be .app, too.
 
@jalf Seen this? Found it on reddit here
 
nope, thanks
 
The official Apple download of "Command Line Tools for Xcode" has an invalid checksum ಠ_ಠ
 
3:00 PM
hah
 
@StackedCrooked Are you sure the checksum isn't indicating that your download was corrupted? Did it come through the same way twice?
 
I downloaded three times. Two times with Chrome and once with Firefox. It was corrupted in all three cases.
That or there is something wrong with unpacker.
And I already uninstalled my xcode tools.
 
Huh. Well, I'm still waiting to upgrade to Lion, because it keeps indicating the download is complete when it isn't, and I don't know how to perform the download outside the App Store…
 
I'm now downloading xcode 4.3 (1.7GB)...
I want to reinstall my Lion from scratch. But keep procrastinating about it.
 
by the way, is there any way to make the osx terminal just close on exit, rather than showing the [Process completed] message?
 
3:03 PM
any Vbscript coder here ?
 
@jalf Dunno. I usually press Command-Q.
 
@Xufyan Is the C++ room really the best place to look?
 
5
Q: Automatically quit Terminal when typing exit

DiagoScenario I use terminal to SSH a lot, however would like the Terminal App to quit when the last Tab closes using exit. I already have the terminal window itself set to close on successful exit, however Terminal keeps running. I followed Ricky Campbell's tutorial here which uses an AppleScript to...

 
@jalf You might be better off never opening a terminal window in the first place, by running the executable directly.
 
@Potatoswatter which executable?
I use the command line for lots of stuff
 
3:06 PM
@jalf the one giving you "process completed"
 
@Potatoswatter that is the terminal
open a terminal, type exit, and it shows that instead of just closing
 
Oh, you want to close the window when you manually exit a shell. Dunno about that.
 
I'm not starting any other executables
yeah
 
Well, you could try sending an Apple Event to Terminal in some kind of shutdown script. But then that would have to determine that you did exit interactively.
 
It'd probably be easier to find a smarter replacement for Terminal.
Or less hassle, at least.
 
3:09 PM
I'm trying the "trap" + AppleScript solution but it results in a popup asking for confirmation to close.
 
so maybe you want to just run an AppleScript that tells Terminal to close the window, and alias that to exit, or some other command. Then the close command has the same effect as exit
 
@CatPlusPlus Terminal is pretty good I think.
 
AFAIK, functionally it's more or less on xterm level.
 
Command-W is just as fast or faster than exit + enter.
 
@StackedCrooked yeah, I just tried that. It asks for confirmation, and then closes every terminal window
 
3:11 PM
Lol.
 
Heh, I got the script right on the first try! But yeah, "closing this window will terminate the following processes: login, bash, osascript".
 
@jalf Yeah it quits terminal. It's probably possible to change the applescript command to have it close instead of quit.
 
even if i nohup the command… that's not right
 
btw, applescript kind of freaks me out. What kind of twisted script language is this? :D
 
But then again, it's OSX, so probably most of terminal emulators available are shareware.
 
3:13 PM
tell application "Terminal.app"
close front window
end tell
@jalf It's ancient. Derived from HyperCard, a pre-www hyperlinking+multimedia tool.
 
Apple loves taking ancient languages and pretending they're ok.
 
So in a parallel universe, AppleScript is used like JavaScript.
 
Point in case: Objective-C.
 
@Potatoswatter but with a weird wannabe-human-language syntax
 
AppleScript is worse than BrainFuck.
 
3:14 PM
"please tell application Foo to go get me a cup of coffee"
 
@StackedCrooked Yes, it is.
Brainfuck documentation fits all on one page. AppleScript doesn't really seem to be defined anywhere.
 
tell application "Microsoft Word" to quit
 
tell application "Microsoft Word" to die in fire
 
@StackedCrooked Except there's no to. You can't conjugate verbs XvD
Oh, it does work. Guess they extended the syntax… again… LOL
 
osascript -e 'tell application "System Events" to keystroke "w" using command down'
^ Closes the current Terminal window
If you have more than one tab open then it will ask for confimation before closing it. It will not close the other tabs.
 
3:20 PM
No, it's high level.
tell front window of application "Terminal" to close
 
Apple should've never invented AppleScript.
 
Hello All :)
 
@StackedCrooked where do you put that then? In .bashrc?
 
lol
 
@daknøk Back in the early 90's, there was nothing like it. Can't really criticize them.
 
3:21 PM
@Potatoswatter Lisp would've been a better choice.
 
@jalf I'm experimenting by putting it in .bash_logout. It seems to work!
 
@daknøk LOL! For whom? You can't write it without an editor that balances parens.
 
@StackedCrooked You can make the Terminal window close itself by changing a settings in the preferences.
 
Concatenative languages > Lisp.
 
@daknøk Now don't start making a fool of me.
 
3:24 PM
Lol.
 
Lol.
 
True programmers. "Settings? Eh, I'll write a script in an obscure language."
 
HyperScript was cool because development was RAD-style. You laid out the interactive page, then double-clicked the buttons and defined little scripts for them. Object orientation resulted naturally.
 
where in preferences?
 
Guys, can someone help me with a heap corruption issue ? (And no I cant use smart pointers here :D )
 
3:25 PM
So, it was a cheap Smalltalk knock-off?
 
@angryInsomniac use RAII then. ;)
 
Settings -> Shell
 
But then AppleScript tried to extend it to objects defined in a loose model implemented separately by all the applications in the system, and threw away the IDE. Things got hairy.
 
@jalf your favorite settings, then the "shell" tab.
 
Had to google RAII to get that :D
 
3:26 PM
It's in Dutch there but it works the same.
 
I shall blab my query id someone is feeling generous :)
 
@daknøk Yet another Dutch person here? :)
 
yeah
brb
 
huh, still can't find it
 
3:28 PM
So we're with at least 5 now: @daknøk, @sehe, @TonyTheLion, @rubenvb and me.
 
There is just 'one' character buffer in my program , which I use to do a lot of things , VLD shows that it is the source of a leak as I am obviously not deleting it ! But when I try to do so in the destructor , the heap gets corrupted
 
maybe I'll just make do with the scripting option ;)
 
@jalf Maybe it's a new preference added to Lion .
 
I'm on Lion
 
It was available in Snow Leopard too.
 
3:28 PM
maybe they removed it then? :)
or maybe I'm just mac-incompetent
 
> clean commands (list of text) : The processes which will be ignored when checking whether a tab can be closed without showing a prompt
 
@CatPlusPlus Interesting. Care to explain?
 
Well, no parentheses, for start.
While preserving the simple structure and macro capabilities.
Composition in data flow order, i.e. 42 a b c d <=> (d (c (b (a 42))))
 
I'm looking at Forth and and Joy samples now.
 
Well, canonical Lambda Calculus notation is more concatenative than Lisp. Because the lambda operator has low precedence, you can define a series of chained functions in continuation-passing style, without nested parentheses.
 
3:34 PM
So, post fix and "inferred grouping"..?
Brb, reboot.
 
(but ((everyone likes) (parentheses)))
:)
 
(but everyone) (likes parentheses) <= "but" meaning "except", serving as a negation
 
(except for those who are not used to ((lisp and (clojure)))))
 
@daknøk except that lisp and clojure are fugly
because of the parentheses
nifty, but not pretty
 
Love the edit.
 
3:36 PM
At least they are less ugly than C.
 
That's not really hard.
 
@daknøk well, yes. Many things are
 
Forth is pretty awesome, it just has scalability issues.
 
Factor is cool.
And has bit more helpful type system than Forth.
 
The problem with adding things to Forth is that it ruins the minimalism.
 
3:38 PM
Haskell is cool.
 
Yes.
I prefer usability to minimalism.
 
For embedded programming where C doesn't cut it, I'd go to pure Forth. For actual high level anything, C++ is king.
 
I wouldn't say C++ is king of the high level.
C++ is more like king of middleware.
 
C++ is king of upper middle level.
 
I like the saying Forth is the king of low-level, Lisp is the king of high-level.
 
3:42 PM
Forth is really more of a design pattern for your own bytecodes than a strict language.
 
Haskell, now this is high level.
 
JavaScript is the tyrant of the high-level.
 
Well, other POV: if C++ is high level, Haskell is god level.
 
I've just started on JavaScript. This past week I learned what a constructor in JavaScript is. LOL
You put the new keyword before a function call and it forces the function to return this;
 
Dynamically-scoped this makes using JavaScript objects a pain.
It's not even that.
 
It sets this inside the function to a newly-constructed object.
 
I shot me in the foot a few times when using the this pointer in JS.
 
With prototype set and so forth.
 
Yes, that too.
 
It's silly and painful, especially if you forget new.
 
3:45 PM
But the hacked-in return statement was very amusing to me.
 
You're talking about language that inserts semicolons randomly if you omit them.
In some implementations it was even possible to comment out the implicitly-added semicolon.
 
You have to use a syntax checker.
 
JavaScript is idiotic.
 
Also, the entire ECMAScript language standard is itself written as a (buggy, incomplete) computer program in low-level pseudocode. Important concepts aren't even given names, it's just laundry lists of instructions to follow.
 
It's designed by people who think that all the JavaScripters are morons.
 
3:47 PM
Or a language that compiles down to correct JS, because JS rules are more fit for computer verification than human one.
JS core might be nice, but I'm not convinced by all the rest.
function foo(x) { console.log(x); } foo(); Guess what happens.
 
I have a notion to try to make C++ compile to JavaScript…
@CatPlusPlus That's a default argument — idiomatic!
 
You'll probably have much fun with trying to emulate pointers.
@Potatoswatter No, it's undefined.
 
I've actually been doing that all over the place, is it considered bad?
 
@CatPlusPlus just put everything into one huuuuuuuuuuuuuuuuueg array. Then you can emulate pointers :)
 
@CatPlusPlus You're talking about the value undefined turned into a string, not undefined behavior.
 
3:49 PM
Default arguments are made like this: function foo(x) { if (typeof x === 'undefined') x = default; }
 
honestly, you don't even need that. Pointer arithmetics are only well-defined inside arrays in the first place
 
You need to use undefined as a Boolean, silly ;v)
 
Or x || (x = default);, but I don't know if that doesn't fail somewhere.
 
@jalf Exactly. The C memory model is actually pretty forgiving.
 
Anyway, silly boilerplate.
And if you forget an argument by accident, pain to debug.
High-level languages are supposed to help with development, not hinder it.
If I spend more time fighting with language itself than bugs in my logic, then something is not right.
(Also why PHP is useless.)
 
3:53 PM
Well… I can't really complain. It's suitable for defining a GUI where control flow randomly jumps between callbacks from different libraries.
 
@daknøk Aww, That is MAC OS?
 
That's OSX.
 
MacOS is dead.
 
@MrAnubis It's a screenshot of the preferences window of the Terminal application in Mac OS X with a piece of a sketchy wallpaper in the background.
 
3:56 PM
@CatPlusPlus Soon they're gonna have to choose between OS X 10.10 or OS X 11 or Mac OS 11…
 
Mac OS X 11, probably. The next one is Mountain Lion.
 
Version numbers are not decimal.
 
@daknøk Which would ironically include only a poor X11 server
 
brb gonna eat
 
I always thought X stands for 10, as opposed to MacOS9.
 
3:58 PM
@Potatoswatter is there any other kind?
 
So my bet would be OSX 10.10.
 
@daknøk looks so nice, I love windows 7 :)
 
Unless they plan to really remodel the thing.
OS9 -> OSX wasn't a trivial update, AFAIK.
 
@jalf Linux integrates things more nicely.
 
X11 servers only come in "poor" kind.
 
3:59 PM
@Potatoswatter Yeah, but that doesn't make X11 any less poor
 
@CatPlusPlus OS 7 => OS 8 => OS 9 was, though. Well, relatively speaking.
 
Eh, it's Apple. Who cares, really.
 

« first day (490 days earlier)      last day (4441 days later) »