« first day (945 days earlier)      last day (4002 days later) » 

1:00 PM
> Note that std::endl is a function but it needs full qualification, since it is used as an argument to operator<< (std::endl is a function pointer, not a function call)
 
@ThePhD You'll have to define a hash function for your any types so they are unique
 
user142019
Also don't use Wikipedia as a C++ reference.
 
@TonyTheLion I've got that covered.
 
user142019
Use cppreference.com or the C++ standard.
 
It's getting the first any that matches the any I want...
 
1:01 PM
@ThePhD where does type_info come from?
 
user142019
@TonyTheLion boost::any stores it.
 
@rightfold std::unordered_set::find will find an element with a specific key, if there is more elements with the same key, then it will give you the first it finds
 
Yeah, all I want is the first matching element.
 
If it doesn't find what you're looking for, then you have crap hash function, most likely
 
Originally I had type_info, void* on an unordered_map
 
user142019
1:02 PM
Don't use boost::any (i.e. fix your design) and problem solved.
 
That's... not even an option..
 
@ThePhD auto found = myset.find("foo"); if (found != myset.end()) //do stuff
 
Oh, whatever. I know how I'll fix this.
 
user142019
boost::any is worthless.
 
user142019
It's basically just a somewhat safe void* with value semantics instead of pointer semantics.
 
1:03 PM
boost::any makes things a bit vague
 
@rightfold Is it wrong in this case?
 
Ell
@rightfold so... it's not worthless is what you're saying?
 
user142019
@Ell That it's a safe void* with value semantics doesn't mean it isn't worthless.
 
user142019
With C++ you can't do anything useful if you don't have the type at compile-time.
 
user142019
You need to know the type somewhere if you want to use an object of such a type.
 
Ell
1:05 PM
oh wait.
 
user142019
You can't use boost::any without boost::any_cast, which requires a type at compile-time.
 
Ell
Yah :P
I misunderstood. My apologies
 
user142019
So why not use boost::variant in the first place and save a lot of headaches.
 
Because variant says you know all the types you'll be converting to ahead of time.
I don't know all the types I'll be converting to and from ahead of time.
 
why?
seems like bad design, if you ask me
 
user142019
1:06 PM
Uh.
 
Because it's outside of the scope of the engine?
 
This slightly modified program is rejected by Clang, although not GCC: when the (this time) explicit instantiation takes place, there is no overload of do_func yet declared to be found by ADL. What is the difference when the instantiation is implicit? — Luc Danton 2 mins ago
 
user142019
@ThePhD That's what they invented templates for.
 
Why I usually whine about ADL, sometimes it hides bugs.
 
It stores multiple different types in a single container. Templates/variant does not cover this use case.
The interface to get the type is fully templated. But the storage is an any. It is not unavoidable to use any in this case and it serves its purpose.
 
user142019
1:08 PM
template<typename... Ts>
using variant_vector = std::vector<boost::variant<Ts...>>;
// It's a miracle! A single container with multiple types of values!
 
Congratulations. Now, how do you declare that variant vector for other people - your code and someone elses - to use?
Hint: you only get 1 vector.
 
why only 1 vector?
are you on an embedded system?
 
Because my entire engine isn't one giant template?
 
user142019
variant_vector<int, float, mpz_class> numbers;
variant_vector<troll, slime> enemies;
 
1:10 PM
that's not a good reason
 
user142019
Multiple vectors!
 
seriously, you can't add arbitrary constraints like that
 
user142019
@ThePhD Make it one.
 
you're making things difficult for yourself
 
user142019
Even better, make it header-only.
 
1:11 PM
lol
 
... They aren't fucking arbitrary constraints. I cannot demand the user to supply every type they're working with, ahead of time, before they even know it.
 
Oh gawd :/
 
user142019
If your users don't know the types they're using, they're fools.
 
I also can't ask them to know - ahead of time - all the plugins that are going to be loaded.
 
user142019
PEBCAC
 
user142019
1:12 PM
C++ doesn't have a standard ABI so you pretty much need a C API for plug-ins.
 
