--- Log opened Tue Feb 11 00:00:58 2020 |
00:04 | | * McMartin will be over here writing code in C |
00:04 | <&McMartin> | A language where "truthiness" was a thing long before Colbert, or even Perl. |
00:05 | <&ToxicFrog> | McMartin: yeah, but I kind of expect that in C |
00:06 | <@ErikMesoy> | "truthiness" is one thing. True+2 not being a type error is another, IMO |
00:06 | <&ToxicFrog> | In Python, a language with a first-class Boolean type, I do not expect Boolean to be a subclass of Int or for True to == 1 |
00:06 | <&ToxicFrog> | and yet, here we are |
00:07 | <&McMartin> | Come to think of it, TRUE + 2 might *be* a type warning in C99. I think at some point compilers started having a sad if you used enums as integers or vice versa without a cast. |
00:33 | | Kindamoody is now known as Kindamoody[zZz] |
00:54 | <@Reiv> | Databases don't really do booleans either |
00:55 | <@Reiv> | Well, they do, but they're not boolean |
00:55 | <@Reiv> | Because they have three values ^_^ |
00:55 | <&McMartin> | Nullable Boolean |
00:59 | | celmin|away is now known as celticminstrel |
01:25 | <&McMartin> | Culture Ship Name Alert: Spider Levels Within Expected Parameters |
01:25 | <&McMartin> | Reiv: Also, C# has that three-value boolean under the name "bool?", IIRC |
01:44 | <@Reiv> | So it's Yes/No/Null then? |
01:44 | <&ToxicFrog> | Yeah. I believe ? is the general purpose C# suffix for nullable types. |
01:44 | <&McMartin> | Yeah, "?" at the end of a type means "null is also an option" |
01:45 | <&ToxicFrog> | Some languages also have Option/Some types, which serve a similar purpose -- an Optional<T> can be any value a T can take or "not set", sometimes with an associated error message. |
01:45 | <&ToxicFrog> | So an Optional<Boolean> is True, False, or <<missing>> |
01:46 | <&McMartin> | Yeah. |
01:46 | <&McMartin> | Some(True), Some(False), or Nothing, in the Rust nomenclature, IIRC |
02:10 | <@Alek> | that's a neat shipname, McM |
02:21 | <@Reiv> | neat |
02:21 | <@Reiv> | Oh this is where C# uses a different set of NULL rules to DBs isn't it |
02:21 | <@Reiv> | Like, in DB land, 1+NULL = NULL |
02:21 | <&McMartin> | Yeah, it has C's idea of NULL |
02:21 | <&ToxicFrog> | Reiv: in most programming languages, doing things with null is an error. |
02:22 | <@Reiv> | Right |
02:22 | <@Reiv> | Wheras in DBs they're merely a contagious disease |
02:22 | <@Reiv> | nullifying everything else they touch~ |
02:22 | <&McMartin> | That's NaN >_> |
02:22 | <&ToxicFrog> | In C NULL is just memory address 0 so you can in fact do math on it, but it sounds like nulls in DB land behave more like NaN in floats |
02:22 | <@Reiv> | Pretty much, yes |
02:23 | <@Reiv> | But I mean this is also deliberate |
02:23 | <&McMartin> | There are subtleties to "just memory address 0" but to the extent it's not true we go to great lengths to *make* it be true |
02:23 | <@Reiv> | In DB design, DBs mean "We don't know" |
02:23 | <@Reiv> | when they say NULL |
02:23 | <@Reiv> | So "What's 1 plus Idontknow?" |
02:24 | <@Reiv> | "Is this data in the set idontknow?" |
02:24 | <@Reiv> | etc |
02:24 | <@Reiv> | NULL never matches anything, /including NULL/ |
02:24 | <&McMartin> | That's extremely NaN :) |
02:24 | <&McMartin> | In C or C# knowing whether or not something matches NULL is often *extremely important* |
02:25 | <@Reiv> | Yes |
02:25 | <@Reiv> | Except I don't know if you can test Value IS NaN |
02:25 | <@Reiv> | But you *can* test Value IS NULL |
02:25 | <@Reiv> | Or indeed, even isnull(Value,0) if you just want nulls to be converted to 0s etc |
02:26 | <&McMartin> | In C, the isnan(3) function exists, but "x == NaN" is always false |
02:26 | <@Reiv> | Or coalesce(Value,Value2,Value3,0) if you want it to be "Keep looking through this list until you hit something that isn't NULL" |
02:26 | <@Reiv> | Right |
02:26 | <@Reiv> | The SQL equivalent would be "x == NULL" is always false |
02:26 | <@Reiv> | So you have to test for "x IS NULL" |
02:26 | <@Reiv> | Because this is a meaningful distinction ofc |
02:26 | <&McMartin> | And yeah. NULL in systems-level programming has sort of conflated this NaN-like behavior with "actually, no, do not touch this, it is not a thing" |
02:27 | <&McMartin> | So many of the operations that you describe on NULL values are also defined for these others... the "elvis operator" (no, I don't know why it gets called that or which language community is to blame) does binary coalescing and if collections allow null elements search-to-find-first/last-nonnull is going to be somewhere in the library |
02:27 | <@Reiv> | right, while in DBs it is very explicitly "You have an absence of a value, which is different to having a zero" |
02:28 | <&McMartin> | Right. For memory addresses, we've gone out of our way to ensure that zero and *everythign near it* is not legal for a program written in human land to ever see |
02:28 | <@Reiv> | But then there are lots of ways to /deal/ with said missing information, because oddly enough DBs are built around the concept that information is not only allowed to be missing, but expected |
02:29 | <&McMartin> | ... and these days even in machine code, because the operating system controls what physical RAM goes to which bits of each program's address space and it just Never Maps Page Zero |
02:29 | <@Reiv> | Except in primary keys, which can have IS NOT NULL declared on their column in the "No, this is not legal unless there really is data" |
02:29 | <@Reiv> | But that's another game for other days |
02:29 | <&McMartin> | (It's important that, like, 7 also be an illegal address, since you probably passed a NULL pointer to something that thinks it's a structure or array and is adding something to it before actually hitting the memory bus with it) |
02:29 | <&McMartin> | (And these days it is the *hardware* that says "nope, eat shit") |
02:29 | <@Reiv> | Still, it's always fun to remind newbie DB devs that their BOOLEAN needs to account for all *three* states~ |
02:30 | <@Reiv> | Also |
02:30 | <@Reiv> | NULL is not the same as an empty string is not the same as zero is not the same as...~ |
02:30 | <&ToxicFrog> | Yeah, that's also true in most programming languages I've used |
02:30 | <@Reiv> | And yet the sheer number of systems that will respond to revocation of data accidentally added in |
02:30 | <@Reiv> | Starting position: NULL |
02:30 | <@Reiv> | New position: Stuff |
02:31 | <@Reiv> | Whoops, that was an error |
02:31 | <@Reiv> | Corrected position: '' |
02:31 | | * Reiv sets the dev team on fire |
02:31 | <&McMartin> | I think that happens in sqlite if you use the wrong write function -_- |
02:31 | | * Reiv also sets sqlite on fire, yes |
02:31 | <@Reiv> | I forgive SQLlite many limitations |
02:32 | <&McMartin> | Look, sqlite3_set_null() is not ambiguous~ |
02:32 | <@Reiv> | I accept it does not have analytic functions, despite these being made of silk and velvet and perfume |
02:32 | <@Reiv> | But it should bloody well have followed a few more conventions on null handling -_- |
02:32 | <&McMartin> | sqlite3_bind_null() is not the same thing as sqlite3_bind_text() |
02:32 | <&McMartin> | If you do the latter when you should have done the former, it is not SQLite's fault that "" goes in. |
02:33 | <@Reiv> | mmmh |
02:33 | <@Reiv> | Then you have to write a special function to realise that backing out of the data requires a different function |
02:34 | <@Reiv> | I guess you have to do that in most languages, but |
02:34 | <&McMartin> | Yeah, there's *really* no getting around that |
02:34 | <@Reiv> | It certainly /encourages/ the lazy option to be the wrong one |
02:34 | <&McMartin> | I mean, sqlite_bind_int64() doesn't have any room to express NULL in it. |
02:34 | <&McMartin> | All possible 64-bit values are legal! |
02:35 | <@Reiv> | Not an excuse in database land |
02:35 | <@Reiv> | Go stick an extra byte or bit on the end of it and weep for humanity, it's fine |
02:36 | <&McMartin> | Yes, that's database land |
02:36 | <&McMartin> | But SQLite C bindings are not a database. They're C. |
02:36 | <&McMartin> | The things on the C side have to be C. |
02:36 | <@Reiv> | But SQLite is meant to be doing Database things! |
02:36 | | * Reiv grump grump, knows you're right but is still allowed to grump, etc |
02:36 | <&McMartin> | Yes. So you'd better be able to ask for it in the language |
02:36 | <&McMartin> | And directly implementing it would be... bad |
02:37 | <&McMartin> | There'd be a magic byte that you have to *remember to rewrite* or your data will be interpreted as "that bit pattern, if it were meant to be of this type" |
02:37 | <&McMartin> | And oh man no, just have different functions with constraints the compiler can actually enforce |
02:38 | <@Reiv> | I am ok with the idea of different functions |
02:38 | <@Reiv> | But then I query the logic/wisdom of having the first one unable to write nulls in the first place |
02:38 | <&McMartin> | For bind_text, the logic is weak |
02:38 | <&McMartin> | for bind_int64 the logic is extremely strong |
02:38 | <@Reiv> | This is how you get devs shoving -1 into columns to denote "No information currently available" in a bloody database because they couldn't reach NULL |
02:38 | <&McMartin> | That's because char * is nullable and int64 is not~ |
02:39 | <@Reiv> | And then I have to convert it |
02:39 | <@Reiv> | Usually about the point someone decided negative values should be legal after all |
02:39 | <@Reiv> | (Though this is not the greatest crime) |
02:39 | <@Reiv> | (Oh, the greatest crime) |
02:39 | <&McMartin> | A *C#* interface to sqlite absolutely should just have one notional function named "bind" that takes nullable objects of various types and overloads as needed |
02:39 | <@Reiv> | The magical database someone wrote that dealt with deleted records, right |
02:39 | <@Reiv> | I can handle a flag. |
02:39 | <@Reiv> | I can even, mostly, handle the idea of setting the primary key to *-1 |
02:40 | <&McMartin> | A trick C does not know, but C# and C++ does is to have functions bind(int) and bind(float) and bind(string?) and have them *be three different functions that it can tell apart* |
02:40 | <@Reiv> | Who the fuck set it to just blank the column with a space... |
02:40 | <&McMartin> | Though having bind(int) and bind(float) is kind of a bad idea because you never know when somebody did some math that secretly pushed something into floating point land |
02:40 | <@Reiv> | ... then discovered that it could only do that once |
02:40 | <@Reiv> | So it then recorded [space]1 |
02:40 | <@Reiv> | [space]2 |
02:40 | <@Reiv> | [space]3 |
02:41 | <@Reiv> | Do you know how long it took me to work that one out? |
02:41 | <@Reiv> | Do you know what I wanted to do to their spleen afterwards? |
02:41 | <@Reiv> | Bonus points when you realise that [space]1 was the /second deleted record/ |
03:34 | < Kizor> | "The string "" with no characters is called the empty or null string. It is only string whose length is 0. [...] Do not confuse it with the quote image, "" (a single token, shifted Q)." |
03:34 | | Degi [Degi@Nightstar-9cslp6.dyn.telefonica.de] has quit [Ping timeout: 121 seconds] |
03:35 | < Kizor> | "3. If you enjoy humiliating computers, type PRINT "2+2 = ";2+1" |
03:38 | < Kizor> | ... |
03:38 | <&McMartin> | Oh hey I remember that |
03:38 | < Kizor> | In ZX81 basic, "SMITH" < "SMYTHE". |
03:38 | <&McMartin> | I also objected and made it more evil |
03:39 | <&McMartin> | Aha! You are in fact reading That Source. |
03:39 | < Kizor> | Yup, works in QB. |
03:39 | <&McMartin> | "Lexicographical Order" |
03:40 | < Kizor> | Yep, works in Python. |
03:40 | <&McMartin> | re: "humiliating computers" https://bumbershootsoft.wordpress.com/2017/03/05/zx81-basic-programs-and-file-formats/ |
03:41 | <&McMartin> | (Also if you are on Windows EightyOne is the best ZX81 emulator by a vast margin and it also is a passable emulator for the non-QL Spectrum lines) |
03:42 | < Kizor> | Yep, works in Javascript. |
03:42 | < Kizor> | I kinda want to kill something for this, and I'm not sure why. |
03:42 | <&McMartin> | Then there's https://bumbershootsoft.wordpress.com/2018/01/29/zx81-mind-games/ which as far as I can tell I was the first to abuse |
03:42 | <&McMartin> | How else would you propose imposing a total order on strings? |
03:42 | | Degi [Degi@Nightstar-ogha4c.dyn.telefonica.de] has joined #code |
03:42 | < Kizor> | Thanks for the heads-up, but I'm only here for one type-in program and I'll port that to Python. |
03:43 | < Kizor> | I was just reading the manual to find out what SCROLL does, I wasn't expecting to have my sense of reality rocked. |
03:43 | <&McMartin> | In that case, the tl;dr |
03:43 | <&McMartin> | Every time you type in a number in a ZX81 program it sticks six invisible bytes after it that are the actual number in floating point format |
03:43 | < Kizor> | Of course it does. |
03:43 | <&McMartin> | That is the true value and the text of the number is just for show |
03:43 | <&McMartin> | So you can type PRINT "2+2 = ";2+2 |
03:44 | <&McMartin> | And then POKE a new value into the last 2's real value |
03:44 | <&McMartin> | And then have it print 2+2 = 3 with no change in the listing |
03:44 | <&McMartin> | that'll learn 'em |
03:45 | < Kizor> | Thank you, I think. |
03:45 | <&McMartin> | What program is it that you are porting from the ZX81 manual to Python? |
03:46 | <&McMartin> | The second link is "if you poke other things into different parts of the program you can make it stick letters in the middle of line numbers" |
03:47 | < Kizor> | The work you've put in and the knowledge you've gathered is impressive, and I'm embarassed that I'm up at 6 AM and too lazy to throw myself into reading and parsing your links. |
03:47 | <&McMartin> | No worries |
03:48 | <&McMartin> | It's basically one collection of reference material I have *really good indexes on*, as it were :) |
03:48 | < Kizor> | Heh |
03:48 | < Kizor> | Good point. |
03:48 | <&McMartin> | And honestly in the first link other than the fun and games with hacking BASIC programs in place, there's nothing in it that isn't in that very manual. |
03:50 | < Kizor> | And the program's from Sinclair User a few years later. A little thing about fighting the Battle of Britain. The concept of fighting with dwindling resources rather than having everything go citius, altius, fortius as in most games caught my attention. |
03:51 | <&McMartin> | Ah, very nice |
03:51 | <&McMartin> | Oh, one final fun thing. |
03:51 | <&McMartin> | The original ZX81 only had 1KB of RAM, which was often not enough to have the screen and the program at the same time |
03:51 | <&McMartin> | Some sometimes it would start forcibly trading away screen: https://bumbershootsoft.files.wordpress.com/2017/03/zx81_line_nom.gif |
03:51 | <&McMartin> | Programs in Sinclair User almost certainly assumed/demanded the 16KB expansion |
03:51 | < Kizor> | This wouldn't happen to related to SLOW and FAST? |
03:52 | <&McMartin> | No, but that is probably a tale better related at Not 6 AM. |
03:52 | < Kizor> | Point. |
03:52 | <&McMartin> | But it's not about RAM and it's a bit involved. |
03:53 | <&McMartin> | FAST was "trade graphical stability for speed, mimicking the earlier ZX80", but what it was actually doing is better explained at a time when I can also talk about how, say, the C64 and NES drew their screens. |
03:53 | <&McMartin> | ... ZX81 screen drawing is bonkers |
03:55 | <&McMartin> | (And I still don't understand either of the tricks used to abuse this, one of which only EightyOne handles properly) |
04:02 | <&McMartin> | Hm. So I guess the only thing that might be worth saying At 6 AM for this is "if you see FAST and SLOW in some type-in listing, that's moving into and out of code that's non-interactive and doing a bunch of crunching that will probably take, like, half a millisecond on Python on a modern machine. They're signposts to you but not *instructions*." |
04:08 | <&McMartin> | But yes, if it wasn't clear: the ZX81 was my first computer, and while I do not esteem it I was actually surprised and pleased to see Sudden Quotes From The Manual~ |
04:16 | < Kizor> | Heh. |
04:18 | <&McMartin> | Also man, looking over it almost all the stuff in the Bumbershoot 2019 collection is going to be ZX81 stuff. |
05:04 | | Pink [user1@Nightstar-g7hdo5.dyn.optonline.net] has joined #code |
05:06 | | Pinkhair [user1@Nightstar-g7hdo5.dyn.optonline.net] has quit [Ping timeout: 121 seconds] |
05:18 | | mac is now known as macdjord|slep |
05:19 | | himi [sjjf@Nightstar-1drtbs.anu.edu.au] has quit [Operation timed out] |
05:21 | | Derakon is now known as Derakon[AFK] |
06:17 | | celticminstrel [celticminst@Nightstar-0p84vo.dsl.bell.ca] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!] |
08:10 | | himi [sjjf@Nightstar-v37cpe.internode.on.net] has joined #code |
08:10 | | mode/#code [+o himi] by ChanServ |
08:46 | | Vorntastic [uid293981@Nightstar-h2b233.irccloud.com] has quit [[NS] Quit: Connection closed for inactivity] |
09:31 | | Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has joined #code |
09:31 | | mode/#code [+qo Vornicus Vornicus] by ChanServ |
12:46 | | macdjord|slep is now known as macdjord|wurk |
12:56 | | Kindamoody[zZz] [Kindamoody@Nightstar-eubaqc.tbcn.telia.com] has quit [Client exited] |
13:06 | | celticminstrel [celticminst@Nightstar-0p84vo.dsl.bell.ca] has joined #code |
13:06 | | mode/#code [+o celticminstrel] by ChanServ |
13:22 | | Kimo|autojoin [Kindamoody@Nightstar-eubaqc.tbcn.telia.com] has joined #code |
13:22 | | mode/#code [+o Kimo|autojoin] by ChanServ |
13:58 | | celticminstrel is now known as celmin|away |
14:16 | | Kimo|autojoin is now known as Kindamoody |
14:39 | | Kindamoody is now known as Kindamoody|afk |
14:53 | | Kindamoody|afk [Kindamoody@Nightstar-eubaqc.tbcn.telia.com] has quit [Ping timeout: 121 seconds] |
17:32 | | Kindamoody|afk [Kindamoody@Nightstar-eubaqc.tbcn.telia.com] has joined #code |
17:32 | | mode/#code [+o Kindamoody|afk] by ChanServ |
17:33 | | Kindamoody|afk is now known as Kindamoody |
18:00 | | Kindamoody [Kindamoody@Nightstar-eubaqc.tbcn.telia.com] has quit [Ping timeout: 121 seconds] |
18:03 | | Kindamoody [Kindamoody@Nightstar-eubaqc.tbcn.telia.com] has joined #code |
18:03 | | mode/#code [+o Kindamoody] by ChanServ |
19:22 | <&McMartin> | Well well |
19:22 | <&McMartin> | One of the VICE contributors found a bug that is the funhouse mirror version of that old UQM bug where Matrox cards were lying about what their OpenGL drivers could do |
19:22 | <&McMartin> | Here it's the Mac OpenGL driver (and possibly others) being coy about what it can do, refusing to report support for extensions if they support a version of OpenGL that supports it unextended |
19:22 | <&McMartin> | This being A Thing That Happens means that I should probably get ARGLE back up to date. |
19:24 | <~Vornicus> | argle bargle |
19:24 | <&McMartin> | Indeed, that is why it has its name |
19:25 | <&McMartin> | https://github.com/michaelcmartin/argle |
19:25 | <&McMartin> | I mean, I also backfitted an acronym to it, but it's because facing the problem that it solves causes one to bargle an argle or two. |
19:26 | <&McMartin> | Also now that I have written some simple data structure code for Monocle, I can make ARGLE not be a C++ program. |
19:28 | <&McMartin> | Man, heckin' really |
19:28 | | * McMartin reads that code |
19:29 | <&McMartin> | Confirmed that I have learned something in the past 7 years, hot damn |
19:51 | | Emmy [Emmy@Nightstar-9p7hb1.direct-adsl.nl] has joined #code |
20:38 | | bluefoxx [fuzzylombax@Nightstar-gmbj85.vs.shawcable.net] has quit [Ping timeout: 121 seconds] |
20:44 | <@gnolam> | McMartin: that used to be a classic among OpenGL drivers everywhere. |
20:47 | | himi [sjjf@Nightstar-v37cpe.internode.on.net] has quit [Ping timeout: 121 seconds] |
20:56 | | bluefoxx [fuzzylombax@Nightstar-gmbj85.vs.shawcable.net] has joined #code |
20:59 | | ErikMesoy [Bruker@Nightstar-3p2nck.bb.online.no] has quit [Connection closed] |
21:00 | | ErikMesoy [Bruker@Nightstar-3p2nck.bb.online.no] has joined #code |
21:00 | | mode/#code [+o ErikMesoy] by ChanServ |
--- Log closed Tue Feb 11 21:13:35 2020 |
--- Log opened Tue Feb 11 21:14:23 2020 |
21:14 | | TheWatcher [chris@GlobalOperator.Nightstar.Net] has joined #code |
21:14 | | Irssi: #code: Total of 33 nicks [26 ops, 0 halfops, 0 voices, 7 normal] |
21:14 | | mode/#code [+o TheWatcher] by ChanServ |
21:14 | | Irssi: Join to #code was synced in 15 secs |
21:16 | | Derakon[AFK] is now known as Derakon |
22:22 | | Reiver [quassel@Nightstar-ksqup0.co.uk] has quit [[NS] Quit: Reblooting.] |
22:47 | | Reiver [quassel@Nightstar-ksqup0.co.uk] has joined #code |
22:47 | | mode/#code [+ao Reiver Reiver] by ChanServ |
23:10 | | himi [sjjf@Nightstar-1drtbs.anu.edu.au] has joined #code |
23:10 | | mode/#code [+o himi] by ChanServ |
23:33 | | Emmy [Emmy@Nightstar-9p7hb1.direct-adsl.nl] has quit [Ping timeout: 121 seconds] |
--- Log closed Wed Feb 12 00:00:17 2020 |