Taeluf Devlog, Feb 24, 2021

Its Wednesday. I'm tired. Woke up at 4 am & couldn't go back to sleep. Normal wakeup is 8:45am. I didn't code yesterday, due to a personal commitment. I wrote a little code over my weekend (sunday, monday), for a lexer to use in Code Scrawl. The lexer isn't done & I told myself it was a side project, so I'm putting off Code Scrawl work for a couple days so I can finish up the lexer & php parser in my free time.

Goals today

  • Work on Phad for 3 hours (development)
  • Work on Liaison for 3 hours (documentation)

Phad

So glad I wrote a Status.md document. This is a new must-have for every project I do, I think.

  • Rename a few tests
  • Starting on the Form test & the internals for handling name="propName" instead of prop="propName". My current code is pretty much a mess, and I want a prototype of this working, before I start writing a better architecture.
  • Test passing for <input name="propName"> and <textarea name="otherPropName">. Realizing <select>/<option> might be a pain in the neck. Also considering that $object->property may not match the name="" in the form. Aliasing is nice. I should allow prop="" in a form, which would require a remapping step on submission...
  • I also need forms to work when no object is present. So that things can be created. But my simple solution of placing <?=$Blog->description?> inside a node doesn't work if $Blog isn't an object. One solution is conditionals. Yuck.
    • Another is a simple object to function as a blackhole. Just always return an empty string for everything.
      • I'm afraid this would have random issues down the line, like... access functions not working because the hole type doesn't match the expected type...
    • A callback that provides an empty object... Default could be to return a hole object. Override to provide empty object of proper type.
  • Api controller will have a method that returns an empty object. Hole for default, but can be overridden when type-checking is a must (or default values, etc)

Then i got very off track, distracted, a little overwhelmed, not sure where to go next. Ended up writing some notes in Phad about what's next & now I'm gonna refactor the existing compilation code before I start adding new features.

First round of refactor is done. I DON'T love it. But its better. I'll reach growing pains soon, I think.
Wrote code to make <select> list auto-choose the correct option from the current item.
But there were problems.

Phtml

doing $node->setAttribute('randPlaceholderForPhpCode', '') sets: <node randPlaceHolder="", which is expanded to <node <?='phpcode'?>="">, which prevents a single piece of php code from entirely creating an attribute (or not). Its a whole problem. I need to be able to $node->setValuelessAttribute('asdfsdfkljsdf') & it render <node alsjdfkasdlfj> with no equals... The purpose is for it to run php code. So that...

ugh.
I tried creating a custom DOMAttr class & using $node->setAttributeNode($myCustomNode) & implementing a __toString on my attr, but as I learned before... the __toStrings never get called in the rendering of a DOMDocument. After some docs review & thinking...
I might just auto-set the value to something long & unique like <node phpPlaceholder="IamBigLongStringYepYep">. Then in the output() step of PHTML, I can do a simple str_replace('="IamBigLongStringYepYep"', '', $souce)... The DOMDoc would have to have rendered already. I could do this before putting PHP back in... or after. It doesn't matter which I choose, or at least I don't think so.

Liaison

I took a lunch break & a walk. I did a little bit of Liaison documentation, though I was very slow moving.

It's 3:54 pm. I normally code til 6pm, but I started about 2 hours early today, so I told myself I could quit at 4. Truth is, I'm far too tired to do anything else productive. So I'm done.

Conclusion

Basically happy with my day. Too tired to care.