« first day (1365 days earlier)      last day (1296 days later) » 
00:00 - 15:0015:00 - 00:00

3:00 PM
@ngn I really don't like the attitude of "remove everything below usage threshold of X". Many things are used very rarely, but for the cases they are, they can be very important
 
ngn
should the cut-off be based on "important" then? and how does one measure that?
as a language implementer you have a limited amount of attention, there must be a cut-off line somewhere
 
@ngn Both are true, which is why impure features need to be few and well designed. In BQN, variable redefinition in closures is the only source of mutability, and it can only affect the results of function or modifier calls and namespace dotting or destructuring.
 
@ngn I'd be surprised if that ever happens and is a bad thing. If something with an identity needed to be changed, it needed to be.
 
@ngn What exactly would you say is the best in the trade? Essentially all modern general-purpose languages have converged on lexical scoping with closures, even as immutable data is becoming more popular. Julia, Rust, and Go all have them.
 
ngn
@Marshall k, of course :) but for being principled about immutability, haskell has gone the farthest afaik
 
3:09 PM
@ngn some form of "utility" - how much time on average of all future usage of the language will this feature save. Of course this is definitely not something you can score, so you guess. And, if the utility of the feature underperforms, I'd only consider cutting it if the score is very very very tiny, or negative.
@ngn k has to pass surrounding variables to every invocation of a function to get around no closures, and I doubt anyone's implemented proper GUIs in k.
 
@ngn Haskell has monads and syntactic mechanisms that are intended mainly to replicate that style of programming though. It's a valid model, but it requires a lot of type-based machinery.
 
ngn
@dzaima it's surprisingly rare, but yes, that can be annoying
@dzaima gui-s - yes, they had them in k3 (iirc the version), that's when dicts appeared. then they dicided "we don't do guis, the terminal is the ui" but kept the dicts because they saw they were good for other purposes
 
@ngn i'd be interested what k3 did for GUIs. "we don't do guis" there we go!
 
ngn
@dzaima well, then k5 (kOS) was about to appear, and it was going to have a gui
unfortunately it never came out
but generally k is doing well without mutability. afaik the only mutable things are the stack (e.g. locals) and the root of the k-tree (the hierarchy of namespaces).
 
@ngn i'd like to assume that is because they steer away from things that would be much nicer with it, but then again, kOS apparently worked
 
ngn
3:25 PM
@dzaima i don't think they dropped guis to steer clear of mutability.. most likely it wasn't a profitable enough activity for the amount of support it requires
@dzaima btw, you can always program as if things are mutable. you just have to make sure you have a single reference to the object in question, to make sure its refcount remains 1.
 
@ngn that completely forgets the unique identity, makes it incredibly easy to get things wrong, and keeps the huge issue of you either needing a consistent storage place for the object, or having incredibly messy code of fake pointers (i.e. if I have a canvas at base.ch[0].graph.g, to draw a line I need to do base.ch[0].graph.g ← base.ch[0].graph.g Ln 0 0 100 100)
and to tick every item (which could include mutating things, i.e. text is typed, button starts being pressed, etc) you'd need to rebuild every children list from scratch whereas with mutation you just do F←{⍵.tick⍬ ⋄ F¨⍵.children}base
@dzaima i guess the immutable variant isn't much worse - F←{(tick ⍵) withChildren F¨ ⍵.children} ⋄ base ← F base
 
ngn
3:41 PM
@dzaima tbh, i don't understand what you're talking about
 
@dzaima (even better with children ticking done in the tick function of the container objects, but still)
@dzaima i'll be honest, i forgot about modified assignment, base.ch[0].graph.g Ln← 0 0 100 100 is nicer
 
ngn
are you assuming that an assignment like base.ch[0].graph.g:something will make copies of everything along the path to the root (base, base.ch, base.ch[0]..) ?
 
@ngn yeah, that's what it would do in an immutable world
 
ngn
@dzaima no!
it would actually make copies only when refcount>1
 
