« first day (82 days earlier)      last day (611 days later) » 
08:00 - 21:0021:00 - 22:00

8:28 AM
The Haskell code I started on is a port of the original Wolf 3D. My notes from four years ago on the iOS port: http://www.idsoftware.com/iphone-games/wolfenstein-3d-classic-platinum/wolfdevelopment.htm
 
user142019
@FredOverflow I am aware.
 
user142019
I follow him. :v
 
@rightfold I didn't expect Mr. Clever-Square-Root to be interested in Haskell.
 
user142019
He mentioned in an ancient article that he wanted to use Haskell in a game.
 
Any particular reason why?
 
user142019
8:31 AM
Because he was interested in functional programming.
 
user142019
It was an article about premature optimization, IIRC. Let me find it.
 
Is not using FP a form of premature optimization? :)
 
user142019
I really don't know the title of the article anymore.
 
> This time Wolfenstein 3D will be perfect without any bugs whatsoever, just because Haskell does type checking. Haskell makes every program you write in it perfect without even trying. Or testing. lol
 
user142019
> One of the things that’s also fed into that is my older son’s start­ing to learn how to pro­gram now. I actu­ally tossed around the thought of should I maybe have him try to learn Haskell as a 7 year old or some­thing and I decided not to,
 
user142019
8:33 AM
> that I, you know, I don’t think that I’m a good enough Haskell pro­gram­mer to want to instruct any­body in any­thing, but as I start think­ing about how some­body learns pro­gram­ming from really ground zero, it was open­ing my eyes a lit­tle bit to how much we take for granted in the soft­ware engi­neer­ing com­mu­nity, really is just lay­ers of arti­fice upon top a core fun­da­men­tal thing.
 
user142019
Carmack's longest sentence ever.
 
> how much we take for granted in the soft­ware engi­neer­ing com­mu­nity
What does he mean, exactly?
 
user142019
You take a lot of things for granted. Besides that, I have no idea what he means exactly.
 
user142019
Perhaps that because we were all thought imperative languages, we also think imperatively when programming?
 
user142019
8:37 AM
Many people call imperative programming "normal" and functional programming "special" or "not normal" or "different".
 
How is x=x+1 normal? ;)
 
user142019
x :: Int
x = x + 1
 
Won't this cause a stack overflow or something?
By the way, I wimped out and made lexeme way more explicit:
lexeme :: Parser a -> Parser a
lexeme parser = do
    x <- parser
    spaces
    return x
@rightfold Instead of talking to LLVM in terms of classes and whatnot, can't I just feed it a "text file" with LLVM assembly language?
 
user142019
8:58 AM
@FredOverflow Well, LLVM can't do assembly I think. Clang can.
 
user142019
If you mean the textual representation of LLVM IR, sure.
 
user142019
@FredOverflow No.
 
user142019
It will simply never terminate.
 
user142019
@FredOverflow Eww. :(
 
@rightfold I think I'm gonna do that, then. Seems a lot easier than dealing with C++ FFI or whatnot.
 
user142019
9:00 AM
You want to interface between Haskell and C?
 
user142019
(Because that's really simple as fuck.)
 
user142019
C++ not, because of name mangling.
 
I want to write a compiler in Haskell that targets LLVM.
 
user142019
OIC.
 
user142019
I don't like emitting text, but yeah you can do that.
 
9:01 AM
Have you ever done that successfully?
 
user142019
No, I have only used LLVM's IRBuilder, which builds an in-memory representation.
 
from Haskell?
 
user142019
Yes.
 
user142019
I used LLVM's C API and Haskell's FFI.
 
Ah okay, I thought LLVM only had a C++ API.
 
user142019
9:02 AM
Wrapped it in some nice types and functions so it was type-safe.
 
user142019
Building IR was something like this (very neat):
 
Anyway, I can start with the text-writing approach first, and if if turns out to be a bottleneck or whatnot, I can always replace it later. Or some desperate student looking for a bachelor project :)
 
user142019
f a b = do
    x <- add a b
    y <- mul x x
    ret y
 
How do you feel about other people touching your code?
 
user142019
I don't mind as long as the code isn't crappy, the coding style is consistent with mine and the Git commit message style is consistent with mine.
 
9:04 AM
And how do you feel about touching other people's code? :)
 
user142019
@FredOverflow It's absolutely fucking terrible in most cases.
 
user142019
Although Robot's code is quite nice, as well as Torvald's.
 
@rightfold Have you seen some real world code from Robot? Or just some toy examples?
 
user142019
Git, Linux and Subsurface have very readable code bases, and they're in C!
 
user142019
@FredOverflow Ogonek and that new range thing.
 
9:06 AM
Well, there is such a thing as readable C code. Keeping your functions short and choosing names with care is a huge step (as in any language).
 
user142019
I find human-readable assembly readable in some cases.
 
user142019
Because of descriptive labels.
 
user142019
:v
 
user142019
@FredOverflow Not in Java. :)
 
