« first day (1633 days earlier)      last day (3541 days later) » 

00:00
@sehe Thank you
@райтфолд i dislike this
and about the feeling--I'm temped to say this:
user1804599
@Xeo named arguments are not a substitute for designated initialisers.
what if you don't want to allow every member to be initialized?
> You can feel me any day if you know what I mean
Xeo
Xeo
00:00
@райтфолд Nonono - other way around. Using designated inits for named arguments.
@Cinch But I won't
Bwahahaahahah I make terrible jokes
user1804599
@Xeo oooh :P
@Cinch Bwahahaahahah you forget this is the lounge
These are nothing
Why do we still not have an alternative to ifdef _DEBUG yet...
user1804599
00:01
I thought of adding Haskell-like newtype to Mill, except with invariants.
Xeo
Xeo
@DavidKron because it should be #ifndef NDEBUG, if anything
user1804599
@DavidKron D has debug { … }. :P
@Xeo Thats a good start atleast
@райтфолд Exactly!
user1804599
In D you can do side-effects in pure functions but only in debug statements.
00:04
Interesting
If only d didnt have gc
What is this null_deleter() nonsense
Also I have a feeling that Events should be owned by a unique_ptr
since the Event is basically just a message
@Cinch then I'd expect it to be a Copyable
@sehe I think Move would be more appropriate, though
the only problem is Lua intergration, though
I'd not expect it to be dynamically allocated by definition
I'll play around with it and see
@sehe They are supposed to have a limited lifetime
00:09
I mean, e.g. std::string is a good message type
@sehe I do pass strings
@Cinch ... std::vector<Event>::clear()
user1804599
@DavidKron GC is nice.
@sehe ???
I'm using a Queue and I want to pop one at a time
> They are supposed to have a limited lifetime
How does that imply dynamic allocation
@Cinch deque, list, whatever; perhaps even a proper queue
00:10
@sehe Well because they are fired by whatever
They come into the queue, and they die after being received
Queues can contain values. Values can also be efficiently moved.
@райтфолд I wish life was as easy so you could just give things absolute properties such as nice that would hold in all cases. Sure, when you need GC its probably more than nice.
@sehe The events' contents are already being pointed to by a unique_ptr
The whole point of move semantics is just this: so the lifetime of a value can logically continue but with a new owner
2
00:11
@sehe Right, because I want logic to package the events and send them to the queue
@Cinch This is what I detected when I said
send though implies move... or am I wrong?
3 mins ago, by sehe
I'd not expect it to be dynamically allocated by definition
@Cinch yes. Move does not imply unique_ptr though (or even dynamic allocation)
@sehe Hm.
I'm a bit confused.
user1804599
I like how the clang source quotes the standard.
user1804599
00:13
// References aren't covered by the standard, but that's such an
// obvious defect that we cover them anyway.
@Cinch I'm not saying it is wrong. I'm just saying I wouldn't expect it. I'd love to send int messages, e.g. and the overhead of dynamic allocation would be deafening
user1804599
lol
Ergo. Make using Event = std::string e.g. and you can simply move the messages about.
@sehe The system is more geared towards structures, though
It's not supposed to just pass around ints
Why not. It's a library, no?
00:14
@райтфолд xD
because it's meant more for like a game event queue
Or it's supposed to pass a more descriptive data structure
@райтфолд Please link
i.e. I want to pass a Spell structure with a message or metadata related to that
user1804599
Warning: huge-ass page.
user1804599
00:15
It's the code that implements ADL.
@Cinch Also, struct { int a :3, b :2; bool something; std::string v; } perfectly movable, reduce memory allocations, and get better locality of reference to boot
@sehe but the point of the messaging system is to support an unenumurated amount of types
i.e. if I refactor the struct I refactor the message code?
no
Especially since I plan to have subsystems which require different data
@Cinch struct { spell_code code; player_ptr weak_target; player_ptr weak_origin; } - still better to pass by value
@sehe If I pass by value I don't want to have to copy this though
That would waste too much time sending to the event queue
awesome, i love the clang source
00:17
And messages can also facilitate subsystem stuff like graphics, audio, settings, etc.
user1804599
How do you run multiple commands with env vars?
@Cinch Separation of concerns mean that you leave it up to your callers to decide when they need to introduce the level of indirection (and the associated cost trade off). If you /tie/ your implementation to unique_ptr, the cost is sunk (and the library more coupled)
user1804599
A=B (foo && bar) is a syntax error. :v
@sehe Hm.
I don't understand what you're talking about
can you elaborate
@Cinch Read up. I already gave two samples.
00:19
@sehe "level of indirection"
user1804599
Ah, (export A=B; foo && bar).
idk what that's supposed to mean
@райтфолд Is that supposed to be c++? o.O
user1804599
No, it's Z shell.
Thought you had weird macros.. lel
00:21
@Cinch Simple. using Event = std::string; EventQueue<Event> myQueue; Simple. using Event = MyHugeAssStructure; EventQueue<unique_ptr<Event> > myQueue; - everybody happy. People insert the level of indirection when required
If the indirection through a unique_ptr is hard-wired into EventQueue your API sucks for some applications.
@sehe oh, right.
But that's already decided
The Event is already two std::strings for metadata and a flgl::any structure
Good. I was just commenting on it. (Didn't you sollicit feedback somewhere?)
@sehe I'd make it more general but that's what Boost.Signals2 is better suited for
user1804599
Let's try clang-modernize.
It's supposed to facilitate a more heavy-duty messaging... dream?
intent?
00:23
@Cinch Wow, so it's three dynamic allocations, plus your default unique_ptr indirection then?
@sehe idk anymore
I think I'll just keep at as std::queue<Event> for now
ITT C++ has become the new C#. Or Java.
@sehe No it's just passed by reference to the Event queue
I wonder if the compiler can optimize that away
@Cinch The point is "more heavy-duty" doesn't imply "I'll manage everything for you in the most enterprisey fashion" (that's the Java school of thought). On the contrary, in C++ it means "I'll treat your movable values with the respect they deserve, so you can use it to compose any memory layout/performance trade-off you wish to create"
@sehe Oh.
00:25
@Cinch before that, though, it needs to be created
@Cinch Keyword: Separation of Concerns.
Mitigating factor: don't optimize prematurely
I only mention it because it's one of the key elements in C++ API design I've come to regard highly. Maybe I'm too used to Boost
@sehe it's created on the stack it seems
The Event is created within a function and then passed by reference to the sender
@Rapptz hi
I didn't clean my keyboard
@Cinch how can a string be on the stack? And an any? (Hint: they can't). Why would a unique_ptr pointee be on the stack? (hint: right back at your message:
22 mins ago, by Cinch
What is this null_deleter() nonsense
)
00:28
I cleaned my spacebar and that was annoying
I'll do the rest some other day
@sehe The event is created on the stack
user1804599
UDLs were all the rage back in 2011, but does anyone actually use them?
Or something like that
the object's function created a new flgl::any object
@райтфолд Yes.
The standard library for one.
user1804599
What for?
00:29
Easy creation of objects.
No, sorry
23 mins ago, by Cinch
Also I have a feeling that Events should be owned by a unique_ptr
flgl::Event object
^ that would change that. And introduce the fourth dynamic allocation
I use them for numeric types too.
00:29
@sehe I suppose I shouldn't then
I think passing by reference/pointer is okay
wait, no.
@Cinch Not if it's on the stack. Just ... move the damn messages
I need to make sure the Event isn't deleted
@sehe Somehow it works, though
idk how
I think it's copied?...
That makes heaps of sense (puntended)
user1804599
> Whenever a reference is bound to a temporary or to a base subobject of a temporary, the lifetime of the temporary is extended to match the lifetime of the reference, with the following exceptions:
user1804599
TIL
user1804599
00:31
I suppose I can use UDLs for Mill strings and Mill numbers.
user1804599
And pseudo-UDLs true_mill and false_mill. :D
I'm so confused
i am now answering more questions than other questions not containing the java tag combined
daggunit
I never answer tags
ha ha ha. my 99wpm skills were Juseful there
00:37
we notussed
user1804599
Also, accumulate y u <numeric>.
although the "combined" word is redundant
@райтфолд I suppose it could be specialized for some SIMD instructionables on contiguous RA ranges etc.
morning c++aggots
user1804599
So? That's purely an optimisation.
00:39
I suppose it got designed around the time that valarray was also still a "good idea"
user1804599
It's not specific to numeric operations, so it should be in <algorithm>.
@райтфолд Which made it a "numerical" algorithm in their minds
@райтфолд And memcpy/memmove shouldn't be in <cstring> either
@райтфолд I agree. You asked, I answer. I'm not saying I agree
user1804599
Hmm, boost::optional<boost::none_t> x = boost::none;.
00:40
> I agree.
> I'm not saying I agree
user1804599
:D
Hi
@MomotapaLimpopo and reference_wrapper shouldn't be in <functional>
@MomotapaLimpopo this is fucking cool
hi momo
I like std::accumulate in <numeric>
allows me to use it without pulling everything in <algorithm>
user1804599
00:43
Bjarne has such a nice voice.
@Rapptz you must like the boost MPL header setup :)
I find that a bit annoying.
But I do a lot of subheaders like Boost does in general and a convenience header for the lazy.
I actually like Boost MPL style better than standard lib ("guess the header") style.
user1804599
if (std::strchr(argv[1], '/') || std::strchr(argv[1], '.')) {
    load_object(argv[1], get_global, set_global);
} else {
    load_object(argv[1], search_path, get_global, set_global);
}
user1804599
00:45
I can't figure out a good name for a function that does this. :[
I don't even know what it does.
@Rapptz And I like Fusion/Spirit/MultiIndex/PropertyTree/Interprocess/Containers style header even more.
@Rapptz Same! high5
user1804599
If the name contains / or . it passes it to load_object, otherwise it passes it and the search path to load_object.
I hate the namespacing glitches in Boost Geometry, e.g.
00:47
std::vector<std::weak_ptr<Event_Listener>> listeners;
user1804599
Perhaps it just belongs in main.
How to remove an element given the it?
user1804599
Not in some function.
It should just be listeners.erase(it) right?
@райтфолд `if (is_cromulent(argv[1])) { ... } else { ... }?
@Cinch yeah, beware invalidations
00:48
@sehe It gives me an error
user1804599
What does cromulent mean?
> //Pop events once
for(auto it : listeners)
{
Event e = events.front();

if (auto ptr = it.lock())
(ptr)->receive_event(e);
else
listeners.erase(it);

events.pop();
}
@райтфолд That's your problem. I meant to say, extract the condition into an expressive function name. "IsAbsolute" or "IsUnQualified" or whatever
user1804599
is_path.
1 min ago, by sehe
@Cinch yeah, beware invalidations
@райтфолд problem solved
user1804599
00:50
:)
@sehe this strange
@Cinch Also, did you store iterators in listeners? for(auto it : listeners) looks odd
@sehe no i stored the weak_ptrs
I just want to remove the weak_ptr from the list if it is invalid
So why name it it?
not an iterator
bad name lol
00:51
if listeners is a std::vector
it's not an iterator
what is it?
ranged based for loop dereferences the iterator
@Rapptz oh fuck.
it's a weak_ptr.
00:55
@Cinch looks like
     std::for_each(
        listeners.begin(), listeners.end(),
        [](Listeners::value_type& v) { if (auto ptr = v.lock()) ptr->receive_event(e); });
     listeners.erase(
        std::remove_if(listeners.begin(), listeners.end(), [](Listeners::value_type&v) { return !v.lock(); }),
        listeners.end());
to me
@sehe Where was that lockfree logging thing you did a while ago?
user1804599
Meh, std::for_each.
@MomotapaLimpopo did I?
@sehe why use for_each
Why not
00:57
Yeah with some Indian guy
ugly
@MomotapaLimpopo If you find it, remind me
Hm. I'll try.
it's sooo ugly
also it finally compile
@Cinch I'm of course pointing out that you're doing different things, and if you actually use the algorithms that exist for the purpose you won't write the twisted nest of bugs that you did
00:58
@sehe perhaps, yeah...
I'll keep this in mind
Of course, you'd always have the proper helper/libraries and just write
     for_each(listeners, [](auto& v) { if (auto ptr = v.lock()) ptr->receive_event(e); });
     remove_and_erase(listeners, mem_f(&ptr::expired));

« first day (1633 days earlier)      last day (3541 days later) »