@ngn well, effectively, at least. Of course it would optimize with refcount=1 but that's just an optimization
 
ngn
3:46 PM
just like dyalog's (non-namespace) arrays
@dzaima most of the time refcount will remain 1
 
i'm not even concerned about performance here
@ngn a GUI might have a textfield at arbitrary depth. How do you keep track of which textfield is focused (if the precise location of it might change with items being added and removed around it)? How do you append to it? I don't see any way to do that besides having a "focused" key on each, and rescanning the entire GUI on every frame, if the GUI is a tree
 
ngn
@dzaima i don't know.. maybe a path from the root? (`base;`ch;0;`graph) or something
 
@ngn but what if there's a new child added at base position 0?
i guess you could make the children lists actually be a dict from arbitrary unique keys to the child
 
ngn
@dzaima what's the identity of the thing you want to identify then? (address in memory is not an option - that's against the philosophy of value semantics)
if indices in base.ch don't identify components, maybe they should have a separate kind of id, and base.ch could be a dict
 
@ngn the identity is the human-perceived thing, it's the job of the GUI system to figure out what that is. If doing that in an acceptable manner means introducing mutable objects, I do that.
(i'm not saying an immutable GUI system is bad, just that it means having weird workarounds around very common tasks)
 
ngn
4:03 PM
@dzaima maybe. i don't have experience with guis in k. we could ask john earnest how he deals with the need for mutability (if any) in oK and iKe but i'm not even sure how to formulate the question.
 
@ngn iKe just redraws everything on every frame, and doesn't give any facility of making GUIs, leaving that to the user and their own management of things
 
4:14 PM
@ngn So to be clear here, you're arguing for principles you admit your own programming language doesn't fully support, by advocating a style you haven't used in a significant way? That… doesn't seems like the strongest rhetorical position.
 
ngn
@Marshall i'm arguing for value semantics. ngn/k supports that. (i think you're conflating that with closures - i don't support them, and i don't have a fully formed opinion of closures in the context of k)
@Marshall i didn't get the second part - what is the style you say i'm advocating?
 
@ngn But it has globals, which go against the principle of immutability.
@ngn Passing dictionaries around and making sure the refcount remains at 1 so you can change them.
 
ngn
globals are fine. locals too. as i said, in k the only mutable things are the stack and the root of the namespace tree.
 
@ngn What principle separates global state, which can of course change under your feet, from closures or namespaces?
 
ngn
@Marshall you don't have to think about refcounts unless you want to make sure modifications are done in place
 
4:22 PM
@ngn You're the one who said it, not me.
 
ngn
@Marshall that there is only one of it (if we forget the stack for a moment)
@Marshall yes?
 
@ngn and how is that significant at all, given that the global context can have >1 element?
 
@ngn As in, all I am doing is paraphrasing the statement "you can always program as if things are mutable. you just have to make sure you have a single reference to the object in question, to make sure its refcount remains 1".
 
ngn
@dzaima the global context is a dict
 
so if namespaces were actually numbers, used as indices in a global list of dictionaries, that'd be fine?
@dzaima (actually that sounds cool - bodging proper mutable namespaces on ngn/k by abusing the global context :D)
@dzaima if you think about it, that's what mutable namespaces are - just that the "global list of dictionaries" is the pointer 0x0, and an index in it is equivalent to the address of the wanted namespace
 
4:27 PM
@ngn In the case of BQN's mutable data, calling a function you got from somewhere else can have changing behavior. For global variables, using a name that isn't localized can have changing behavior. I don't see why you'd object to one but not the other.
 
ngn
@Marshall i might be missing something. don't you think updates should happen in-place when refc=1? or do you think they should happen in-place even when refc>1? or..
@dzaima legal k code, but not exactly convenient
 
@ngn I'm not saying anything about the suggestion specifically. I'm pointing out that you offered a complex system you haven't tried as a solution to a problem. I don't think this is very credible.
 
ngn
@dzaima yeah, a bit like variables. only using numbers instead of names.
@Marshall in the first case the changing behavior could affect your locals, in the second it can't. (i don't know about bqn, i'm answering in general)
 