user142019
Since Java is 90% cruft and 10% actual code. So distracting!
 
9:07 AM
Back when I was writing inline assembly code, most of the time was spent writing good comments for every friggin line.
 
user142019
I used assembly only once.
 
Because when I came back to it a week later, just reading all those mov ax, bx lines wasn't very instructive :)
 
user142019
Because C++ can't forward varargs. :'(
 
Just pick on %esp directly or something? :)
 
user142019
The problem is
 
user142019
9:09 AM
the compiler might allocate registers that are used for passing arguments.
 
user142019
But you don't want to fiddle with those, that's the problem.
 
Right. Back in the days I was using Pascal, and that didn't do those opts.
 
user142019
It would be neat if I could tell the compiler "do not use these and these registers."
 
Also, Pascal didn't have varargs AFAIR :)
Well, these days inline assembly is pretty much deprecated and replaced with intrinsics. So you don't have to worry about register usage anymore.
 
user142019
This was an ugly edge-case.
 
user142019
9:11 AM
I couldn't use variadic templates since the code that called the functions was generated at runtime by LLVM.
 
Isn't programming quite often about handling ugly edge-cases? :)
 
user142019
Sure, I could have regenerated the function every time for each function in LLVM.
 
user142019
But meh.
 
user142019
Experiencing assembly for once is fun, and I learned quite a few things.
 
user142019
9:13 AM
I don't have the repository anymore; I deleted it LOL.
 
Oh, nicely aligned arguments. That also takes some time when writing assembly code :)
 
user142019
What do you mean?
 
cmpq 0(%r11), %rsi
je LCallImpl
-- vs. --
cmpq    0(%r11), %rsi
je      LCallImpl
 
user142019
Oh. :P
 
user142019
I thought you were talking about alignment of data.
 
9:18 AM
Especially when you find a cool and useful instruction later that is longer than all previous instructions, so you have to re-align :)
 
user142019
No problem in Vim.
 
user142019
Multiple cursors = WIN.
 
I think I used QBASIC or something for editing back then :)
 
user142019
cmpq    0(%r11), %rsi               // check selector
je      LCallImpl

cmpq    $0, 0(%r11)
je      LLookupSuper
 
user142019
I think I can remove the second cmpq and replace the second je with jz.
 
9:20 AM
But it compares something else, you can you remove it?
 
user142019
Both compare 0(%r11).
 
Also, je and jz are always identical. They have the same bytecode.
 
user142019
Oh. :L
 
@rightfold But once with rsi and once with 0.
 
user142019
@FredOverflow oh of course. :v
 
user142019
9:21 AM
%rsi is never 0.
 
user142019
Well.
 
Maybe it was hard to figure out because of the swapped arguments? :)
I'm also planning on non-nullability by default.
 
user142019
%rsi is the selector, not the receiver.
 
user142019
I.e. the name of the method to invoke.
 
user142019
The object is (%rdi).
 
9:22 AM
You compare names with a single instructions? Are they no longer than 8 chars? :)
 
user142019
The names are pointers.
 
user142019
I have a global selector table that the code generator and reflection read.
 
I love it how in C64 basic, you can make your names as long as you want, but everything after the second character is silently dropped :)
 
user142019
LOL
 
user142019
So you couldn't have more than 43 different names?
 
9:24 AM
employer = 123
print emperor
26*36 names, I think.
 
user142019
Why 36?
 
alphanum
 
user142019
Oh after the second character.
 
user142019
Right.
 
user142019
@FredOverflow _?
 
9:25 AM
But you only needed names for variables, so it was never a problem for me :)
Instead of functions, you had line numbers :)
@rightfold To be honest, I can't remember if the C64 had an underscore.
 
user142019
@FredOverflow In Haskell they could do that too and it would never be a problem. :P
 
