123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- <?php
- /**
- * <https://y.st./>
- * Copyright © 2016 Alex Yst <mailto:copyright@y.st>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <https://www.gnu.org./licenses/>.
- **/
- $xhtml = array(
- 'title' => 'Student debt',
- 'body' => <<<END
- <img src="/img/CC_BY-SA_4.0/y.st./weblog/2016/11/22.jpg" alt="A smashed-up minivan" class="weblog-header-image" width="811" height="480" />
- <h2 id="general">General news</h2>
- <p>
- I awoke to find an awful letter.
- My student loan payments are coming due now.
- The timing couldn't be worse.
- I'm trying to find a place to live, and now, about \$81 $a[USD] is going to be siphoned away each month.
- This sucks.
- It's already going to be a struggle to pay the rent.
- I logged into the loan repayment website to make a payment, and it seems that the website no longer likes my email address and wouldn't allow me to send a payment until I changed it.
- That's idiotic.
- </p>
- <p>
- As I was headed to out to go to work, my mother got toed home.
- They had hit a deer, mangling the front of their car! Later in the day, someone sent by the insurance agency came by to haul the vehicle away for examination.
- Making sure that my mother was okay and discussing the event with them took some time, and I thought that I was going to be late to work.
- However, I still had fifteen minutes to spare! The shift leaders were nearly late though, only showing up a few minutes before everyone needed to be ready to clock in.
- </p>
- <p>
- I think that I better understand the decision in $a[PHP] not to have <code>\\var_export()</code> simply serialize any objects that it comes across and wrap them in calls to <code>class::__set_state()</code>.
- If you wanted the object serialized, you'd simply use the <code>\\serialize()</code> function instead! As a bonus, that function can even serialize multidimensional arrays nested objects, and combinations of the two.
- However, that doesn't mean that I agree with the decision to implement <code>\\var_export()</code> this way.
- Simply put, <code>\\var_export()</code> attempts to output a string representing the declaration of a variable's value.
- However, objects aren't like other variable values and, at least as the syntax of $a[PHP] currently exists, objects cannot simply be "declared".
- The concept of declaring an object doesn't make any sense, given the way that objects and classes work.
- Any attempts to "declare" an object is going to come out messy, as it does with <code>class::__set_state()</code>.
- The most important issue with <code>\\var_export()</code> is probably that while it serializes objects in a way, it doesn't have a <strong>*pre-serialization*</strong> method acting as a counterpart to <code>class::__set_state()</code>; a <code>class::__get_state()</code> method, as it were.
- This method should be part of a pair, like <code>class::__sleep()</code> and <code>class::__wakeup()</code> are.
- In other words, the way that <code>\\var_export()</code> works is a bit incomplete.
- Adding to this incompleteness is the way in which <code>\\var_export()</code> names its array keys.
- Inherited properties overwrite child properties, potentially causing information loss.
- If <code>\\var_export()</code> used the same array key structure that <code>\\serialize()</code> uses, property names from multiple classes would have unique names when need be.
- Also though, <code>\\var_export()</code> assumes that every class has a <code>class::__get_state()</code> method.
- This isn't always the case, and shouldn't be assumed.
- </p>
- <p>
- My <a href="/a/canary.txt">canary</a> still sings the tune of freedom and transparency.
- </p>
- <h2 id="include.d"><a href="https://git.volatile.ch./y.st./include.d/releases">include.d</a></h2>
- <p>
- I took a look at my <code>\\st\y\uri</code> class, and I think that most of it, if not all of it, will need to be entirely written from scratch.
- What a pain.
- This will be the second major overhaul of that class.
- If it weren't for the fact that the built-in <code>\\Closure</code> class bypasses the protections offered by the <code>protected</code> and especially the <code>private</code> key word, this rewrite wouldn't be necessary.
- However, as it is, I don't think that I can get out of it.
- Furthermore, this rewrite will make a big difference for the <code>\\var_export()</code> function, causing it to produce a better array from objects of the $a[URI] classes.
- In all honesty though, I'd ignore the <code>\\var_export()</code> optimization if I wasn't dealing with the <code>\\Closure</code> class.
- </p>
- <p>
- I don't have the time, the energy, or the patience to deal with rewriting my most complex class.
- You know what? I give up.
- <code>\\Closure::bind()</code> and <code>\\Closure::bindTo()</code> break $a[API]s.
- There is nothing that I can code that will fix that, as anything that I build can be broken again with these two methods.
- As for <code>\\var_export()</code>, attempting to optimize my class for that one use case pretty much <strong>*de*</strong>-optimizes it for every other use case that I can come up with.
- If rewrite my class, I'll get cleaner output from that one function, but that function is entirely messy.
- I should instead keep my code working as best I can with mostly the same $a[API] that I've already built; there's not much to fix about it.
- I am going to need to make some key design decisions in for the $a[URI] classes before I move on with include.d development in the $a[URI] branch though.
- </p>
- <p>
- While trying to get everything working in the branch relating to the <code>__set_state()</code> method, I tried to create an abstract static method.
- Apparently, that's not allowed, which is pretty stupid.
- Stupider still, there actually <strong>*is*</strong> a way to get the desired result, it just involves splitting the abstract class into both an abstract class and an interface.
- The interface can declare as many methods as you want it to, be they instance methods or static methods.
- If a class implements the interface, any methods defined by the interface are considered to be abstract.
- Voilà! The abstract class can define any non-abstract methods that it needs to, relying on the interface to define the abstract static methods.
- Either the interface or the abstract class can define any abstract instance methods that are needed.
- Why isn't there a structure that can define full methods <strong>*and*</strong> abstract static methods? This seems like a big oversight.
- According to someone on Stack Overflow not only explained the reason for the problem, but also says that it's been <a href="https://stackoverflow.com./questions/999066/why-does-php-5-2-disallow-abstract-static-class-methods#answer-31235907">fixed in $a[PHP]7</a>.
- All that I have to do is wait, then this will work itself out.
- </p>
- <h2 id="university">University life</h2>
- <p>
- I think that I've about finished my <a href="/en/coursework/BUS1101/Behavior_management_at_the_SAS_Institute.xhtml">essay</a> for the week, but I should check it over again tomorrow if there's time before I head into work.
- By the time that I get home from work, the essay will have already been due.
- </p>
- <h2 id="apartment">Apartment hunting</h2>
- <p>
- I spoke with the property manager today, and it seems that the local property has washer/dryer hookups in each unit, but I'd need to find a way to get a washer and dryer home to install.
- This seems like an almost insurmountable feat.
- They also seem to think that the properties in Eugine have similar setups, though they don't seem to know for sure.
- They gave me a list of the property names, but they didn't have addresses for them.
- I'm not sure if I'll be able to look them up online by name or not.
- </p>
- END
- );
|