@ngn proper mutable namespaces would be much more convenient, no?
 
ngn
no
 
4:39 PM
not from the implementation perspective, but usage - surely a mutable object is much more easy to mutate than an immutable one
 
@ngn Sort of: it only affects results when you call your locals or extract fields from them.
 
optional stateful registry?
 
ngn
@Marshall call your locals - yes, if they access those globals you modified. extract fields - i don't think so, how?
 
@ngn I was actually describing BQN. I guess K functions are mutable in pretty much the same way as closures, though! The only difference is they can only change when something in the global state changes, which in theory you could see from the caller. But how would you know its name?
 
ngn
@Marshall well, if you consider a change in global state to be a change in all functions that use it, yes
k is not pure functional, if that's where you're going
 
4:52 PM
@ngn It's not up to interpretation. There is a local that does one thing, you call some other code, and it does a different thing. This is exactly the behavior you're complaining about with namespaces, but with a dot instead of juxtaposition.
 
@ngn it's effectively as bad as a language with mutable namespaces though, just with a different point in time when mutability becomes apparent (i.e. reading a global variable, vs reading a field of a mutable namespace; and, arguably, the former is much harder to notice than the latter)
 
Obviously whether that's a problem in practice depends on how you use it, but your point was that the mere presence of this kind of mutability in the language is a problem.
 
ngn
@Marshall "function" has two different meanings in maths and programming
i'm not as uncomfortable when calling a function twice gives me different results
but looking up something in my local data structure twice shouldn't be returning different results
 
@ngn It's only a difference of syntax. What if you think of the . as a special syntax for a function call with a symbol argument?
@ngn A namespace isn't a data structure, it's an encapsulation mechanism.
 
ngn
@Marshall a dictionary is very much a data structure
an "associative array"
 
4:57 PM
@ngn No. It. Is. Not. A. Dictionary. Period.
 
@ngn That's why a namespace isn't a dictionary.
 
ngn
what do you call that thing that contains name-value bindings? the thing from which you look up variables
 
As long as you keep unconditionally irrationally expecting a namespace to be a dictionary data structure, we won't get anywhere
 
@ngn A scope, usually.
A dictionary should have key-value bindings.
But just because two things have a property in common doesn't mean they are the same?
 
ngn
@Marshall ok, scopes in k are ordinary dictionaries, and i think that's good design
 
5:00 PM
@ngn Can't you reassign local variables?
 
ngn
yes, of course you can
locals live on the stack, which is mutable, like the namespace scope root
 
I'd argue that a scope is more like a namespace then. Sure, you could model it as a progression of dictionaries, but that's also how you'd model a namespace in terms of dictionaries.
 
ngn
@dzaima again: dyalog doesn't have a concept of a value-semantics dict. if it had, i'd use that term. "namespace" is the closest, that's why i use "namespace".
 
@ngn A namespace doesn't even need to contain name-value bindings. As far as I care, there are two functions that can be called on a namespace that completely define it - get field X, and set field X to Y (with appropriate syntactical sugar). A specific namespace may choose to do whatever it wants with those - ignore sets, give a new value for each separate invocation of get, etc.
@ngn can we agree (at least in this conversation) to always use "namespace" for the mutable string key→value structure, and "dictionary" for immutable arbitrary key→value map?
@dzaima (that's at least how i've been using the two names)
(gtg for ~10-15mins :|)
 
@dzaima Disagree with that one—if get doesn't get the value from the last set with a matching key, then it's not a namespace to me. BQN also has the requirement that a given namespace uses a particular set of field names specified when it's created and that they are identifiers, but I don't think that's fundamental.
 
ngn
5:11 PM
@dzaima sure. it's a shame we're wasting time arguing over definitions.
 
ngn
5:24 PM
btw, i implemented huffman coding last night, based on stats from my golfing solutions, and got a ~40% improvement of permalink size
 