But if you think about it, underscores don't really make sense unless you use at least three characters :)
@rightfold But you couldn't distinguish between >>= and >> then :(
 
user142019
>> is redundant!
 
user142019
Just remove >> and call >>= >> and everything is fine.
 
C64 basic also had integer variables denoted like i% (or was it %i?), but nobody ever used those.
Which is astonishing, because the default is floating point, and that is emulated in software :)
 
user142019
9:30 AM
What a terrible language.
 
I built some cool stuff with it, but the programs were basically (no pun intended) unmaintainable.
 
user142019
They should discontinue Visual Basic.
 
After the C64, I remember feeling very uncomfortable and "out of control" with PC languages that had no line numbers.
@rightfold Oh, is VB still being worked on? Why?
 
user142019
I have no idea why.
 
user142019
Make your language a dialect of C# that has no null.
 
9:33 AM
I'm afraid if I implement my Parser in Haskell, I'll get feature-envy and end up designing a superset of Haskell :)
@rightfold Except when explicitly asking for it?
 
user142019
Yes.
 
user142019
So Nullable<T>/T? works on reference types.
 
NullPointerException: She was asking for it!
 
user142019
It will run circles around C#, because it doesn't have to check for null every method call.
 
I'm gonna clone Java and simply rename references to pointers.
 
user142019
9:35 AM
I like Go. Value semantics by default.
 
@rightfold Yes, I also had that thought the other day and was drooling with efficiency hornyness.
 
user142019
s/hornyness/horniness/
 
user142019
Go is the best language ever.
 
user142019
Will your language allow for evil pointer fiddling if I want to?
 
9:49 AM
@rightfold You cannot do anything evil in my language. Maybe I should name it Jesus :)
 
user142019
:'(
 
user142019
It will be just as boring as Java. :'(
 
@rightfold Just kidding, you can enable all evil things with the following hack:
"Obama"[1] = 's';
 
user142019
const!
 
user142019
Immutability!
 
9:53 AM
No, this is a very special syntactic form. Using any other string, index or char is a compile-time error.
 
user142019
Sounds like your language has been influenced by PHP.
 
user142019
Because this is the kind of crap you'd find in PHP.
 
I don't know any PHP, and I don't plan to :)
 
user142019
In PHP, foo()[x] was a syntax error back in the days. :P You could use the subscripting operator only after a variable name.
 
user142019
Fucking annoying.
 
9:55 AM
how retarded
 
user142019
In PHP, captures in lambdas are explicit.
 
as in C++
 
user142019
$x = 42;
$foo = function() {
    $x = 2; // local variable
};
$bar = function() (&$foo) {
    $x = 2; // outer $x
};
 
user142019
This is so damn annoying.
 
user142019
@FredOverflow In PHP you have to capture each variable explicitly, and weird thing is that PHP is GC'ed so it's actually not even needed to have explicit captures.
 
