object-state

Local state of a variable

帅比萌擦擦* 提交于 2019-12-11 08:28:08
问题 I am trying to fully understand Objects and local states of their variables This code seems to produce different results for the same procedure called multiple times, meaning the local variable changes: (define new-withdraw (let ((balance 100)) (lambda (amount) (if (>= balance amount) (begin (set! balance (- balance amount)) balance) "Insufficient funds")))) For this other code, it produces the same result, which means it creates a new local variable for every procedure call: (define (make

How use bit/bit-operator to control object state?

橙三吉。 提交于 2019-11-30 21:28:44
I want to create light object data-package to pass between client and server applications. It is a so simple task, that I can control with only 1 byte, so each bit in a byte will have a different meaning, Using only the bit 0 = False 1 = True Itens I need now: 1 - Loaded from database 2 - Persisted 3 - Changed 4 - Marked to Delete 5 - 6 - 7 - Null Value 8 - Read Only 1) How do I use bit operators in Delphi to check each bit value? 2) How do I set the bit Values? Solution After all help, Ill use the next Set TStateType = ( stLoaded = 0, // loaded from persistance stNative = 2, // value loaded

How use bit/bit-operator to control object state?

蹲街弑〆低调 提交于 2019-11-30 17:11:13
问题 I want to create light object data-package to pass between client and server applications. It is a so simple task, that I can control with only 1 byte, so each bit in a byte will have a different meaning, Using only the bit 0 = False 1 = True Itens I need now: 1 - Loaded from database 2 - Persisted 3 - Changed 4 - Marked to Delete 5 - 6 - 7 - Null Value 8 - Read Only 1) How do I use bit operators in Delphi to check each bit value? 2) How do I set the bit Values? Solution After all help, Ill