@Marshall requiring set to be reflected in get is reasonable. But i'd think that a namespace representing a window shouldn't need to wrap it's size in a method just because the user might resize the window mid-execution
@ngn so: a namespace is not, nor was it made to be used as a dictionary. A dictionary is a data structure, but a namespace is "an encapsulation mechanism". Both can live along each other in a language, as each serves a completely different purpose and has a different syntax.
 
ngn
@dzaima so what should i be saying instead of "dyalog misdesigned their namespaces"? "dyalog should have implemented dictionaries instead of namespaces, and used them as scopes"?
 
@ngn "An APL shouldn't have namespaces"; Using dictionaries as scopes is kind of pointless, as they can't reflect mutation
 
@ngn I think that's a lot clearer (I mean, I also agree with the first statement, but not for the same reasons as you).
 
ngn
@dzaima we're going in circles. all evening i've been trying to explain how k uses dicts as scopes, and why that is better.
 
5:34 PM
@ngn k uses dicts as a snapshot of a scope, but not the scope itself
 
@dzaima I see. I would say in that case that the window resize is really calling set behind the scenes concurrently. For performance reasons it might be necessary to eliminate these calls in practice.
 
If I have a vector of simple matrices and simple vectors, how do I split the matrices?
 
@ngn Cool, it's good to have some numbers on what Huffman encoding gets you.
 
ngn
@Marshall it depends a lot on the frequency distribution, and of course on the quality of statistics you've gathered
 
@Adám Do you want to run together the matrix rows into the big vector, so the result has depth 2?
 
5:39 PM
@Marshall No.
 
ngn
@Adám codegolf cmc? or genuine question?
 
@ngn Why not both? ;-)
 
@Adám <˘⍟(1<=)¨ then, and wish you were using a language with a sensible Power operator.
 
@Marshall Well, I had ↓¨@(2=≢∘⍴¨)
 
@ngn "why that is better" because no need for GC? The weak argument about functions mutating locals? what else?
 
5:43 PM
><⎉1⍟=¨ is shorter and weirder.
 
@Marshall Ah yes, I was thinking there might be a way to preprocess all elements so that the split could be applied to all and give the right result.
 
ngn
@dzaima "no mark&sweep gc" is significant enough if you ask me
⎕←'test'
 