9:57 AM
I am thinking about having two different syntaxes for pure and impure lambdas:
x -> x*x
s ~> println(s)
@rightfold I stared directly at the syntax :(
 
user142019
How are you going to verify purity?
 
user142019
Or is it contract-based?
 
@rightfold Shouldn't be too hard if I analyze the bodies.
 
user142019
If objects are all immutable it isn't a problem.
 
user142019
But otherwise you have a problem with references.
 
user142019
9:59 AM
Even when arguments themselves aren't references.
 
I'm pretty sure it's feasible. I'll let you know when I have implemented it (read: never).
 
user142019
struct Meh {
    int& foo;
}
func pureFunction(meh Meh&) { … }

x := 0;
meh := Meh{ foo = x };
pureFunction(meh);
x = 2;
pureFunction(meh); // oops
 
Oh, those kinds of references. I don't think I'm gonna have those.
 
user142019
Only value types. :D
 
So it won't be possible to implement swap in my language :)
 
user142019
10:02 AM
You don't need swap.
 
user142019
x, y = y, x Go FTW! Ruby FTW! Python FTW!
 
I could have hygienic macros that expand swap(x, y) into x, y = y, x...
 
user142019
In Go it's impossible to implement swap too.
 
user142019
Because swap is generic and Go lacks generics. XD
 
user142019
@FredOverflow Eww no.
 
user142019
10:03 AM
Don't do quasi-functions that look like functions but actually expand into something else.
 
user142019
That's like PHP's empty($foo), which works only on variables and is otherwise a syntax error. You cannot do empty($foo + $x).
 
user142019
(It wouldn't be a problem if that function worked on expressions, really, but it's implemented by some idiot.)
 
@rightfold How about macros must be ALL_CAPS?
 
user142019
No.
 
user142019
Make macro expansion explicit if you have them at all.
 
user142019
10:14 AM
In Erlang you have to use ?MACRO_NAME().
 
10:31 AM
0
Q: passing data members by reference

FredOverflowWhat happens if I pass a data member by reference to a function, and while that function is running, the Garbage Collector starts running and moves the object containing the data member in memory? class SomeClass { int someDataMember; void someMethod() { SomeClass.someFuncti...

@rightfold It seems both answerers have misunderstood me :(
 
user142019
@FredOverflow Uh, the integer is on the stack. :v
 
@rightfold What?
 
user142019
Ohh wait.
 
user142019
Didn't see that i was a class member.
 
i is a reference parameter.
I intentionally named the data member someDataMember :)
 
user142019
 
user142019
:D
 
Think of all the rep I will miss :(
 
user142019
@FredOverflow Basically, things in C# that are related to memory management just work.
 
> Of course, if you enjoy worrying about this stuff you can always use the "unsafe" feature to turn these safety systems off, and then you can write heap and stack corrupting bugs to your heart's content.
lol
 
user142019
As long as you don't fiddle with pointers and you don't do evil manual alignment with struct members, it's waterproof.
 
10:38 AM
in C#, 5 mins ago, by Oleg Orlov
when i see Linq eyes
look into my eyes
then i realize that
it could see inside my head
so i close my VS
thinking that i could hide
disassociate so i don't have to lose my code
this situation leads to C#
will it cut me off?
will this be an amputation?
 
user142019
(And as long as you don't have any UB, of course.)
 
also lol
hope you don't mind :)
 
user142019
D:<
 
user142019
12:06 PM
23 messages moved to Java Sucks
 
24 messages moved to Java Sucks
Ha, I win by 1 message!
 
12:40 PM
11
Q: How to break the "php is a bad language" paradigm?

dukeofgamingPHP is not a bad language (or at least not as bad as some may suggest). I had teachers that didn't even know PHP was object oriented until I told them. I've had clients that immediately distrust us when we say we are PHP developers and question us for not using chic languages and frameworks such ...

 
user142019
PHP is a bad language.
 
user142019
2:46 PM
RT ‏@hipsterhacker "What kind of meat comes on the Functional Object Burger?" "Lamb, duh."
 
4:26 PM
@rightfold my head hurts
 
user142019
Cool!
 
I think I'll take some referential transparency against the headache.
 
user142019
Hmm, you know?
 
know what
 
user142019
I will make structs with ctors and dtors.
 
4:30 PM
When will dtors be called?
 
user142019
When the object is about to be destroyed.
 
:D
RAII?
 
user142019
I think so.
 
So how will sharing work?
 
user142019
Shall I call null "nein"? XD
 
4:32 PM
nein
 
Please tell me exceptions aren't in Haskell.
I don't want to have to filter through the "Don't use goto"... "Raise/throw and catch exceptions to handle unexceptional errors"... stupid sheep advice :(
I wasn't expecting to find it on SO, but sadly I have...
 
@FredOverflow That seems sensible.
Am I totally insane for discouraging people from using try/catch in C# situations where goto would be more suitable?
 
user142019
Depends on the situation.
 
user142019
They are completely different things.
 
user142019
4:44 PM
Exceptions are for errors.
 
user142019
goto is for local control flow.
 
I'm gonna make a language so powerful that you can throw a goto.
 
Well, I've modified it as best as I can... I welcome your criticism: stackoverflow.com/a/16444461/1989425
Oooh. Maybe I should throw in an example of what I'd use.
 
5:04 PM
@undefinedbehaviour throw? pun intended?
 
 
2 hours later…
user142019
7:22 PM
 
user142019
> *Introduce yourself.*
 
user142019
> I'M WALTER BRIGHT.
 
user142019
> Thank you.
 
user142019
^ Nice introduction. xD
 
8:03 PM
@rightfold My browser doesn't support the video codec or something, but at least I can download it. Takes an hour to download though ;(
@rightfold Oh, just had to disable HTML5 and now it works. Awesome!
 
user142019
lol
 
user142019
Can any program be written without mutability?
 
user142019
Except perhaps stuff like drivers and kernels where you need to use memory-mapped devices.
 
8:18 PM
@rightfold Why use would a program be that had absolutely no side-effects?
@rightfold Is D in your top 5 of interesting programming languages?
 
user142019
@FredOverflow I have never used it.
 
user142019
I don't really know its feature set.
 
Compile-time function execution and meta-programming in general are its strengths, I'd say.
> An airplane looks like it wants to fly. [...] I want code to look like that.
awesome
 
user142019
@FredOverflow I'm not interested in those. XD
 
pretty sure it has no Monads
 
user142019
8:30 PM
Go's resource (except memory) management is pretty much like D's scope(exit).
 
user142019
What are your opinions on that?
 
Are you watching the keynote right now? Because I am at the scope-slide right now :)
 
user142019
I'm not.
 
@rightfold I guess I'm too used to RAII, so scope(exit) seems more like a hack to me.
(as does try/finally)
 
user142019
finally is horrible.
 
8:31 PM
What about using?
 
user142019
That's fine except for one part.
 
user142019
I don't like that you cannot execute code A on exception and code B on no exception. In Python with with you can.
 
user142019
I have no idea how to do resource management in Ø.
 
Can't you just write the "no exception" part at the end of the using block?
 
user142019
You can, but then you have to repeat it for every using block.
 
user142019
8:33 PM
I like Ruby's approach, actually.
 
> no 'faith based' programming
lol
 
user142019
File.open('hello.txt') do |file|
    # do whatever you want with file
end
 
user142019
The part from do to end is kind of a callback passed to File.open.
 
user142019
import file;

fun main() Unit {
    file.open("hello.txt", file.mode.write) |f| {
        f.write("Hello, world!\n");
    }
}
 
Walter Bright seems to be a huge fan of FP.
> FP has excellent track record of producing robust, reliable programs
 
user142019
8:38 PM
@FredOverflow Who isn't? (Except for idiots/noobs.)
 
I always forget that D has support for contract programming.
 
user142019
I think I'll go with value types and pointers.
 
user142019
And a garbage collector.
 
What exactly do you mean by value types? structs?
 
user142019
Or… with unique pointers, shared pointers and weak pointers built in to the language.
 
user142019
8:41 PM
@FredOverflow well, pass-by-value by-default.
 
By the way, have I shown you the awesome code I wrote yesterday? :)
 
user142019
C++-like.
 
eval :: Expression -> Int
eval (Constant i) = i
eval (Parenthesized x) = eval x
eval (Product x y) = eval x * eval y
eval (Sum x y) = eval x + eval y
 
user142019
Does Parenthesized have to be a separate AST node?
 
I may want to do stuff like automatic code formatting or something. And I don't want to kill the parenthesis in the process :)
 
user142019
8:42 PM
You can infer from the AST when you need the parentheses.
 
@rightfold That would still kill unnecessary parenthesis that were originally there.
 
user142019
Rust uses different kinds of symbols for different kinds of pointers.
 
Like, maybe the programmer really wanted to write (a*b)+(c*d).
 
user142019
@FredOverflow :D
 
user142019
Make it an error to use unnecessary parentheses.
 
user142019
8:43 PM
Problem solved. :)
 
@rightfold I know, like ^ for unique pointers and @ for shared or the other way around.
 
user142019
~ for unique pointers lol.
 
user142019
@ for GC'ed pointers.
 
I think it's a good idea. Writing ~T instead of std::unique_ptr<T> is just so much more concise.
 
user142019
export main;
import std.io;
import std.io.file;

fun main() unit {
    try {
        file.open("hello.txt", file.mode.read) { |f|
            f.each_line() { |line|
                io.out.writef("%s\n", line.split(/\s+/).reverse().join(" "));
            }
        }
    } catch (ex *file.open_error) {
        io.err.writef("could not open file: %s", ex.message);
    } catch (ex *file.read_error) {
        io.err.writef("error while reading file: %s", ex.message);
    }
}
 
user142019
8:54 PM
Fucking ugly.
 
user142019
Another possibility is obviously RAII.
 
user142019
But the problem with RAII is passing around objects.
 
user142019
You need lvalues and rvalues, and move and copy semantics.
 
user142019
And I'm afraid it will become a complicated mess like C++.
 
@rightfold You could start with C++ and throw away everything that's not essential, like strange conversion rules and bitfields or whatnot.
 
08:00 - 21:0021:00 - 22:00

« first day (82 days earlier)      last day (611 days later) »