this ^
 
@LucDanton template void func(a::item); haven't seen that syntax before
 
user142019
@StackedCrooked Me neither.
 
Please, point me to a runtime plugin/mod system that can be fully resolved at compile time in any system at any point in the whole wide existing world.
 
Ah, explicit instantiation.
I never used that, but I've read about it.
 
1:14 PM
When you can figure that out, let me know; I'm genuinely interested in how you do it.
 
user142019
@ThePhD You can't since you don't know the types at compile-time. But the funny thing is, in C++, you can't do it with boost::any either.
 
@ThePhD Most plugin systems expose some interface to which the user or implementor of the plugin has abide if he wants to create a plugin.
 
@ThePhD You want a system that changes runtime information into compile time information? :D
 
user142019
LLVM!
 
You need self-modifying code for that.
 
1:15 PM
._.
@StackedCrooked An ability which C++ lacks (no reflection).
 
Ell
He just wants a system where he can keep arbitrary things in a vector
 
user142019
Use Go problem solved.
 
Ell
and then operate on them
if he knows what he wants to do to them it's fine
 
So, the best way to handle it is a type-erased container that can be queried by others in the future for the systems they need to make their plugins / mods work.
 
@ThePhD Stroustrup's code guidelines for fighter jets explicitly forbade the use of self-modifying code.
But it's indeed not a C++ feature.
> AV Rule 2 There shall not be any self-modifying code.
> Rationale: Self-modifying code is error-prone as well as difficult to read, test, and maintain.
 
user142019
1:17 PM
If we have compile-time reflection in C++ and it's sufficiently advanced, you can implement runtime reflection using it.
 
std::tuples are sort of introspective
 
Ell
@ThePhD but the thing is - if the plugins know what data they're gonna be using, why would they put them into your vector where they have to cast every time?
 
user142019
@StackedCrooked Boost.Fusion!
 
There's the boost library that implements a preprocessor. Forgot its name.
 
Ell
Boost.Preprocessor? :P
 
1:20 PM
not that one :)
 
user142019
Wave?
 
user142019
C++ should deprecate the C preprocessor.
 
You can have compile-time introspection if you add an extra build step in your build system.
 
user142019
If people want a preprocessor, they can use M4 with their build system.
 
user142019
1:21 PM
The C preprocessor is retarded.
 
You generate a header containing meta-info from your code in the first build step. And in the second buildstep your include that header in your actual code. Then you (sort of) have compile-time reflection.
 
if ( !Services.ContainsService<SomeoneElsesModType>() ) { /* Well, the rest of my code can't work. Alert the user they need to have SomeoneElsesMod so MyMod can work; */ alert_user( "You need SomoneElsesMod to run MyMod v 1.2.3" ); }
@Ell ^ For that reason
 
Ell
It's good for what it does
which is copy pasting
 
user142019
@StackedCrooked There's an ORM library that does that, IIRC.
 
@ThePhD Mod? for what?
 
1:22 PM
@melak47 Nothing important. Literally.
 
user142019
@ThePhD EWW JAVA GET IT OUT OF HERE
 
Qt does something like that as well.
 
user142019
Objective-C has neat reflection capabilities.
 
Ell
@ThePhD How about giving each mod a manifest of a known type? Then have a vector<Service> so you can query version/name etc. of a mod
that is much better than relying on typeinfo imho
 
@rightfold Yeah, very dynamic.
A few years ago I experimented with Objective-C++ interaction and C++ function objects.
 
user142019
1:23 PM
Cocoa uses Objective-C properties and method swizzling to implement binding objects to controls and it works awesomely.
 
String comparision and integer comparison > compiler type information and whatever checks the person adds to it. Interesting...
 
