Carp icon indicating copy to clipboard operation
Carp copied to clipboard

Rename blitable

Open jacereda opened this issue 5 years ago • 11 comments

My Amiga past makes me expect more than 'copy' when I read 'blit':

https://en.wikipedia.org/wiki/Blitter

jacereda avatar Jan 05 '21 18:01 jacereda

I mean, you can't blit floating point values (or pointers, like I added to the blit interface in #1111 )

jacereda avatar Jan 05 '21 18:01 jacereda

I would also like to rename it too, blit feels a bit too obscure to me. Could we perhaps use flat or unboxed? Possibly also too obscure, but the notion would be that it's the opposite of a "boxed" value, which typically denotes something on the heap, so flat would denote something that's stack allocated, which is in keeping w/ Erik's original thoughts on what blit indicates:

With "freely copyable" I mean anything that only lives on the stack and where copying or deleting is taken care of by the C value type semantics.

There's already precedence for such terminology in the ATS programming language which differentiates between allocation of "flat" values and allocation of "boxed" values.

(* Flat Tuples *)

val xyx = ('A', 1, 2.0)

(* Boxed tuples, pointer to heap allocated values *)
(* spaces are required to disambiguate *)
val xyx-box = '( 'A', 1, 2.0 ) 

http://ats-lang.sourceforge.net/DOCUMENT/INT2PROGINATS/HTML/x302.html

scolsen avatar Jan 05 '21 18:01 scolsen

Flat is nice, I like it!

eriksvedang avatar Jan 05 '21 19:01 eriksvedang

Not that I have any better name to propose but isn't it a bit weird to call something Flat if we don't have Box?

Is mcpy too confusing?

TimDeve avatar Jan 07 '21 15:01 TimDeve

I think mcpy would work as well, I agree that flat would be nicer if box was a more prevalent concept in our code and docs.

scolsen avatar Jan 07 '21 16:01 scolsen

What about trivially-copyable?

jacereda avatar Jan 07 '21 18:01 jacereda

Not that I have any better name to propose but isn't it a bit weird to call something Flat if we don't have Box?

Is mcpy too confusing?

We might add Box later though! I think the most important thing is that the name is good on its own.

mcpy is a little too hard to read/say for my liking – in that case I think it makes more sense to just call it memcpy to make the correlation with the C function super clear.

@jacereda That name is pretty interesting too, it's very clear.

Maybe shallow could work?

eriksvedang avatar Jan 08 '21 06:01 eriksvedang

shallow-copy?

TimDeve avatar Jan 08 '21 13:01 TimDeve

Yes, that too. If seen as a "tag", the interface should probably just be called shallow but if we're going to actually call it, shallow-copy is better (and this argument applies to all other name suggestions too).

eriksvedang avatar Jan 08 '21 13:01 eriksvedang

@jacereda That name is pretty interesting too, it's very clear.

It's what C++ uses: https://en.cppreference.com/w/cpp/types/is_trivially_copyable

jacereda avatar Jan 08 '21 15:01 jacereda

I'll switch to trivially-copyable with the single function trivial-copy.

eriksvedang avatar May 26 '21 09:05 eriksvedang