881 reputation
36
bio website bryanstamour.com
location
age
visits member for 1 year, 11 months
seen 3 hours ago

Aug
28
comment Why don't compilers inline everything?
Inlining through a virtual dispatch is very difficult, but not impossible. Some C++ compilers are able to do it under certain circumstances.
Jun
24
awarded  Good Answer
Jun
24
comment Why are data constructors with the same name disallowed in different type constructors?
I'm not a GHC dev, so it's just hear-say. I hope it happens too.
Jun
23
answered Why are data constructors with the same name disallowed in different type constructors?
Jun
18
awarded  Nice Answer
Jun
18
comment Mental Models or Real-World-Metaphors for Functional Programming
Good catch: yes, the dot operator applies the second function before the first. The same way that f . g typically means f(g(x)) in mathematics.
Jun
18
comment Mental Models or Real-World-Metaphors for Functional Programming
You're welcome. Glad I was able to help.
Jun
18
comment Mental Models or Real-World-Metaphors for Functional Programming
I would say the functional way of thinking might be better at modelling how data flows through a process. Instead of assembling objects and method calls, like in OOP. The thing about metaphors though is they can only take you so far. At the end of the day functional code is functional, and OO code is OO. shrugs.
Jun
18
comment Mental Models or Real-World-Metaphors for Functional Programming
In a pure functional language with no global variables, then one assembly line cannot affect the other (unless it's feeding the other line input.) Theoretically any assembly lines that do not depend on one another can be executed in parallel, but I'm not sure if any compilers do this.
Jun
18
revised Mental Models or Real-World-Metaphors for Functional Programming
added 133 characters in body
Jun
18
answered Mental Models or Real-World-Metaphors for Functional Programming
Jun
5
comment Is there a Design Pattern for preventing dangling references?
Yes, that is true.
Jun
5
answered Is there a Design Pattern for preventing dangling references?
Apr
9
comment Wrapper around C++ STL
Only if you add additional data members. Extending an stl container by simply wrapping it or adding extra member functions should be fine, as there's nothing new to destroy.
Mar
26
comment Is it fine to make a default constructor unusable?
If you can use C++11, then explicitly mark it as deleted: CSV_Entry() = delete;.
Feb
3
comment using unsigned integers in c, c++
I said stay away from modern C++, not C++ in general. Modern C++ style is full of exceptions and other scary things, apparently.
Feb
3
comment using unsigned integers in c, c++
I highly doubt that half of all C++ programmers are incapable of using exceptions properly. But anyways if you think that your co-workers are incapable of writing modern C++ then by all means stay away from modern C++.
Feb
3
comment using unsigned integers in c, c++
Even Microsoft agrees with me (gross!) msdn.microsoft.com/en-us/library/vstudio/…
Feb
3
comment using unsigned integers in c, c++
I don't see how the type of application makes a difference. Any time you call a constructor on an object you are establishing an invariant with the parameters. If that invariant cannot be met, then you need to signal an error else your program is not in a good state. Since constructors cannot return a flag, throwing an exception is a natural option. Please give a solid argument as to why a business application would not benefit from such a coding style.
Feb
2
comment using unsigned integers in c, c++
That's not what I mean at all. Constructors are for establishing invariants, and since they are not functions they cannot simply return false if that invariant is not established. So, you can either separate things and use init functions for your objects, or you can throw a std::runtime_error, let stack unwinding happen, and let all of your RAII objects auto-clean themselves and you the developer can handle the exception where it is convenient for you to do so.