user142019
@StackedCrooked I wish I could do friend @class SomeObjectiveCClass;. :(
 
IIRC there's also a scripting language that has C++ syntax.
 
user142019
And that auto x = [NSString string]; deduces NSString* and not id.
 
user142019
@StackedCrooked C++?
 
1:25 PM
lol yeah
Actually, it's a c++ interpreter.
 
user142019
Lisp has bestest reflection. :D
 
Ell
@ThePhD It would mean you could have minor/major mod versions. e.g. if something requires MyModv4.* how would that work using typeinfo?
 
Lisp is the king of reflection.
 
user142019
Lisp is reflection.
 
reflection is lisp
 
Ell
1:26 PM
data is code
 
user142019
@Ell "Code is data" is more accurate.
 
@Ell Get Mod Type -> Check Version Information yourself
 
user142019
Not all data is code, but all code is data.
 
I have Rewrite still running in the background. The music is quite pleasant.
 
Ell
@ThePhD Not quite sure I understand. Give me an example (in pseudocode if you wish) of how it would work, like your example up there
 
1:28 PM
if ( !Services.ContainsService<SomeoneElsesModType>() ) {
    /* We can get a statically-typed structure that refers to another mod*/
   SomeoneElsesModType& sem = Services.GetService<SomeoneElsesModType>();
   sem.Version; // Do some version checking
   sem.OtherInformationOtherPersonBuiltIn; // Or whatever fucking else they put on their structures
}
 
user142019
Use Ruby.
 
@Ell ^
 
Ell
But if they are different versions, they will have different typeinfo, I think?
 
Types from modding libraries will stay the same. The actual data in the runtime structure can change.
You can perform as much or as little checking as you want.
And if you really want to be nightmarish about it, you can stick the version number on the type itself (a really dumb idea).
 
user142019
I hope that your engine breaks when you're going to use a mod compiled with a different compiler than the engine.
 
1:31 PM
Shrugs. Meh.
 
user142019
Where everything else sucks at concurrent programs, Erlang sucks at sequential programs. :P
 
I've been thinking about how to implement a multi-processing library in C++ that has an api which resembles a threading api.
 
user142019
Interesting.
 
The main application would start and create workers by forking itself.
This ensures a shared code base which enables type-safe api.
 
user142019
1:38 PM
You could write a custom allocator that allocates objects in a shared memory area.
 
Yes, shared memory, or message passing.
 
user142019
@StackedCrooked Take it even further: make it work over the wire! :D
 
But message passing requires that all shared data is serializable.
@rightfold Naturally.
I've also been tasked at work to implement a new rpc system.
 
user142019
ØMQ is very good at message passing and it works in-process, between processes and over TCP.
 
user142019
It automatically reconnects and stuff.
 
user142019
1:41 PM
But yeah, it requires serialization (obviously).
 
Ell
@ThePhD but when a mod's code changed, typeinfo will change
 
Xeo
@StackedCrooked I love the OP (Philosophyz)
But Rewrite really got an excellent soundtrack
 
@rightfold why serialization? just send a reference id of the object you want to send, and the recipient can query the members over the wire again, one by one :p
 
user142019
You still need to serialize data you want to send.
 
user142019
"Query the members" those members need to be serialized.
 
1:43 PM
@rightfold That's why I use std::tuple for all my data structures.
 
user142019
Boost.Fusion!
 
only allow primitive types :D
 
A std::tuple is serializable as long as each element is serializable.
 
user142019
Auto-serialization is bad.
 
user142019
Make a Serializable concept.
 
1:44 PM
No it's awesome.
 
user142019
No. It sucks.
 
boost has a serialization thing
 
user142019
It's awesome if you have no user-defined types.
 
Auto-serialization is awesome.
 
Ell
I dislike it greatly (Boost.Serialize)
 
user142019
1:45 PM
Auto-serialization doesn't work.
 
It should default to auto-serialization unless you provide your own serialize.
 
@Xeo Agreed!
 
Ell
Google protobufs is awesome
 
user142019
@ThePhD You're a badlet.
 
Most background tracks are cheerful. (without being stupid)
 
user142019
1:49 PM
 
Ell
man javascript is bad
 
Haven't seen @Johannes lately.
 
user142019
~ [ man javascript | cat                                              ] 3:53 pm
javascript(n)           HTML and Java Script Generation          javascript(n)
______________________________________________________________________________
NAME
       javascript - Procedures to generate HTML and Java Script structures.
 
user142019
@Ell "Java Script" indeed, man javascript is bad.
 
@Ell bad man pages?
@rightfold lol
 
1:54 PM
@ThePhD I don't suppose you have any idea why the Vertex Shader output thing is so deformed for me? :S
 
user142019
Oh, it's a Tcl package.
 
@rightfold TIL JavaScript is a Tcl package.
 
user142019
I don't even have Tcl installed.
 
@melak47 What does it look like at the end?
 
@rightfold tclsh perhaps?
 
1:55 PM
@ThePhD fine, pixel shader and OM stages are the right size
 
user142019
@StackedCrooked Yes.
 
but he VS preview/visualization/??? is 2092x173 O_o
 
user142019
Is Tcl worth learning?
 
user142019
I have never seen it used except for Tk.
 
1:55 PM
Tcl is a clumsy language.
 
user142019
And Tk is horrible.
 
It has some nice features.
But it's just not fun.
 
user142019
When I use Python I miss Ruby.
 
6
Q: How do Lisp (Clojure) and Tcl compare in terms of abstraction and metaprogramming abilities?

StackedCrookedBoth seem to be good for building extensible API's and code generation. What are the main differences between them? What do you see as their strengths, weaknesses, ...

 
@ThePhD the input assembler stage looks fine, too
 
1:56 PM
That question was of course immediately closed. But it was reopened later.
 
user142019
I can't do `llvm-config --libs all`.gsub(/-l/, '').split in Python. :(
 
@melak47 It's probably auto-zooming on the available visible vertices. Shrug.
 
I think the only redeeming feature of Ruby might be its blocks. And its DSL abilities.
 
@ThePhD also, everytime I capture it, the VS preview is a different size
 
@melak47 Well, if it always appears fine in the end, I can't rightly tell you what's wrong, except maybe you've got a wonky matrix or something, or that your original data is weird.
 
user142019
1:58 PM
@StackedCrooked I like its readable syntax.
 
@ThePhD input assembler shows the model fine - no distortion there
 
user142019
I find Ruby much more readable than Python, actually.
 
Yeah, but a lot of that is due to blocks.
I think.
 
user142019
Except when morons use two-space indentation but yeah.
 
user142019
2:00 PM
I like Go for its strictness.
 
Xeo
@StackedCrooked What programm is that?
 
user142019
If you forget to remove an unused import it breaks the build. :D
 
user142019
@Xeo Stickies
 
@Xeo Stickies, a builtin program on Mac that resembles post it notes.
 
Xeo
ah
 
user142019
2:01 PM
I use OmniOutliner for todo lists.
 
@ThePhD the size seems to remain the same throughout one diagnostic run, but changes with each one. gahh
 
Xeo
@StackedCrooked Note that the story undergoes a slight shift in the near future ;)
 