@ngn You need a leading diamond to use the bot. (and you don't need ⎕←)
 
@ngn so an implementation problem is guiding a massive language usage decision. Maybe that's acceptable for you, but i'm fine with writing one
 
@Marshall ⊆⍣¯1∘↓¨
 
ngn
5:47 PM
i was going to post something with @ but never mind, it's longer
 
@Adám It's like a sculpture made of icicles. So fragile…
 
But so beautiful!
 
Exactly.
 
ngn
@dzaima yes. and fixing that problem leads to smaller code, faster gc, and better language (value semantics is good)
 
@ngn "smaller code" doesn't mean much; "faster gc" it'd be called rarely enough for me to not worry about it; "better language" i'll respectfully disagree that value semantics are always 100% no-matter-what the absolute best thing, and most code will have value semantics anyways
 
6:06 PM
Kind of a tangential point is that common cases where garbage collection isn't needed are easy to check for: an operation can't create closures if (0) it never accesses variables outside its scope or (1) every operation it contains can't create closures, and the enclosing scope only uses it by calling it. Operations that can't create closures will never use values from any parent scope once freed, so a block can be allocated on the stack if none of the blocks it contains can create closures.
 
6:21 PM
@Adám ↓⍣(1≥≢∘⍴)¨ would work both in a language with a "repeat" Power operator and a proper "while" one
 
Poor adam, having his language slagged off constantly
 
@rak1507 well, it's really the years before him that are the worst
 
@dzaima Right, but doesn't work with Dyalog's
 
@Adám yeah. it's very hard to use with a function right operand
@dzaima (that's not )
 
So {↓⍣(1<≢⍴⍵)⊢⍵}¨
 
7:09 PM
@Adám github.com/abrudz/aplcart/issues/71#issuecomment-713814260 will be helping to close a bunch of the pub issues tonight and tomorrow
 
Sweet.
 
What do the I,V,T stand for in the types column
i=interactive?
not sure about v or t
 
Wait, have you actually visited the site?
 
7:25 PM
yeah I just can't find the pub section lol
what am I missing lol
 
(aplcart.info doesn't seem to have a types column or a blog post section, what am I missing?)
 
@NoahCristino @ngn It is still only experimental (esp. due to lack of content), so it isn't linked to from the main page: aplcart.info/pub
2
 
ngn
8:02 PM
@dzaima why 100%? it only needs to be the 51% best thing to become preferable :) we can go into the other topics if you want
 
@ngn it needs to be >0% best thing to warrant inclusion in the language, and needs to be 100% best thing to warrant excluding alternatives from it. Anything reasonably in the middle should have both options
 
ngn
@Marshall right, that's clever, but it's so much easier not to worry about gc at all
@dzaima recipe for bloat
@rak1507 "his language"!? :D
 
including mutable namespaces should never make code (or coding) worse if you ignore them, and can, often enough, be beneficial (at least to me). So I, personally, have decided it's useful, at least to me.
 
@ngn close enough
 
ngn
@dzaima yeah, they are probably raising funds for my assassination
 
8:09 PM
@ngn right, it's a balancing act. Still, I think it's useful enough.
 
ngn
8:22 PM
@Adám i saw a sign that says "pub", i went in to get a drink, and oh! - it turns out it's a library
 
Dumb question, I have a←(1 2)(1 3)(3 4)(3 5), what can I do to make (something)a act like (something)(1 2)(1 3)(3 4)(3 5)
 
@rak1507 Not dumb at all. (⊂something),a or a,⍨⊂something
 
Thanks
 
@rak1507 You can define a function Before←,⍨∘⊂⍨
@rak1507 If you know that something is simple, then ,⍥⊆ works too.
 
ngn
8:48 PM
@Marshall do you have any strong opinions about how refcounting should work in an apl-like language?
(regardless of the presence of mark&sweep gc)
 
@ngn is modified assignment in ngn/k limited to just built-in functions?
 
ngn
@dzaima yes
i mean syntactically if you do a+:b there's no way to replace + with a user-defined function
but if you do modified assignment through triadic or tetradic @ or . you can use any function
 
@ngn so even this wouldn't work. To update something at depth, you must either write out the path as a list of symbols/indexes and have a function trace though them, or have it be a constant path and write it out twice
 
ngn
@dzaima no. you can't just replace ← with :
@dzaima what do you mean by "have a function trace through them"?
 
9:04 PM
Yay, APLcart now has over 2500 entries.
 
@ngn something that modifies the item at a position like this
 
ngn
@dzaima shall we pick an example and work through it?
either here (if @Adám doesn't mind) or in the k-tree
 
I don't. K is on-topic, but this is more about implementing array languages in general.
 
ngn
ok, let's go the k-tree then
 
@ngn of what, a GUI system in k? (i'm pretty settled on what one I'd make would look like - a "global" list/dict of all "things", and containers having referencing children by their index in that list/dict. that way mutation doesn't need to worry about depth issues, and i can still have a nice LN function whose result doesn't need to be assigned anywhere)
 
9:13 PM
@ngn Yes, I think medium and large arrays should be refcounted in order to reuse them when possible. It's easiest to add refcounts to all arrays, but it would also be reasonable to pass very small arrays by value.
 
@ngn ?
 
In many cases static analysis can eliminate the need for any garbage collection. This sounds good, but I don't know too much about it.
 
ngn
@Adám should we do it here?
 
@ngn You're welcome to. I just said I don't mind.
 
ngn
ah ok. so, i wanted to explain how amendment works in k.
@dzaima asked how it would work if he wants to do modified assignment on a.b[0].c (names changed to simplify the example)
where a is a dictionary with key `b
and the value associated with `b is a list of dicts (a.k.a. table) that have a key `c
so, let's build the structure first
(this is the first time i'm gonna use my new permalinks, yay)
@dzaima are you ok with the notion that a table is a flipped dict?
 
9:20 PM
@ngn yeah
 
ngn
ok, so starting from the innermost data structure: +`c`d!(0 1 2;3 4 5) should be a table with 2 columns
but we also want the rows of the table to be usable as contexts (dot notation like a.b)
and ngn/k has a requirement that such dicts should have a key of ` (empty symbol)
i filled the ` column with nulls (::)
then, we want to put that at path a.b in the k-tree, right?
so we just assign it: ngn.bitbucket.io/k/…
@dzaima so far so good?
 
@ngn a is created for us there?
 
ngn
yes, all "scopes" along the path are created automatically, including their ` keys
 
cool
 
ngn
and now for the tricky bit
we should do an amendment at depth (think of apl's (path⊃A)←..) for the path `a`b
@dzaima are you familiar with the basic design of tetradic @ and . ?
 
9:30 PM
any reason a.b[0].c doesn't work? (a.b[0]`c does)
 
ngn
@dzaima yes, dot means "lookup" only between identifiers
otherwise it defaults to being the verb .
 
@ngn ah right
@ngn let's assume no
 
ngn
.[a;i;+;b] does a[i]+:b
and this is generalized for different kinds of objects "a", including paths to objects starting from the root
different kinds of indices "i", including dict keys
or even paths of dict keys
"+" could be any dyadic function. and of course "b" could be anything.
now, we can split our actual path (`a;`b;0;`c) in two parts: `a`b and (0;`c)
in order to use `a`b as the amendment's "path" and (0;`c) as its "index"
the function is ":" (something like apl's ⊢) because we are simply assigning
and the value is.. 100, whatever
@dzaima so, here's the whole thing: ngn.bitbucket.io/k/…
the crap printed before "100" is the result from tetradic . which is the new value of the amended dict
 
@ngn any reason to not do .[`a;(`b;0;`c);:;100]?
 
ngn
@dzaima no particular reason. that would have worked just as well.
 
9:39 PM
and a:.[a;(`b;0;`c);:;100] works just as well
 
ngn
@dzaima yes! that's the more "pure functional" form
that's it. everything falls into place, doesn't it :)
 
@dzaima so that trace function already exists. Makes sense, since it's pretty damn useful (reinventing the wheel yay)
 
ngn
officially not "trace" but "dmend". personally, i like to call it "drill".
 
@dzaima (or, with additional sass, "reinventing the square wheel" - why have two completely different ways to access things when you could have just one?)
 
ngn
btw, all assignments (ordinary, indexed, or modified) are just syntax sugar for tetradic .
 
9:45 PM
makes sense
@ngn you're all about removing bloat - why not remove assignment then?
 
ngn
@dzaima users would revolt :)
 
@ngn is that your proper, singular reason?
 
ngn
it wouldn't be much of a useful language without any kind of assignment, would it?
 
@ngn well, you'd still have tetradic .
 
ngn
i know everything can be done with SKI or just lambda-s but that's painful
@dzaima ah, you mean remove only the syntax sugar
 
9:48 PM
@ngn yeah. obviously you still want some way to store things
 
ngn
i think a.b[i;j]+:c is a lot cleaner and more obvious than .[`a`b;(i;j);+;c]
 
@ngn and i think mutable namespaces are a lot cleaner and more obvious than these path vectors and needing to assign things constantly
 
ngn
the functional form is as clean as a functional form can be, but still the sugared form looks nicer
@dzaima would there be any syntactic difference between mutable and non-mutable dicts or namespaces?
 
@ngn assuming only symbol keys for both, there needn't be
 
@Marshall Does BQN have a notation for arrays of rank>1?
 
9:53 PM
@Adám not currently
 
ngn
@dzaima so in either case you don't have to deal with paths, then. only the numeric index caused a bit of trouble..
 
@ngn paths are a replacement to references of mutable namespaces
@dzaima (obviously related built-ins would provide things more catered to the mutability status)
 
@dzaima I'm thinking it could be possible to define a⁀b⁀c as >a‿b‿c.
 
@dzaima (though i still would personally prefer to replace references with having a global list of all objects instead of needing paths)
@Adám how'd that work for higher ranks?
 
@dzaima Doesn't that already?
 
9:58 PM
@Adám ah right, i kind of forgot what i was looking at
@Adám i personally never use -arrays for non-atom vectors
 
(1⁀2)⁀(3⁀4) would be 2‿2⥊1‿2‿3‿4
The inner can be just as well.
 
@Adám except that only works because numbers are atoms. You'd need to use in the general case
and it keeps all the warts of strand notation (no empty arrays, no single-item arrays)
we still have square brackets completely unused if we wanted to add some syntax for higher-rank arrays
@Adám that syntax will necessarily always be longer than e.g. [1‿2,3‿4], excluding that rare case that all your items are variables (or atoms), at which point >a‿b‿c isn't much worse
 
Sure, a⁀b this is to (the potential) [a,b] what a‿b is to ⟨a,b⟩
 
imo a‿b‿c should only be used when a, b, c, … are all single tokens (so don't need parentheses around them), you should use the full list syntax for everything else
 
ngn
10:13 PM
@Marshall what about how primitive functions should handle their arguments?
whose responsibility should it be to "consume" the arguments - the caller's or the callee's?
 
@ngn For unknown callees, the caller should pass the lowest possible refcount so the callee can consume it. I don't think I have any particularly interesting opinions about reference counts; why the questions?
 
ngn
@Marshall i've pondered refcounting a lot and i still don't think my strategy is good (callee consumes all args, at least in most of my functions)
 
@Adám Agree that dzaima that a high-rank ligature isn't really worth it. [] are reserved for high-rank arrays and at this point I should probably just add them.
 
ngn
@ngn i've seen other strategies too, but i don't like them either
i also tried very speculative refcounting in which objects with refcount=0 could exist with limited lifespans, it was very fast but it caused too many subtle problems
 
@ngn Strategies that result in different memory allocation patterns, rather than just different reference count values? As far as I know the only real choice you get is which callee to call last if multiple ones will use the same value, and even that only applies if you know enough to reorder functions.
 
ngn
10:24 PM
@Marshall you have a lot of choice. for instance if you have triadic primitives (or i guess a 1-modifier in bqn), you could consume the operand and one of the arguments but not the other.
or maybe never consume the operand, but always consume both arguments.. many combinations are possible
in some cases i design my functions to never consume, for instance when processing an ast
 
@ngn But either there are other references to those values out there or there aren't. Any scheme should give the same answer regarding whether they exist, right?
If multiple arguments are reusable, you can choose which one to take, but I wouldn't expect that to have any impact on performance.
 
ngn
@Marshall the question is whose responsibility it is to free the memory
@Marshall it does, if you can avoid many pairs of refc++ and refc--
 
@ngn I have no experience with that sort of optimization. My inclination would be to say you should do more static analysis in the compiler instead of fighting over how references are counted. Most values are just created and used, and don't really require reference counts.
 
ngn
@Marshall it's actually measurable - you can find out if memory is being reused or not just by the timing. so if the primitive is given more chances of reuse, well, it's gonna be faster on average.
on the other hand, if you always try to reuse only one of the args, that may simplify the code, which could lead to another sort of speed-up..
 
@ngn So basically the question is whether to sometimes strategically keep reference counts too high to avoid overhead? Again, well outside my competence.
 
ngn
10:38 PM
anyway, refcounting is a complicated and boring topic
 
11:25 PM
What's a good 'sales pitch' for APL?
 
11:52 PM
@rak1507 if this IBM Sales Brochure for APL 2 doesn't convince you, what will? softwarepreservation.org/projects/apl/Brochures/… (6MB PDF)
 
00:00 - 15:0015:00 - 00:00

« first day (1365 days earlier)      last day (1296 days later) »