« first day (2248 days earlier)      last day (932 days later) » 

12:01 AM
RELOAD!
[rubberduck-vba/Rubberduck] 1 closed issue. 1 issue comment.
[Zomis/Games] 1 opened issue. 3 issue comments.
[Minesweeper] Games Played: 76, Bombs Used: 29, Moves Performed: 9257, New Users: 12
 
 
13 hours later…
1:17 PM
@IvenBach yeah, no the reason it doesn't work in the VBE is only because this was too shitty and ended up dropped:
16
Q: Step by Step, ooh HotKey

Mathieu GuindonStill hooked on Windows, I refactored the hook into a number of interfaces, and I wanted to support 2-step hotkeys, so I started with defining an IHook that can be attached, detached, exposes a property that tells whether a hook is attached or not, and raises an event when the hook receives a mes...

one day this will be re-implemented, correctly
 
2:02 PM
@IvenBach State diagrams are particularly useful when you deal with state machines (e.g. returning change, a surprising amount of hardware things)
@IvenBach "relies on" is not really correct. State diagrams are a way for puny humans to make sense of regexes
regexes (in the "original CS sense") are more abstract and can be described as a ... Ring? I think?
my Maths foundations have become very spotty
 
2:44 PM
@Vogel612 or, a hand-written parser?
Is the state diagram that one with the vertical lines and horizontal arrows? I never "got" that one, felt overkill for simple things and unreadable for complex things.
 
a parser is usually a state machine, yes
@MathieuGuindon no, not really?
 
oh
could be just me =)
opens wiki link ah, yeah no definitely not what I thought
 
state diagrams do get pretty complex for complex machines though...
 
3:10 PM
With a single enum property there would take an arrow for every Member of the enum?
That’s how I currently understand it.
 
uhhh... wat?
 
If so it would get very complex very quickly.
 
State diagrams and enums are ... basically unrelated?
some people use enums to represent states for state machine implementations when the states are known at compile time
 
A state diagram is a representation of the state of an object.
 
no, not really
it can be, but it's usually not something you'd use
 
3:12 PM
Then, par for the course, I’ve not understood again.
 
consider class Foo { String bar, int baz }
the state diagram for an instance of Foo is functionally infinite
that's because instance.bar += " " is a transition between two states and you can do that until your memory runs out
 
That is so because the string effectively makes it so.
 
it doesn't help that isntance.baz += 1 also is valid and you can do that until you overflow
note that for any given value of bar there is (2^33)-1 states, one for each possible value of baz
 
Are state diagrams then used only for relevant changes to a new state?
 
it's much more useful to think of state diagrams as representations of the state of a system
and to unify different states of the underlying objects into the same "functional state"
A very common state diagram is "what state is a thread in"
and this also allows you to define the ways in which the system is allowed to transition between states
 
3:17 PM
Threads. More territory Iven doesn’t know and isn’t comfortable with.
 
Rubberduck also has a state machine in the parser
there's allowed and not allowed transitions between different states of the ducky
e.g. you can never go from "Ready" to "Resolving Declarations"
that's just not something the "system" Rubberduck can do
 
More generally then, is any OOP Instance which has a backing field a state machine?
 
no
 
Why?
 
because while an instance encapsulates state it doesn't necessarily define transitions between states
basically the arrows are missing
 
3:20 PM
Ok
One sec.
A get only property wouldn’t be a state machine. Reason being there is no mechanism whereby the internal state is allowed to change. Barring any other members changing state.
 
yes
 
Woot!
Adding a setter would then make it a state machine?
 
not in the strict sense
 
How about in the loose hand wavey Iven sense?
 
the whole point of a state machine is that you can not go from every state to every other state
 
3:24 PM
Two typical example of a state machine are implementations of the two sides of the TCP protocol.
 
but if you just have a setter, you can set any value, regardless of which value is currently the state
while that's also a state machine, it's not really a useful state machine
 
@Vogel612 Yes, regexes form a ring with alternative as addition and concatenation as multiplication.
 
Huzzah, I remembered that correctly :D
 
@Vogel612 Why?
I’m missing the obvious again
 
I had to look up the formal definition of a regex.
 
3:27 PM
The information "You can do anything whenever, or don't, I don't care" is not an interesting information
hmm .. maybe I should be more exact: adding a setter would make it a state machine. it'd just be an extremely useless state machine
@IvenBach do you have these crappy snack vending machines in the US, that most of the time take your money and then mess up giving you the thing you requested?
those are a state machine
 
As a typical useful example, take a circuit breaker.
It has two states, open and closed.
 
"Wait for Input" -> "Wait for Money" -> "Hand out the thingy" -> "Return Change" -> "Wait for Input" is their states, though there also is an arrow from "Wait for Money" to "Wait for Input"
 
If you get a high current on in the opened state, it will make transition to the closed state.
 
anyways, I gotta get some groceries if I don't want to sustain off of frozen foods for the remainder of the weekend, so I'm off for a bit
 
3:46 PM
Those examples I understand as I’m familiar with them.
The transition to the abstract OOP is my stumbling block.
 
One way you can represent a state machine in an OOP way is to have an IState interface with different operations that return an IState.
The different states then implement the interface.
For each operation not inducing a state change, the state just returns itself.
E.g. you could have an ICircuitBreaker with methods (double outputCurrent, ICircuitBreaker newState) ReceiveCurrent(double inputCurrent) and ICircuitBreaker FlipSwitch().
The opened state returns the input current together with itself below a certain threshold and zero together with the closed state above it for ReceiveCurrent.
The closed state always returns zero together with itself for ReceiveCurrent.
FlipSwitch always returns the other state.
Actually, you might want to call it ICircuitBreakerState and hide the transition mechanism behind a CircuitBreaker that holds an internal state and always replaces it with the state received as part of the return value.
 
4:56 PM
ugh. don't drink and eBay. Currently bidding on two laptops, only want one. Hopefully I'll get outbid on one or other....
 
 
1 hour later…
6:14 PM
@IvenBach You can also see an example of how one can implement a state machine in th rust documentation.
 
 
1 hour later…
7:38 PM
@IvenBach Consider how a small OOP app representing a stop light would be written. Three lights - any of the tree lights can can be on or off (but never two or three 'on' and never three 'off' at a time!)...there are a finite set of allowed stoplight 'states' (combinations)...stop, go, caution. Transitions are: stop -> go, go -> caution, caution -> stop...rinse and repeat
 
8:02 PM
state transitions triggered by a simple timer 'timed-out' event.
 
@mansellan LOL! How'd it go?
 
@FreeMan dunno yet, one finshes in 22h, the other in 5d
worst case I can easily put them straight back up for sale, I didn't post silly bids.
 
Oh, well, you've got time to get outbid. Or make more money!
 
lol yep
 

« first day (2248 days earlier)      last day (932 days later) »