@rightfold I have an rtf file in my dropbox that I use as my global todo list. It's gotten quite big over the years.
 
@melak47 PIX is running circles around you.
 
@Xeo Ha, slight?
Ok.
 
Xeo
2:02 PM
:)
It's pretty awesome
 
@ThePhD thing is I didn't use to get this behavior, but I can't figure out what I'm doing different :p
 
@melak47 You're living and breathing still. D:<
 
Xeo
I hope you have prepared yourself to spend 40+ hours on Rewrite
 
@rightfold I'll have a look at that.
I think I should be able to make money by creating such small programs.
 
@Xeo who, me?
 
user142019
2:03 PM
@StackedCrooked What programs?
 
Xeo
@melak47 Stacked
 
@Xeo oh. was gonna say "but this is the rewrite" :p
 
@rightfold For example something like OmniOutliner.
 
user142019
Ah.
 
user142019
Well, The Omni Group does it.
 
2:04 PM
Publish it on the app store.
A GUI application that enables a feature that is normally only available via the command line.
Small, but useful.
Ask $10 :D
 
user142019
su -c 'rm -rf / --no-preserve-root'
 
lol
For example a GUI tool for configuring deamons.
Something that makes it easy for the normal user.
 
user142019
An advanced find and replace utility that works on multiple files, works with regexen (use Perl!) and can show a diff before writing the changes to disk.
 
