Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ask HN: Is there a name for the concept of "value changes upon read"?
5 points by uvTwitch on June 28, 2012 | hide | past | favorite | 9 comments
I'm trying to think of a name to use to describe a value which will reliably change upon being read. Not the nature of the change, but naming this concept of change-upon-read.

For example, I have this, complete with syntax error: class Alternator{ bool value; implicit cast(bool) { get { return value = !value; } } }

I know that this phenomenon exists in quantum physics - that the state of a particle will change due to the act of reading the particle's state - but I don't know if there is a term for it, though if there is it would be ideal.

I figure naming it is important, because otherwise i'm left with mystery object with dodgy tacit behaviour, which is not cool for the uninitiated.



I mean "In* quantum mechanics* a wave function* is said to "collapse" when observed, so maybe a collapsing value?"


This sounds about right; and 'collapsing' has the added benefit of sounding inherently dangerous-handle-with-care. Thanks! :D


I'm not sure what the right name for _that_ is, but I have no doubt it'll be used to write heisenbugs...


exactly why I want a name for it, to reduce heisenbug potential.

It certainly necessitates careful application, but does have it's uses in reducing copypasta.


Not sure what it was called, but some early RAM technology had this exact behaviour. Whenever you read one bit from memory, it got toggled so you had to immediately write it back again, which toggled it back to the correct value.


In quantum mechanics a wave function is said to "collapse" when observed so maybe a collapsing value?


"a write"


Its typicaly considered the worst of all side effects of a programming language. Ive heard it referred to only as a side effect. But there is the issue of representation in quantum physics which is real, observation does change the state.

Good question but programming languages avoid this, you would have to coin your own.


I would call it a "volatile read". Maybe it changes the state maybe it doesnt. Especially since we dont know yet why exactly this occurs.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: