|
A wise man once told me, "When you've had too much wine, women and song, give up song." Wise friends are priceless...
Will Rogers never met me.
|
|
|
|
|
Awkward's Humour and Sillies - Beer Troubleshooting Guide
Symptom: Feet cold and wet.
Fault: Glass being held at incorrect angle.
Action: Rotate glass so that open end points toward ceiling.
Symptom: Feet warm and wet.
Fault: Improper bladder control.
Action: Stand next to nearest dog, complain about house training.
Symptom: Beer unusually pale and tasteless.
Fault: Glass empty.
Action: Get someone to buy you another beer.
Symptom: Opposite wall covered with fluorescent lights.
Fault: You have fallen over backward.
Action: Have yourself tied to bar.
Symptom: Mouth contains cigarette butts.
Fault: You have fallen forward.
Action: See Above.
Symptom: Beer tasteless, front of your shirt is wet.
Fault: Mouth not open, or glass applied to wrong part of face.
Action: Retire to restroom, practice in mirror.
Symptom: Floor blurred.
Fault: You are looking through bottom of empty glass.
Action: Get someone to buy you another beer.
Symptom: Floor moving.
Fault: You are being carried out.
Action: Find out if you are being taken to another bar.
Symptom: Room seems unusually dark.
Fault: Bar has closed.
Action: Confirm home address with bartender.
Symptom: Taxi suddenly takes on colorful aspect and textures.
Fault: Beer consumption has exceeded personal limitations.
Action: Cover mouth.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
Many of these sound half familiar from my younger years back when I knew everything.
|
|
|
|
|
Spillage is carnage, point!
|
|
|
|
|
This is going to sound funny, but I'm trying to update some old code to use my new regex DFA format and corresponding lexing code, so I have reasons.
My new code uses C# iterators rather than manually implementing IEnumerator
The problem is my lexer generator generates code in a language independent manner the same way ASP.NET does when it compiles pages - it uses the CodeDOM. The CodeDOM does not support iterators, so I have to implement the IEnumerator interface w/ corresponding state machine myself. I can do it, but I was hoping for something where I didn't have to.
Now, it's possible that I could run code compiled with iterators in it through a decompiler tool like Reflector, but the result is nasty and really hard to follow.
And this is kind of hard to google.
I was just curious if anyone had ever seen such a tool, or otherwise has any ideas.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
Have you tried asking ChatGPT to do the work for you?
I know many may scoff at my question however I find that it is good at some things and can get close with others. It is worth a try...
Graeme
"I fear not the man who has practiced ten thousand kicks one time, but I fear the man that has practiced one kick ten thousand times!" - Bruce Lee
|
|
|
|
|
Maybe I'm old but I'm sort of put off by ChatGPT. I don't trust it. But I guess it would work for this because I can immediately verify what it tells me. Thanks.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
To this day, AI has been going where I have already "gone before" in my current interests. Depending on the subject matter (i.e. obscure), it's pretty easy to exhaust what's online. You waste time looking at what you've seen before; except now the AI has gotten "creative" with it.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
IIRC Eric Lippert called it "the most complicated transformation in the compiler."
|
|
|
|
|
It must be pretty complex. One limitation I've run into several times is that iterators can't have a try/catch. (I think I have that right.) It's very annoying and I hope they can improve the situation.
A yield statement is not allowed in a try block if there is a catch clause associated with the try block. To avoid this error, either move the yield statement out of the try/catch/finally block, or remove the catch block.
Compiler Error CS1626
|
|
|
|
|
Iterators can have try catch, but they cannot "break" try catches, so you can't have a yield in a try.
Consider how iterators work. Basically they turn your loops into gotos and build a state machine around your code in order to "continue" it, but to continue a try block would require additional catch statements for each continuation, for starters (and I haven't thought it through all the way so it may not even be doable). It might be doable, but it wouldn't be pretty.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
honey the codewitch wrote: it wouldn't be pretty.
I don't care how ugly it might be in the background. That's the beauty of high level languages.
|
|
|
|
|
I should have been more clear.
It will probably add significant bloat and maybe even be a performance hit - not something you'd necessarily want to have happen behind your back - if it's even possible to do as I said.
One problem is if your code yields in a catch block as well. You can't goto into or out of one, IIRC so I don't know how you'd break that up.
It may not be possible after all, and even if it was you'd probably have to duplicate the code in your catch blocks N times where N is the number of yields or something (not enough coffee to work it all out yet)
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
He probably said that before "async/await"
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
He did indeed. It was like fifteen years ago or so.
You also couldn't combine yield and async in the beginning.
|
|
|
|
|
honey the codewitch wrote: my lexer generator generates code in a language
I presume you really do mean that it is yours.
That is the problem of course with doing your own code generation. Of course your real choices are to update that tool or stop using iterators.
Myself I would probably just not use iterators. There probably isn't that much impacted code.
|
|
|
|
|
Maybe I wasn't clear. In order to update the tool, I need to port code from stuff that uses iterators to stuff that doesn't.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
Ok? Not sure I see how that changes what I suggested?
Porting code always involves changes. Otherwise it would just be copying code.
|
|
|
|
|
It's really difficult to port iterators away to non-iterator code for anything non-trivial. The necessary transformation is pretty complicated, and involves building state machines and using a bunch of gotos.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
honey the codewitch wrote: away to non-iterator code for anything non-trivial.
Do we have a different definition of iterator? What I am thinking of is the following. No idea how you can get to a state machine from that.
Iterators - C# | Microsoft Learn[^]
|
|
|
|
|
Yep, that's iterators.
Note that there is no intrinsic .NET support for this feature. It is a feature of the C# compiler, which works by transforming the code.
The C# compiler transforms it into a state machine based coroutine by
A) hoisting local variables to make them members of the IEnumerator implementation.
B) Implementing MoveNext() such that wherever there's a yield, that's a new state in the state machine. Because the routine actually returns at that point. When you call it again, it is "restarted" where it left off using the state machine.
All iterators are state machines once the compiler is done mangling that code.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
|
They are usually sent out well before now, but I haven't received such an email yet.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
I got it about 12:30 PM today, Eastern Standard Time.
I’ve given up trying to be calm. However, I am open to feeling slightly less agitated.
I’m begging you for the benefit of everyone, don’t be STUPID.
|
|
|
|
|
The last one I received was at 11:30am yesterday (PST)
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|