« first day (595 days earlier)      last day (4367 days later) » 

9:01 PM
Is everybody watching an Alien movie now? :)
 
Nope. I'm answering stupid questions on Stack Overflow.
 
I’m actually watching Tron Uprising
 
Like this one.
-4
Q: how to store a file in a char*

PeacefulSoulMy question is : how can i store the content of a .txt file in a char* is named m_str in c++? Kindly note that my file has a very defined format that i want to keep. I dont want to merge the lines together. I want what is one line 1 to stay on line 1, and what is one line 2 to stay in line 2. B...

Parser y u so vexing.
 
hehe :)
 
And this answer before wasn't down voted and it had the same error. :P
8
A: C++ Putting text from a text file into an array as individual characters

Radek 'daknok' Slupikstd::ifstream file("hello.txt"); if (file) { std::vector<char> vec(std::istreambuf_iterator<char>(file), (std::istreambuf_iterator<char>())); } else { // ... } Very elegant compared to the manual approach using a loop and push_back.

(See the revision history.)
 
9:08 PM
Well, the MVP isn't always obvious, and many programmers don't know what you're talking about if you try to explain the problem.
 
{} syntax to the rescue!
 
I should read less webcomics
and generally attempt to do more useful things
 
#define unless(x) if(!(x))
#define until(x) while(!(x))
// I'm a Ruby programmer!
 
Hm, not completely useless.
 
nope, epic fail
 
9:10 PM
I should eat more Goldbären.
 
Ruby, iirc has expr unless(expr); and such things
 
@RadekdaknokSlupik Are you from Germany?
 
@FredOverflow The Netherlands.
@DeadMG Ruby has unless and it's the same as if !
 
@RadekdaknokSlupik And you have Haribo Goldbären?
 
@FredOverflow Yeah.
 
9:11 PM
Do you also know Thomas Gottschalk? He used to promote Goldbären in Germany.
 
@user = User.find params[:id]
raise Sinatra::NotFound unless @user
@FredOverflow Nope.
 
you know
maybe I'mma write my Wide lexer or re-visit the spec
a change of project usually gets me out of slumps
 
I vote for #2.
 
Lol I still have the daklang spec. Piece of shit I'll never complete.
 
Obviously, I have no bearing on the decision, but I like voting anyway.
 
9:12 PM
 
@FredOverflow But I like Goldbären. They taste like the most tasty thing since pizza.
 
Gummy bears?
 
@FredOverflow I think I saw that commercial before.
Or just a déjà vu.
 
hmmmmmm
to add constexpr keyword/setting or not...
 
@RMartinhoFernandes No bearing? Is that a pun on the gummy bear discussion?
@RadekdaknokSlupik I don't eat sweets (?) anymore. But I still eat the occasional pizza at restaurants.
 
9:16 PM
Pizza is tasty as fuck.
 
@FredOverflow Yes. Even though I only learned you were talking about gummy bears after you posted the video.
Yes, I am that awesome.
 
@RadekdaknokSlupik Poor tasty, being fucked by pizza :(
 
FIXED
lol my daklang spec is ambiguous.
> If the parenthesized expression (the condition) yields yes, executes the given statement.
 
aaaaaaaargh
Y U NO TRUE/FALSE
 
Y U NO YES/NO
 
9:18 PM
because that's not what it's called
 
litb is back
 
> If the condition yields no and there is an else-branch, executes the statement of the else-branch.
*Trolling the puppy.*
 
you may as well call + "Fuckadoodlingcocksuckingwhore addition" instead of "arithmetic addition"
 
> if-then-else expressions are if-then-else expressions.
See, simple spec.
 
9:19 PM
> A statement is the smallest possible piece of runnable code that can stand on its own.
:P
 
@RMartinhoFernandes Do you like having a then keyword like in Haskell? Or do you prefer the C-style?
 
@RadekdaknokSlupik So, there is only one statement?
 
0 and 1 are both statements and they are both of the same length.
I have to redefine "statement", but it's difficult to come up with a good definition.
 
@FredOverflow I'm fine with both. Not strongly leaning towards any of them.
 
Is it possible to define an imperative language purely based on expressions, without statements?
 
9:21 PM
@FredOverflow No.
 
@RadekdaknokSlupik Define it based on the grammar.
 
@RMartinhoFernandes I like the then style better, because then you don't have to parenthesize the condition.
 
stmt:
  expr
  if-stmt
  try-catch-stmt
  { stmt-seq (opt) }
Hmm…
 
@FredOverflow You don't have to do so without it either.
See also: Go.
 
you couldn't even program super functionally or CPS because no statements means no return.
 
9:22 PM
> A statement is an expression, an if-statement, a try-catch statement, or a statement sequence enclosed in curly braces.
 
@RMartinhoFernandes Really? I thought heard Martin Odersky saying that it has to be parenthesized because of potential grammar ambiguity.
 
@RadekdaknokSlupik return, for, while, etc?
 
@DeadMG "super functionally"?
 
@DeadMG Not yet defined.
 
@RMartinhoFernandes Exclusively functionally.
 
9:23 PM
@FredOverflow Only if you don't use braces.
 
if a + b; // What does this mean?
if (a) +b; // this?
if (a + b); // or this?
 
@DeadMG Ah, but then it's not really imperative anymore.
 
I know
 
@FredOverflow Go mandates braces.
 
but what I'm saying is that you can't even do that.
 
9:23 PM
I'm not sure if I'll add loops. They can be achieved through recursion.
 
@RMartinhoFernandes Okay then it's easy.
 
You don't need return for that.
Haskell doesn't have return.
Well, it does, but it's not for that.
 
just because it doesn't explicitly have that doesn't mean that it doesn't have return.
 
Does Prolog have statements?
 
@RadekdaknokSlupik You'll piss at least 50% of potential users of your language off by leaving out loops in favor of recursion.
 
9:24 PM
@FredOverflow 50% of 0 is 0, so it doesn't really matter.
 
@Pubby Yes.
 
Does Forth? (doesn't everything have statements?)
 
@RadekdaknokSlupik lol
 
Loops can be achieved by using a function that takes a lambda.
 
I'm thinking about teaching recursion before loops. Am I insane?
 
9:26 PM
Loops can be achieved with some crazy continuation shit but at that point who cares anymore?
 
by the way
 
i = 0
algo::while(pure (int i) -> i < 10, weak -> {
  io::print(i)
  ++i
})
 
in Wide, I've been thinking of simply not including stuff like template<typename T> void f(std::shared_ptr<T> x)
 
What part?
 
the deduction part
 
9:27 PM
Ah. How would it work, then?
 
you could only do something like template<typename T> void f(T x)
 
@RadekdaknokSlupik Shouldn't the first argument be a lambda too?
 
@Pubby No, silly. It's an infinite loop.
 
9:28 PM
Your lambda syntax sucks.
 
What's with the pure and weak stuff?
 
My language sucks.
 
Too verbose.
 
@Pubby pure functions are pure, weak functions are not pure.
 
And they use the same syntax?
 
9:29 PM
No.
 
What does the loop pass to the first lambda?
Does it guess it needs to pass i?
 
weak-function:
  weak identifier(opt) parenated-function-args(opt) -> stmt
pure-function:
  pure identifier(opt) parenated-function-args(opt) -> expr
 
Wait, how can the first be a pure function if it uses a weak free variable :S
 
> Inheritance is wonderful if your application domain really is hierarchical. But people seem to be forcing all kinds of strange things into hierarchies, and having hierarchies just for the sake of hierarchies. You have a lot of programmers who think that "object-oriented" means "never use a free-standing function". [...] Inheritance has been seriously overused for the last couple of decades.
nice one Bjarne
 
@Pubby It doesn't. It takes one as parameter.
Don't ask what is passed in.
 
9:30 PM
@FredOverflowi wholeheartedly agree
 
xD I'm laughing at my own spec now.
 
@RadekdaknokSlupik Why did I read that as "penetrated-function-args" first?
 
le yawn
 
i once worked on a code base that had an iterator you need to use like this:
 
@RadekdaknokSlupik Fill out the checklist!
 
9:31 PM
@Pubby I already did.
 
Give me the checklist results!
 
Iterator it(source, new IRange(0, 100), NULL /* no filter */); // iterate source from index 0 to index 100
 
> You appear to be advocating a new [...] programming language. Your language will not work. Here is why it will not work.
@Pubby lol
 
@JohannesSchaublitb new? BURN IT
3
 
9:32 PM
xD exactly
 
I'll add syntactic sugar for loops.
 
i burned it. never used that code haha
i guess the author thought it feels "clean", "nice OOP"
 
@JohannesSchaublitb // look, I'm a Java programmer
 
> Programmers should not need to understand category theory to write "Hello, World!"
@Pubby Why do I get the feeling that Colin McMillen, Jason Reed, and Elly Jones don't like Haskell? :)
 
9:35 PM
# Oh wait fuck it should be this:
i = 0
algo::while(weak -> i < 10, weak -> {
  io::print(i)
  ++i
})
I suck at my own language.
 
@FredOverflow I don't think they like any language
 
@RadekdaknokSlupik What is this weak shit? A lambda?
 
@FredOverflow a weak function is an function that is not pure. xD
Lambdas and functions share the same syntax. :(
 
The -> is confusing
 
Just name them good and bad.
 
9:36 PM
chaotic_good and lawful_bad
 
pure and impure
 
@RadekdaknokSlupik How is i < 10 not pure? Because i is not a parameter?
 
hardcore and softcore
@FredOverflow Has a captured mutable variable.
 
That's what I thought.
 
9:37 PM
I suck at my own language which sucks.
If you see the (incomplete) spec, you'll die.
 
Sell the spec to the US military
 
lol it's 12 pages.
 
And totally boring.
 
@RadekdaknokSlupik Pussy, I've shown my completely incomplete and suck spec
 
9:39 PM
fuck
-1
A: Partial specialization of member variable and method

Viktor LatypovYou may move the "char* surface" to the templated SimulationObject and write down the generic implementation of the operateOnSurface() method right in the header file. To distinguish between the Vector2D and Vector3D you may use the sizeof(). Yes, it might introduce some warnings, but the compil...

 
@DeadMG I never said that I won't show it.
 
> Yes, this may introduce some warnings …
oh, deleted, that was quick
 
hmmmm
a, b = { 1, 2, 3 }; error or fine?
 
what language?
 
mine
 
9:41 PM
How should we know if that's an error?
 
I'm not asking you if it is, I'm asking if it should be
since I'm right now writing the spec on that very point
 
What would it do?
 
@KonradRudolph It's not simply "not a good solution". It's not a solution at all. It ignores the fact that dead code has to compile anyway.
 
well, a is 1 and b is 2
the question is what to do about the 3 at the end
 
9:42 PM
@DeadMG Don't we have a=1; b=2; for that? Or would that be too simple?
 
@RMartinhoFernandes I didn’t even get that far in my train of thoughts, I just downvoted out of reflex
 
I wonder if that could work in C++
 
@FredOverflow Uh, not really.
 
@DeadMG Do you intend to allow: c = {1,2,3}; a, b = c?
 
Perl likes this just fine
 
9:43 PM
for one, you could also be talking about function f(a, b) {} f(1,2,3);
 
my $head, @tail = @something;
 
a, b = 1, 2;
 
and I'm calling that an error fo'sho
 
@KonradRudolph Oh gosh, sigils.
@Pubby std::tie(a, b) = std::make_tuple(1,2);
 
9:43 PM
@RMartinhoFernandes Much as I hate them, I have to admit that Perl puts them to good use
doesn’t redeem them though
 
@Pubby let (a, b) = (1, 2) in ... Haskell!
 
@Pubby discards a, assigns 2 to b.
Comma operator!
Or maybe I'm wrong.
 
let (a, b) = (b,a) in ... I wonder if that works.
@RadekdaknokSlupik Assigns 1 to b, returns 2.
 
@RMartinhoFernandes It works fine in Haskell.
 
@RMartinhoFernandes Try it and post results
 
9:44 PM
@RMartinhoFernandes Doesn't , have a lower precedence than =?
 
Prelude> let (a, b) = (1, 2)
Prelude> a
1
Prelude> 2
2
 
@RadekdaknokSlupik Exactly.
@FredOverflow Read again.
 
So, discards 1 and assigns 2 to b.
 
@RadekdaknokSlupik No.
= has higher precedence: a, (b = 1), 2.
 
9:46 PM
@FredOverflow Yes, of course 2 is 2 :)
@RadekdaknokSlupik That's my default state :P
 
@RMartinhoFernandes correct
 
@RMartinhoFernandes lol, b is 2 as well :)
 
Lol we both choose 42. How surprising.
 
@RadekdaknokSlupik I spend several minutes to prepare the example.
 
9:47 PM
I spent twenty seconds.
 
@RadekdaknokSlupik I couldn't think of any other number :)
 
@FredOverflow You should read it again: let (a,b) = (b,a). Note the lack of numbers.
 
@RMartinhoFernandes Something must be wrong with my brain tonight, sorry.
 
I think I'll leave the spec of my language in my never-to-be-completed-projects folder, and abandon it.
 
@RMartinhoFernandes It works because of lazyness, and you get an infinite loop if you evaluate a or b later. I guess it's important for that "tying the knot" business (getting doubly linked lists to work in a purely functional setting).
 
9:48 PM
what I really need is to simply go back to Dreamhost
Amazon is great, but...
 
Nah, doesn't type check.
 
I simply can't do without some form of HTML re-use
 
It's an infinite type.
 
right now, I actually have little idea of how far I AM
 
No wait, I usd a bad test.
 
9:50 PM
@RMartinhoFernandes Are you saying that let (a, b) = (b, a) is illegal? It does work fine in GHCI.
 
@DeadMG Amazon VPS hosting? Isn't that expensive?
 
@StackedCrooked No, S3 hosting.
it's free if you use less than a certain quota, and since my spec must get about 10 pageviews/month if that...
 
Then you're better off by making a Google doc public.
 
nah
 
9:51 PM
GitHub pages are nice.
 
I'd rather have an HTML thingymajiggy
 
You can use them Markdowns.
 
might just go back to Dreamhost and use PHP
 
it won't be that bad... for my simple use... just don't spend too long in it...
/shaking
 
9:52 PM
Git is a much better evil than PHP.
 
I use GitHub pages for my wobsite and I like it.
 
but I'm on BitBucket
 
Me too.
I only host my blog on GitHub.
 
You can create a GitHub account just for GitHub Pages.
 
Well, that and some forks of projects that are on GitHub, so I can fix bugs.
 
9:56 PM
by the way
how bad are locks in memory allocator code?
oh, ignore me, I forgot what the answer was going to mean anyway
 
lol
If you can make it lock-free, do so.
It's a pain, though.
 
lol
 
First-world problems: lock-free memory allocators are difficult to implement.
 
I can lock-free allocate quite easily
lock-free deallocation wouldn't be so trivial though
 
That's usually the complicated part.
 
9:58 PM
hmm, I'm not so sure
 

« first day (595 days earlier)      last day (4367 days later) »