code logs -> 2008 -> Sat, 22 Nov 2008< code.20081121.log - code.20081123.log >
--- Log opened Sat Nov 22 00:00:30 2008
01:20 Derakon[AFK] is now known as Derakon
02:07
<@Derakon>
Ahh, Perl. I'm pretty certain this is valid:
02:07
<@Derakon>
push @mods, shift @$list while (grep $list->[0] keys %$parts);
02:08
<@Derakon>
Or, in English, "move elements from the beginning of $list (which is a reference to a list) to the end of @mods (a normal list) so long as the first element in $list is found in the list of keys in $parts (which is a reference to an associative array)."
02:32
<@Derakon>
...I must not understand how Perl's grep works, because it's matching everything in the list. E.g. "grep('a', @alphabet)" gets me all of @alphabet back. Even if the alphabet is missing the letter 'a'.
02:35
<@Derakon>
Ahh, right, it wants a regex, not a string. That could be more helpfully messaged.
02:36
< himizzzz>
Almost all of Perl's functions like that take regexes
02:37
<@Derakon>
I wouldn't mind if, when a string is provided instead of a regex, it would turn the string into /$string/ for me.
02:50
<@Derakon>
Ahh, there. I now have a script that will de-Romanize translated words.
02:54 himizzzz [~fow035@Nightstar-13747.lns1.cbr1.internode.on.net] has quit [Ping Timeout]
02:56 himizzzz [~fow035@Nightstar-13747.lns1.cbr1.internode.on.net] has joined #code
03:01
<@Derakon>
Actually, this is really annoying. I want to be able to find the string '.' without having grep think it's any character.
03:11
<@Consul>
Can't you just escape it? \.
03:11
<@Derakon>
No, because in the context where '.' maps to a specific image file, it's a string, not a regex.
03:11
<@Consul>
Ah, I see.
03:12
<@Derakon>
Basically, I have a map of characters to image files which are the glyphs for those characters. And I want to use grep in my tokenizer to figure out if I'm looking at a normal glyph, o part-of-speech glyph, a vowel, or a fullstop.
03:20 gnolam [lenin@79.136.60.ns-4387] has quit [Quit: Z.]
05:23 * Derakon works on writing a Perl script to convert his dictionary into words in his conlang (randomly generated, of similar length as the input word).
05:24
<@Derakon>
In the past few months, I've tried to really cut back on eating when I'm not hungry.
05:24
<@Derakon>
Er, wrong channel.
05:38
<@Derakon>
Where's the dictionary file usually located, anyway?
05:42
< Vornicus>
/usr/share/dict/words
05:42
<@Derakon>
Ah hah, thank ye.
05:43 * Vornicus declares said thing useful.
05:44
< Vornicus>
what'cha doing with your conlang?
05:44
<@Derakon>
Making a lexicon.
05:45 * Derakon eyes. "'Aardvark' translates to 'wahu', apparently."
05:45
<@Derakon>
Oooh, and Aaronical translates to "derak".
05:46
<@Derakon>
But I think this lexicon's no good...I need to remove the "you can drop vowels in the middle of words" rule.
05:46
< Vornicus>
I mean, other direction. what is the conlang for?
05:46
<@Derakon>
Ahh.
05:46
<@Derakon>
Confusing my family at Christmas.
05:47
<@Derakon>
They will find nondescriptly-wrapped presents each labeled in the conlang, as well as a Rosetta stone. They'll have to figure out what the labels say to know who gets which present.
05:47
<@Derakon>
(The presents themselves will be pretty cheap; they aren't really the point)
05:49
<@Derakon>
...yeah, this lexiconizer has problems. Sample word: "zzzzwstv".
05:49
< Vornicus>
05:49
<@Derakon>
I flipped the "don't add a vowel" check.
05:50
<@Derakon>
Okay, that's better. New sample word: "zuzuyuru".
05:50
<@Derakon>
And "zuzuyibi".
05:50
<@Derakon>
...there's an awful lot of "zuzu" words, in fact.
05:50
< Vornicus>
what are the input words for these?
05:51
<@Derakon>
/usr/share/dict/words.
05:51
< Vornicus>
what /specific/ words?
05:51
<@Derakon>
All ~230k of them. And there's a uniqueness constraint.
05:51
<@Derakon>
zuzuyuru is "yeller". zuzuyibi is "Maronian".
05:52
<@Derakon>
Odd...yeller should have translated to a word of 2 syllables, not 4.
05:52
< Vornicus>
...heh
05:53
<@Derakon>
...duh, I'm stupid. If the script finds that it's re-generated an existing word, it tries again...lengthening the word. D'oh.
05:53
<@Derakon>
Go, O(infinity) script!
05:53
<@Derakon>
Yeah, this is taking much longer~
05:54
<@Derakon>
I think I ran out of one-syllable words.
05:54
< Vornicus>
heh
05:58
<@Derakon>
...okay, this dict is a problem.
05:58
<@Derakon>
acetone:kuno
05:58
<@Derakon>
acetonemia:nezeki
05:58
<@Derakon>
acetonemic:buyeri
05:58
<@Derakon>
acetonic:tosi
05:59
<@Derakon>
What I need is a dictionary that only does root words.
06:04 * Derakon finds a simpler list, generates 852 words.
06:18 Serah [~Z@Nightstar-5401.atm2-0-1041217.0xc329e232.boanxx12.customer.tele.dk] has quit [Quit: Be right back, got some smiting and righteous justice to attend to.]
06:19
<@ToxicFrog>
Derakon: I take it you also do the present-labels-as-clues thing? Awesome.
06:20
<@Derakon>
Yep. Last year it was a substitution cipher with custom glyphs, a bit of nonsense verse as the main encryption text, and clue words like "THACO" for the D&D guy, "autorotation" for the RC copter guy, "citrus" for my mom the biochemist, etc.
06:21
<@ToxicFrog>
Nod.
06:21
<@Derakon>
Okay, I want to take a string like "=fork" and split it into "=" and "fork". Where "=" could be any combination of the characters "=-/:_>" and "fork" is any combination of alphabetic characters.
06:21
<@ToxicFrog>
We tend to just do really evil cleartext.
06:21
<@Derakon>
That's what my brother does.
06:22
<@ToxicFrog>
(although not always - you get the occasional cipher, or visual clue)
06:22
<@Derakon>
Last year's involved really twisted logic to point us to certain words on certain pages of the books he'd given us.
06:22
<@ToxicFrog>
(years and years ago, the clue on Septerra Core was two dice showing 2 and 5)
06:22
<@Derakon>
/([\W_]*)([\a]*)/ is not doing what I want. Any ideas?
06:23
<@Derakon>
...oh, duh, I want \w not \a.
06:25
<@Derakon>
Okay! First translated sentence! "I gave a red ball to the boy who was under the table": "=pagu -hiyi kisi :bowa rede _diboyi /hofiha :yaga"
06:25
<@ToxicFrog>
How do you pronounce =, -, :, _ and /?
06:26
<@Derakon>
Those are the subject, verb, object, secondary object, and preposition markers.
06:26
<@McMartin>
IIRC, his grammar is self-diagramming.
06:26
<@Derakon>
At the moment I don't know how they're pronounced.
06:26
<@ToxicFrog>
Aah.
06:26
<@Derakon>
Maybe with gestures?
06:26
<@Derakon>
Or they could be tonal.
06:26
<@ToxicFrog>
Gestures don't work over voice-only links.
06:26
<@McMartin>
Ultrasound from your second larynx, which evolved from your echolocator sense.
06:26
<@ToxicFrog>
Tonality-aware languages can DIAF.
06:26 * Derakon snerks.
06:27
<@ToxicFrog>
I like McM's idea.
06:27
<@McMartin>
(O HAI ALIEN RACE I'VE NEVER USED IN ANYTHING INTERESTING YET)
06:27
<@McMartin>
TF: Actually, they didn't get hi-fi sound for a goodly while, and thus had scientific evidence that recorded voices were soulless husks.
06:28
<@McMartin>
(And it translated to something a bit closer to facial expressions in humans in the original form)
06:29
<@Derakon>
I suppose it won't cause too many namespace collisions to assign syllables to the marker glyphs.
06:29
<@Derakon>
In fact, I could give them bare vowels, and then there'd be no collision at all.
06:30
<@Derakon>
Since I don't have any silent consonants.
06:33 * Derakon finds a holes in the lexicon (wish, study, more, thus, stuck, flip, burger, plural, frog, cog, purple). Bah.
06:33
<@Derakon>
My lexicon is insufficient!
06:33
<@McMartin>
LIGHT OF THE DAYLIGHT STAR
06:33
<@McMartin>
THE CLOUDS ARE FILLED WITH TERROR AND FORCED TO FLEE
06:36 * Vornicus would like to know what you have to say about the place where the air is sweet.
06:38 * Derakon finds http://wordlist.sourceforge.net/
06:38
<@McMartin>
Vorn: I'm not actually catching your reference.
06:39
< Vornicus>
Sunny day / sweeping the clouds away / on my way / to where the air is sweet
06:39
<@McMartin>
Ah, yes.
06:39
< Vornicus>
And if you don't know what /that/ is, I pity your childhood.
06:40
<@McMartin>
I don't actually know the rest; what I quoted was what happens when you translate the first two lines into Klingon and back.
06:40
<@McMartin>
Speaking of insufficient lexicons.
06:40
<@McMartin>
(Klingon chairs do not recline. They fall gloriously in battle)
06:40 * Derakon snerks.
06:40 * McMartin had in fact forgotten the third and fourth lines.
06:48
<@Derakon>
There's a utility to get rid of ^M characters, right?
06:49
<@Derakon>
...ahh, figured out the required vim invocation. Nemmind.
06:49
<@McMartin>
dos2unix
06:49
<@McMartin>
Nano also does it during save
06:49 * Derakon now has a 32k-word lexicon.
06:50
<@Derakon>
"I wish that I had studied harder in school so that I would not be stuck here flipping burgers": =fu -jeho /-puloye fe soli wuna =fu /bipa :yadifa >livi /-mo soyo yijavi =fu /guno /-luro :yugivija bunuza.
06:52
<@Derakon>
And in the glyphs: http://derakon.dyndns.org/~chriswei/temp/2008glyphs7.png
06:52
<@Derakon>
(Plus two other sentences)
07:04 Vornicus is now known as Vornicus-Latens
07:46 Derakon is now known as Derakon[AFK]
08:08 AnnoDomini [~farkoff@Nightstar-29218.neoplus.adsl.tpnet.pl] has joined #Code
08:08 mode/#code [+o AnnoDomini] by ChanServ
08:14 ToxicFrog [~ToxicFrog@Admin.Nightstar.Net] has quit [Operation timed out]
08:30 ToxicFrog [~ToxicFrog@Admin.Nightstar.Net] has joined #code
08:30 mode/#code [+o ToxicFrog] by ChanServ
08:39 AnnoDomini [~farkoff@Nightstar-29218.neoplus.adsl.tpnet.pl] has quit [Quit: STUPID PRINTER.]
08:43 AnnoDomini [~farkoff@Nightstar-29218.neoplus.adsl.tpnet.pl] has joined #Code
08:43 mode/#code [+o AnnoDomini] by ChanServ
09:14 Nate302 [-NATE-@Nightstar-3025.hr.hr.cox.net] has joined #code
09:14 Nate302 [-NATE-@Nightstar-3025.hr.hr.cox.net] has left #code []
09:45 You're now known as TheWatcher
10:10 Vornotron [~vorn@Admin.Nightstar.Net] has joined #code
10:11 Vornicus-Latens [~vorn@ServicesOp.Nightstar.Net] has quit [Ping Timeout]
10:51 NSGuest-952 is now known as EvilDarkLord
11:38 You're now known as TheWatcher[afk]
12:42 Bobsentme [Bobsentme@Nightstar-26585.dsl.sfldmi.sbcglobal.net] has joined #Code
12:42
< Bobsentme>
Dynamic Link Lists are the devil.
12:42
< Bobsentme>
That is all.
13:35 You're now known as TheWatcher
14:10 Consul [~consul@Nightstar-5023.dsl.sfldmi.ameritech.net] has quit [Quit: Leaving]
14:25 gnolam [lenin@79.136.60.ns-4387] has joined #Code
14:25 mode/#code [+o gnolam] by ChanServ
15:34 Consul [~consul@Nightstar-5023.dsl.sfldmi.ameritech.net] has joined #code
15:34 mode/#code [+o Consul] by ChanServ
15:43 Syloqs-AFH [~Syloq@ServicesAdmin.Nightstar.Net] has quit [Ping Timeout]
15:46 Syloqs_AFH [~Syloq@Admin.Nightstar.Net] has joined #code
15:47 Syloqs_AFH is now known as Syloqs-AFH
16:38
<@Consul>
So I put that "bad" sound card back in, into a different PCI slot, and... All the things I could do to make my system shut itself off don't do that now. It's possible I have a bad PCI slot...
17:01 crem [~moo@Nightstar-28703.adsl.mgts.by] has joined #code
17:14
<@gnolam>
Or it just got another IRQ.
17:15
<@gnolam>
Changing PCI cards around is a classic "when everything else fails" PC repair technique. :)
17:16 * Bobsentme nods
17:27
<@Consul>
I had an issue with this slot before with a different card, though. Not a crashing one, granted, but...
17:27
<@Consul>
But right now, the echoaudio driver on this machine is having a strange but reproducable issue on my machine.
17:28
<@Consul>
Reporting it to ALSA now, though I don't know how much good that will do.
17:38 Netsplit Blargh.CA.US.Nightstar.Net <-> Troika.TX.US.Nightstar.Net quits: crem, EvilDarkLord, Vornotron, @Attilla, @GeekSoldier, @AnnoDomini, @jerith, @Reiver, @Chalain
17:42 You're now known as TheWatcher[afk]
17:48 Reiver [~reaverta@Nightstar-11199.xdsl.xnet.co.nz] has joined #Code
17:48 mode/#code [+o Reiver] by ChanServ
17:52 EvilDarkLord [~jjlehto3@Nightstar-9591.cs.hut.fi] has joined #code
17:53 EvilDarkLord is now known as NSGuest-981
18:09 GeekSoldier [~Rob@Nightstar-8573.midstate.ip.cablemo.net] has joined #code
18:09 mode/#code [+o GeekSoldier] by ChanServ
18:34 NSGuest-981 is now known as EvilDarkLord
20:31 Vornicus [~vorn@ServicesOp.Nightstar.Net] has joined #code
20:31 mode/#code [+o Vornicus] by ChanServ
20:45 * Bobsentme loses his mind
20:46
< Bobsentme>
Anyone wanna help me with a linked lists problem in C?
20:46
< Bobsentme>
My book and google searches have proved unfruitful.
20:51 Derakon[AFK] is now known as Derakon
20:52
<@Derakon>
What's up, envoy of Bob?
20:53
< Bobsentme>
Heya Derakon
20:54
< Bobsentme>
Ok, keep in mind this is a school assignment / final exam. So I'm not looking for an entire answer, just a "Here's why it's not working" sort of thing
20:54
< Bobsentme>
(Also, I need voice)
20:54 AnnoDomini [~farkoff@Nightstar-29218.neoplus.adsl.tpnet.pl] has joined #Code
20:54 mode/#code [+o AnnoDomini] by ChanServ
20:55
<@Derakon>
(Don't worry too much about channel status. It's basically irrelevant)
20:55
< Bobsentme>
Except I can't post a link to the paste bin without it
20:56
<@Derakon>
Oh? Okay.
20:56 mode/#code [+v Bobsentme] by ChanServ
20:56
<+Bobsentme>
http://rafb.net/p/42XvyK19.html
20:56
<+Bobsentme>
thanks
20:57
<+Bobsentme>
Ok, for the record, that compiles and runs ok.
20:57
<+Bobsentme>
The next part I'm trying to work on is sending the structure to the PrintList function
20:57
<@Derakon>
(You misspelled "quantity" in CreateList())
20:58
<@Derakon>
(And it only doesn't matter because you don't use that variable)
20:58
<+Bobsentme>
Spelled it right the second time. =P
20:58
<@Derakon>
Heh.
20:59
<+Bobsentme>
So, here's where I'm stuck, and cannot find my answer: Do I send the address of the first structure to the PrintList function?
20:59
<@Derakon>
You also don't need the curlies on 93 and 111.
21:00
<+Bobsentme>
um...huh?
21:00
<@Derakon>
The curly braces on lines 92 (not 93, sorry) and 111 are unnecessary.
21:00
<@Derakon>
Anyway, if you were to send the address of the first Part to PrintList, then what would you do with it?
21:02
<+Bobsentme>
I'd start at that address, print the Part#, Qty, and Price of that struct, then incriment to the next struct and print everything, so on and so forth
21:02
<+Bobsentme>
unless I'm wrong and there's a better way to do it.
21:03
<@Derakon>
There are many ways to do this that are of basically equivalent simplicity.
21:03
<@Derakon>
But ultimately, if you can find a solution that a) works, and b) you understand, then you should be satisfied.
21:03
<+Bobsentme>
I'm all ears.
21:03
<+Bobsentme>
ok
21:03
<@Derakon>
You solution sounds valid to me; give it a shot and let us know if you run into problems.
21:04
<+Bobsentme>
Will do. Thanks!
21:04
<@Derakon>
No problem.
21:19 * Bobsentme sighs
21:19
<+Bobsentme>
Ok, so I want to send the address of a struct to a function.
21:20
<+Bobsentme>
I've got This in my call line: PrintList(&Parts,&Records)
21:20
<+Bobsentme>
And this as my function header: void PrintList(struct Parts *Part,int *Records)
21:20
<@Derakon>
What is Records?
21:21
<+Bobsentme>
whole code: http://rafb.net/p/xQTNOE16.html
21:21
<+Bobsentme>
Records is for the For Loop that prints the parts
21:22
<@Derakon>
No, it's a piece of memory. :)
21:22
<@Derakon>
Your prototype doesn't match your function declaration (lines 18 and 114 disagree).
21:22
<@Derakon>
Okay, Records is the number of records you have.
21:22
<@Derakon>
Or at least, that's how you're using it.
21:24
<+Bobsentme>
right
21:24
<@Derakon>
Okay, your problem here is that you're trying to treat a linked list as if it were an array.
21:24
<@Derakon>
Let me illustrate a simple linked list for you real quick...
21:25 * Bobsentme smacks himself for that prototype mismatch thing
21:25
<+Bobsentme>
should have picked that one up.
21:25 * Bobsentme shuts up and listens
21:27
<@Derakon>
Okay, I can't remember exactly how C memory management works, so forget the example. But anyway.
21:28
<@Derakon>
Let's take a look at your CreateList function.
21:28
<@Derakon>
What is line 91 doing?
21:29
<@ToxicFrog>
I can, so I can provide an example if you like.
21:29
<+Bobsentme>
Creating a record called Parts1
21:29
<@Derakon>
I'm looking at http://rafb.net/p/xQTNOE16.html, so you should too. :)
21:29
<@Derakon>
What I see that line doing is creating an array of count Parts.
21:30
<@Derakon>
(struct Parts Part[count])
21:30
<+Bobsentme>
Right.
21:30
<+Bobsentme>
It's telling the memory: Ok, we've got a record. I need X amount of bytes.
21:30
<@Derakon>
And how many Parts fit in X?
21:30 * ToxicFrog blinks at line 61 and environs
21:30
<@ToxicFrog>
Er, line 91
21:31
<+Bobsentme>
1?
21:31
<@Derakon>
Only if count is 1.
21:31
<+Bobsentme>
So....OOOOOH.
21:31
<@ToxicFrog>
Also, C arrays are 0-indexed.
21:31
<@ToxicFrog>
So line 92 is a segfault waiting to happen.
21:31
<@Derakon>
Also, Part[count] creates a *Parts (that is, a pointer to a Parts...and you really should rename your struct to be singular)
21:32
<@Derakon>
I believe the proper syntax here is "struct Parts* newPart = new Parts;" but it's been a while.
21:32
<@ToxicFrog>
Concerning C memory management in general: that function doesn't do what you think it does, and what it does do is very likely to generate crashes.
21:32
<@Vornicus>
Struct and class names should almost always be singular.
21:32
<@ToxicFrog>
Hang on while I annotate
21:33
<+Bobsentme>
Ok
21:33
<@ToxicFrog>
...made harder by rafb.net failing at letting me get the source
21:35
<@Vornicus>
TF: you can't just copy? the source is in its own table cell, separate from the line numbers.
21:38 Serah [~Z@Nightstar-5401.atm2-0-1041217.0xc329e232.boanxx12.customer.tele.dk] has joined #Code
21:38 mode/#code [+o Serah] by ChanServ
21:39
<@ToxicFrog>
http://rafb.net/p/vD8l6B30.html
21:39
<@ToxicFrog>
Bobsentme: commented that function.
21:39
<@ToxicFrog>
Has your class covered malloc/free and stack vs heap allocation at all?
21:40
<+Bobsentme>
She barely covered malloc/free last week.
21:40
<@ToxicFrog>
(and if not, why not, because you need those for LLs)
21:42
<@ToxicFrog>
Ok.
21:42
<@ToxicFrog>
Time for a crash course in C memory management first, then.
21:42 * Serah bites ToxicFrog.
21:42
<@ToxicFrog>
ow
21:43
<@Serah>
RAWR!
21:44
<@ToxicFrog>
Ok. First of all, locals.
21:44
<+Bobsentme>
Yeah, I understand local variables vs Global.
21:45
<+Bobsentme>
Also, thanks to your comments, I believe I see why my logic failed.
21:45
<+Bobsentme>
(other than the glaringly obvious)
21:45
<@ToxicFrog>
Anything declared (inside a function) simply as "<type> <name>" or variants thereof - eg, "int foo;" or "float bar[3] = { 1.0, 2.0, 3.0 };" - is local to the block in which it's declared.
21:45
<@ToxicFrog>
This doesn't just mean "it can't be accessed from outside that block"
21:45
<@ToxicFrog>
It means "outside that block it does not exist"
21:46
<@ToxicFrog>
In particular, this means that if you try to pass pointers to locals around, those pointers become invalid as soon as the locals they point to lose scope.
21:47
<@ToxicFrog>
int * getInt() { int foo = 3; return &foo; } // bad idea; as soon as getInt returns, foo no longer exists
21:47 * Bobsentme waves to Serah
21:48 * Serah nibbles on Bobsentme.
21:49
<@ToxicFrog>
So. This is part of the underlying problem with CreateList; it's trying to create something and return it, but what it's creating is local.
21:49
<@ToxicFrog>
Which is to say, on stack.
21:50
<@ToxicFrog>
Globals aren't much help here either, though - you won't be able to create more at runtime, so how does the user create arbitrary numbers of parts?
21:50 * MyCatVerbs waves a cookie at Serah.
21:50
<@ToxicFrog>
Enter malloc().
21:50 * Serah bites MCV.
21:50 * MyCatVerbs steals Serah and hugs.
21:51 * Serah hugs MyCatVerbs
21:51
<@ToxicFrog>
malloc(n) creates a region of n bytes of memory and returns a pointer to it. Unlike things created on stack, this will stick around until explicitly released (with free()) or the program exits.
21:51
<@ToxicFrog>
So we could, for example, rewrite getInt above as:
21:52
<@ToxicFrog>
int * getInt() { int * foo = malloc(sizeof(int)); *foo = 3; return foo; }
21:52
<@ToxicFrog>
And it would work as expected.
21:52
<@ToxicFrog>
Make sense so far?
21:52
<+Bobsentme>
Not really.
21:52
<@ToxicFrog>
Ok, which parts don't make sense?
21:53
<+Bobsentme>
the *'s
21:53
<@ToxicFrog>
...but you've done pointers, yes?
21:53 Attilla [~The.Attil@Nightstar-9469.cdif.cable.ntl.com] has joined #code
21:53 mode/#code [+o Attilla] by ChanServ
21:53
<+Bobsentme>
yes.
21:53
<+Bobsentme>
It looks (at least to me), like your only increasing the size of a pointer...which doesn't make sense as a pointer is merely an address
21:54
<@ToxicFrog>
Which part looks like that?
21:54
<+Bobsentme>
int * getinf() - looks like you're creating a pointer...and calling a function at the same time.
21:54
<@ToxicFrog>
Aah. No.
21:55
<@ToxicFrog>
I'm declaring a function which returns a pointer to an int.
21:55
<@ToxicFrog>
<type> <functionname>(<arguments) { <function body> }
21:55
<@ToxicFrog>
<type> can include non-primitive types, so all of the following are valid function signatures:
21:55
<@ToxicFrog>
int * foo() // returns a pointer to an int
21:56
<@ToxicFrog>
char[] foo() // returns a character array
21:56 * Bobsentme shakes his head and moves on
21:56
<@ToxicFrog>
struct Kitten[] foo() // returns an array of Kitten structures
21:56
<+Bobsentme>
TF: Your help is much appreciated, but I'd rather bug my teacher than have you reteach me C.
21:56
<@ToxicFrog>
Sigh. Alright then.
21:57
<+Bobsentme>
At least, have you teach it to me PROPERly.
21:57
<+Bobsentme>
And my wife's home, so I'm outta here, for now.
21:57 Bobsentme [Bobsentme@Nightstar-26585.dsl.sfldmi.sbcglobal.net] has quit [Quit: Now running PassedOut.bat]
21:58 * Vornicus should figure out how to return functions in C. Knows it's not as powerful at other languages, but it's still useful.
21:58
<@Derakon>
...I was working on drawing a diagram of memory. ;.;
21:58
<@Derakon>
Oh, well.
21:58
<@MyCatVerbs>
Vornicus: return &function. And to call them, *fun_ptr(args).
21:58
<@Derakon>
I don't generally find that trying to teach pointers in a text-only medium is very useful.
21:58
<@Vornicus>
MCV: I mean, in the declaration
21:58
<@Derakon>
You want to make an anonymous function, Vorn?
21:59
<@Vornicus>
no
21:59
<@ToxicFrog>
Vornicus: typedef <return type> (*<function type name>) (<arguments>)
21:59
<@ToxicFrog>
typedef int (*lua_Cfunction) (lua_State * L);
22:00
<@MyCatVerbs>
If you want to write horrible things like functions that take and return function pointers... don't. ;)
22:00
<@MyCatVerbs>
Instead, make short typedefs and compose them.
22:00
<@Derakon>
Or use a different language~
22:00
<@Derakon>
My enthusiasm for C/C++ is basically gone.
22:01
<@Vornicus>
Yeah, mine too.
22:01
<@MyCatVerbs>
Derakon: I submit that if you have the opportunity to use a different language -at all- then you should not have even thought of using C in the first place, usually.
22:01
<@Derakon>
Heh.
22:01
<@Derakon>
Depends on what the different language is. I'd rather avoid INTERCAL if I can manage it, for example.
22:02
<@Derakon>
But yes, of the modern available programming languages, there's plenty better than C.
22:03
<@MyCatVerbs>
Not so much a case of "better than" as more suited to applications programming.
22:03
<@McMartin>
There are also many, many places where C is better than C++.
22:03
<@MyCatVerbs>
IMO, C is a much more elegant language than Java, but I'd still rather write most apps in Java than in C.
22:04
<@Derakon>
I'm thinking more along the lines of Perl, Python, et all.
22:04
<@Derakon>
Hell, even PHP, though its inability to GC objects with self-references is a problem.
22:04
<@MyCatVerbs>
Derakon: guh.
22:04
<@ToxicFrog>
I'd take C over PHP any day, personally.
22:05
<@Derakon>
(I had to modify a PHP program to fork itself and have the children do the actual work, because it would otherwise run itself out of memory. I'm not proud of that)
22:05
<@MyCatVerbs>
I'd rather bootstrap a Scheme in C than use PHP. ;P
22:06
<@Derakon>
What's so bad about PHP, then?
22:06
<@MyCatVerbs>
Derakon: namespacing. I'd list the rest of the problems, but that alone is bad enough for me, thanks.
22:06 Attilla [~The.Attil@Nightstar-9469.cdif.cable.ntl.com] has quit [Connection reset by peer]
22:07 Attilla [~The.Attil@Nightstar-9469.cdif.cable.ntl.com] has joined #code
22:07 mode/#code [+o Attilla] by ChanServ
22:07
<@Derakon>
Um, you wanna be more specific?
22:07
<@MyCatVerbs>
Derakon: Algol 60 - published in 1963 - got lexical scoping correct.
22:07
<@ToxicFrog>
the fact that every version of PHP is broken in a different way, usually in a form that's a gaping security flaw for any program using it.
22:08
<@MyCatVerbs>
Derakon: C, Java, and most other modern languages all copy Algol 60's namespacing schema more or less exactly, because it is the only correct way to do namespacing.
22:08
<@ToxicFrog>
Also, on a personal level, PHP's syntax reminds me unpleasantly of Perl, but without as much power.
22:08
<@Derakon>
I'll agree with that.
22:09
<@MyCatVerbs>
Derakon: PHP doesn't. PHP has at least one weird corner case where globals and locals aren't treated uniformly, even though there's no such problem in any other sane language on the planet.
22:09
<@ToxicFrog>
MyCatVerbs: incidentally, how does PHP do namespacing, and are you using namespacing and scoping interchangeably here?
22:09
<@MyCatVerbs>
ToxicFrog: I am, yeah. They're intertwined closely enough that I feel like being sloppy. :P
22:10
<@Derakon>
Fundamentally I'm interested in getting work done.
22:10
<@MyCatVerbs>
Derakon: so anyway. PHP's design is Wrong with a capital W. Just Flat Out Incorrect. Programming: You Are Doing It Wrong, Lol. And so on.
22:10
<@Derakon>
So as long as a language's warts stay out of my way, I don't care that they exist.
22:10
<@MyCatVerbs>
Derakon: and it's Wrong on an issue that has been solved conclusively with no further attention needed for more than twice my lifetime thus far.
22:10
<@Derakon>
A language could be implemented in Brainfuck for all I cared, so long as it was itself pleasant to work with and reasonably efficient.
22:11
<@Derakon>
So your objections are philosophical, then.
22:11
<@ToxicFrog>
Er
22:11
<@ToxicFrog>
MCV isn't discussing the implementation, I am.
22:11
<@MyCatVerbs>
Derakon: no. The problem is that that is such a monumental fuck up that there's no point in looking at the rest.
22:11
<@ToxicFrog>
And my objection is that the implementation seems to be consistently broken.
22:12
<@ToxicFrog>
MCV's objection is that the design is broken, and all the implementations are implementations of this broken design, which neither stays out of his way nor is pleasant to work with.
22:12
<@Derakon>
(I will also note that I did not say that PHP was a good language, merely that it was preferable to C)
22:12
<@MyCatVerbs>
Derakon: it's like you interview a babysitter and they ask if you mind them feeding the kids LSD to shut them up if they get antsy.
22:12
<@Derakon>
...
22:12
<@ToxicFrog>
PHP could, in fact, be implemented in Brainfuck; but even if that implementation fixed the security and garbage collection flaws, what MCV is talking about would still be a problem.
22:13
<@MyCatVerbs>
Derakon: at that point, you've only actually discovered one flaw in their methodology so far - but it's such a fundamental fuck up that you may as well send them away immediately, because you know that if they get something that easy wrong then they're going to fuck everything else up too.
22:13
<@Derakon>
Such vitriol.
22:13 * Vornicus still hasn't figured out why some languages - perl, javascript, pov-ray, to name three - default to globals instead of locals.
22:13 * McMartin would note that PHP needs to be avoided because it requires so much effort to not be a malware distribution vector that you're Going To Miss Some.
22:14
<@MyCatVerbs>
Derakon: there's not much point holding opinions if they're not going to be strong ones. ^^
22:14
<@ToxicFrog>
McMartin: see, that
22:14
<@ToxicFrog>
s what I've been saying.
22:14
<@McMartin>
But then, that's also why you avoid C, unless your goal is to write rootkits for other people~
22:15
<@ToxicFrog>
C at least you can be fairly confident that security holes will come from your code or your libraries and test accordingly; you don't generally need to worry about the compiler inserting new exploits into your code.
22:15
<@ToxicFrog>
Unless you're using Thompson's build of the compiler~
22:15
<@McMartin>
Heh
22:16
<@McMartin>
grep the binary for "login"~
22:16
<@Derakon>
Friar Tuck! Help!
22:17
<@Vornicus>
Thompson being the "Trusting trust" guy?
22:17
<@ToxicFrog>
Yeah.
22:17
<@MyCatVerbs>
Vornicus: Thompson being quite a lot more besides, too. ;)
22:28
<@ToxicFrog>
Vornicus: on implicit globalization: no idea. Lua does that too, and it annoys me.
22:43 You're now known as TheWatcher
23:33 AnnoDomini [~farkoff@Nightstar-29218.neoplus.adsl.tpnet.pl] has quit [Quit: Juffo-Wup is a *candle*. It is filled with many *candy bars*.]
--- Log closed Sun Nov 23 00:00:42 2008
code logs -> 2008 -> Sat, 22 Nov 2008< code.20081121.log - code.20081123.log >