10,892 reputation
23476
bio website evincarofautumn.blogspot.com
location United States
age 23
visits member for 4 years
seen 18 hours ago

I like programming, language, and collecting hobbies.


1d
awarded  Explainer
Sep
17
answered Is there a name for the technique of converting method parameters into a unified form to simplify further processing?
Sep
15
awarded  Yearling
Sep
13
answered Standardization and official guidelines for C++ template parameter naming
Sep
12
awarded  Enlightened
Sep
12
awarded  Nice Answer
Sep
2
awarded  Good Answer
Sep
1
awarded  Nice Answer
Aug
31
awarded  Guru
Aug
24
comment Why doesn't Python have a “flatten” function for lists?
What is an example of when you would need such a function? I’ve definitely needed to flatten an n-D array into a 1D array, but I don’t think I’ve ever needed the heterogeneous equivalent.
Aug
18
comment When is type testing OK?
Equality makes sense. In my experience, such methods often have a form like “if these two objects have the same concrete type, return whether all their fields are equal; otherwise, return false (or noncomparable)”.
Aug
5
comment How to replace inheritance with composition in this case?
Yeah, you posted while I was still writing my answer, though I didn’t read it until after I’d posted.
Aug
5
comment How to replace inheritance with composition in this case?
+1 Your example is equivalent to mine; I only chose a function because I find it simpler. An interface may help document intent, but it’s extensible, so the intent may be diluted over time if you carelessly add methods.
Aug
5
answered How to replace inheritance with composition in this case?
Aug
1
comment Why don't languages include implication as a logical operator?
Sure, I was saying it’s an interesting observation, but not something you should use in real programs because it isn’t short-circuiting and that could take somebody by surprise if they expected did_all_possible_stuff = x.do_required_stuff() and (x.supports_optional_stuff() <= x.do_optional_stuff()) to work.
Aug
1
comment What would the register-machine bytecode for this code look like?
@Prog: Since there is a limit on the actual number of registers available in hardware, what a compiler typically does is try to keep everything in registers, and “spill” to memory when that’s not possible. That’s something you need to do for good performance in either a stack VM or a register VM. Which one is “harder to compile to” depends more on your style of thinking.
Aug
1
answered What would the register-machine bytecode for this code look like?
Jul
30
awarded  Announcer
Jul
30
comment Why don't languages include implication as a logical operator?
This is awesome, but unfortunately has the wrong strictness properties: f() implies g() should not evaluate g() if f() is False, but <= does evaluate g() in this case.
Jul
27
comment Is too much whitespace a bad thing?
One thing to try: increase the line spacing in your editor’s display settings, so you aren’t tempted to insert so many extra line breaks.