2024-08-21 02:26:19 how do forthwrights accommodate changes in their programs? 2024-08-21 02:27:00 well I suppose abusing colon definitions isolates a lot of stuff and then you just have to change few words 2024-08-21 02:28:28 but I was curious because the forth goal is to be simple and to not add hooks for stuff you might want later or alike 2024-08-21 02:29:04 when usually in programming we are told that programs should be able to accept changes easily 2024-08-21 02:29:30 which might make you think you need those hooks 2024-08-21 02:30:57 the way I add changes is to delete the whole file and start from scratch 2024-08-21 02:30:57 but I should find a better way 2024-08-21 02:35:46 i mean it's like the chuck moore quote about writing 5 lines of code in 5 years 2024-08-21 02:43:40 cannot find that quote 2024-08-21 02:44:16 nor understand its meaning, but looks like thinking before coding 2024-08-21 02:59:19 other companies linked pay to lines of code produced, for better or worse 2024-08-21 03:54:51 imagine programming in java and gettind paid for lines of code 2024-08-21 03:55:10 I would even like java 2024-08-21 03:58:11 c++ or ada might be viable options then as well 2024-08-21 03:59:57 it's better if people pay you for your time though - how many of your best ideas and solutions have actually come along while trying to bang out code vs. doing something completely unrelated to programming? 2024-08-21 04:02:47 I tend to stare at the screen for a while before writing a line of code so yeah, better with time 2024-08-21 04:26:06 Thinking befoe writing is highly beneficial. 2024-08-21 04:26:23 And I imagine that goes for any kind of writing - not only code. 2024-08-21 04:50:37 vms14: I'm no Forth expert, but I feel like the answer to "how do you accommodate changes in your programs?" is mostly language-independent 2024-08-21 04:51:45 I feel like Forth is harder to read than most other languages, which is a drawback 2024-08-21 04:51:58 but there are some things about Forth that make it easier to jury-rig any change you want 2024-08-21 04:52:16 I mean you can turn any word into a compile-time macro that does anything you want; there are no constraints 2024-08-21 04:54:40 the potentially tricky thing is that when you want to change something, you need to understand how it works now and what depends on it 2024-08-21 04:55:04 but none of that is about adding hooks for stuff you might want later 2024-08-21 13:22:56 The talk of B-Trees yesterday reminded me of this "You're Doing It Wrong" https://queue.acm.org/detail.cfm?id=1814327 2024-08-21 14:41:02 Yep a good little read 2024-08-21 14:42:07 This is the same conclusion I had with hash tables, that we were thinking about it wrong because a LOT of people still teach closed buckets as the 'default' choice, even though it's probably not been appropriate on normal hardware for years 2024-08-21 14:42:36 And also algorithms books seem to put wrong emphasis on the issue of open bucket collisions 2024-08-21 14:43:21 And stuff like double hashing that's not necessary if the hash is good, which should just be an assumption in 2024 that you can provide a pseudorandom or better hash 2024-08-21 14:44:44 And you don't even get to turn up to the conversation to talk about this kind of performance question if you're not using a serious native programming language like C, etc. 2024-08-21 15:10:34 what do you mean about closed buckets? 2024-08-21 15:14:32 FWIW switching from separate chaining http://canonical.org/~kragen/sw/dev3/justhash.c to linear probing http://canonical.org/~kragen/sw/dev3/linhash.c did improve performance in my test but only slightly 2024-08-21 16:49:04 xentrac: closed buckets if your buckets are a linked list, open buckets if they are just in the hash table, spilled to other slots if the first is taken 2024-08-21 16:50:39 You can't really fix locality in non-native languages because you can't put your objects *in* things, only reference them 2024-08-21 16:51:25 I've not seen anything other than native languages make that distinction, and it's actually a common complaint among new C programmers that there is even a distinction between pointer/object and possibility of copying vs referencing objects at all 2024-08-21 16:51:50 But it's necessary to optimise your cache usage 2024-08-21 16:52:11 memory layout etc 2024-08-21 16:52:43 Forth fits the bill too 2024-08-21 17:08:16 veltas: aha, so justhash.c above is "closed buckets" and linhash.c is "open buckets" 2024-08-21 17:09:21 the full-text search engine I wrote that I linked above does kind of make that distinction because it's reading and writing files 2024-08-21 17:11:11 C# isn't "native" in the sense that it compiles to the CIL, but it does have the distinction we're talking about in its in-RAM data model 2024-08-21 17:11:23 C# can do this kind of optimisation then 2024-08-21 17:11:27 yes 2024-08-21 17:11:44 Forth isn't strictly always native but has that level of control too 2024-08-21 17:11:49 yeah 2024-08-21 17:12:09 I mean really it's a question of how the language thinks about memory 2024-08-21 17:12:36 I wrote this meandering draft of an essay about that that a lot of people have liked: http://canonical.org/~kragen/memory-models 2024-08-21 17:14:01 what you're calling "non-native languages" I call there "the Lisp memory model" 2024-08-21 17:19:11 Yeah it's about whether you've got control over memory layout 2024-08-21 17:19:53 well, it's sort of about what form that control takes 2024-08-21 17:20:08 you could argue that in Fortran 77 you have "control over memory layout" 2024-08-21 17:20:53 but if you have objects of different atomic types there, you still can't put them right in the same cache line 2024-08-21 17:21:31 or in COBOL, where you can, but you can't do dynamic RAM allocation, not even for local variables for recursion 2024-08-21 17:22:13 in C# or Golang your control over memory layout is really very limited, but you can still embed a struct by value inside another struct 2024-08-21 17:23:43 even in C you can't control whether your data is interspersed with your code on the same page; the linker makes that decision for you, a decision which I found out had changed in recent versions of GNU binutils to reduce vulnerability to ROP exploits 2024-08-21 17:24:01 on Linux at least