Ideally something that you need yourself.
That means other people need it as well.
 
user142019
I have everything I need. :(
 
2:09 PM
I created this purely for myself. And it has users.
Same with Coliru actually.
But that was also encouraged by the lounge :)
 
user142019
@StackedCrooked A colleague made this and it's been in the news several times.
 
Making money off that stupid law :P
 
user1182183
Hm guys, what would be an elegant way to swap bits? something like
`Swap(short bit_1, short bit_2, T variable)` I just cannot come up with a solution without writing a function that has hudreds lines of code XD
 
Why do you need to swap bits?
 
user142019
@StackedCrooked For sandboxing you need a special Linux kernel right? Or do you just use chroot?
 
user1182183
just a fun project for obfuscating variables from debuggers (cheat engine)
 
@rightfold chroot
 
user142019
How do you prevent people from using all RAM?
 
I would like to have a better system though. But they all require a lot of work to set up.
@rightfold I don't.
 
user142019
2:13 PM
Oh. XD
 
user142019
@StackedCrooked Such as VMs?
 
VMs or Linux Containers.
 
user1182183
Lol VM's are easy to set up?
 
user142019
Docker!
 
user1182183
or has something gone wrong in this world I don't know about?
 
2:14 PM
@ThePet Not on my VPS for some reason.
 
user142019
Say you use VMs.
 
user1182183
@StackedCrooked oh VPS. well I don't know much about unix
 
user1182183
but I bet there's a per-user or application manager
 
user1182183
for system resources
 
user142019
How would you do that? Have a VM pool that you periodically reset from a disk image or start a new fresh VM for each code snippet?
 
user1182183
2:15 PM
9
Q: How to create a user with limited RAM usage?

myWallJSONSo I have 4 GB RAM + 4GB swap. I want to create a user with limited ram and swap: 3 GB RAM and 1 GB swap. Is such thing possible? Is it possible to start applications with limited RAM and swap avaliable to them without creating a separate user (and not installing any special apps - having just a ...

 
user1182183
:P
 
I would have one VM running and execute commands on it using ssh user@vm command
 
user142019
Ah.
 
The webserver would run on the VPS and invokes the command on the VM.
 
user142019
Docker seems nice but requires a specific kernel.
 
2:17 PM
Hi guys :D This is totally C++ unrelated but I'm asking the question here because.. well.. this is the chat with most people :D - I'm searching for a source that could help me get insight in the power consumption of a cellphone, comparing the power used when streaming audio over FM waves (so like you do when plugging your headphones in and tuning in to the local radoistation) and through streaming the audio over 3G
 
Linux Containers look interesting.
There's no runtime cost. And well supported.
And reuse of the VPS kernel.
@rightfold Thanks, that looks potentially interesting.
Another possibility would be that the VM posts a GET request to the webserver waiting for a task. When the webserver receives a user program it is given as response to the VM.
In return the webserver then needs to wait for a POST request of the VM which contains the result.
And this is sent as reply to the user.
I've had many ideas over the past few months.
Just a proof-of-concept though.
 
2:41 PM
The gravatar, if you don't look closely, almost looks like Captain Falcon.
 
Ell
I've been stuck on one goddam js script for months.
All it has to do is cycle through facebook messages and download them :(
 
2:58 PM
@AndyProwl: Not sure if the use of boost::bind in stackoverflow.com/a/16625533/179910 really makes a lot of sense. Do you know of a compiler that supports C++11 style auto, but not std::bind?
 
Hah, good catch.
 
@JerryCoffin: Actually, I totally missed the usage of auto, even though I copy-pasted it
I will edit, thank you
 
@AndyProwl Surely.
 

« first day (945 days earlier)      last day (4002 days later) »