Week 40 - 2020
The weeknote for 9/28 - 10/4.
OSS
dnoland/deno
-
A commercial book about Deno seems published by Apress. Wow!
It's finally here! In case you didn't know, with @Apress we've published a book about @deno_land ! If your interested in learning more about it, check it out! https://t.co/O992XSJegt pic.twitter.com/AysFDKklZB
— Fernando Doglio (@deleteman123) September 30, 2020
PHP 8 Attribute
-
PHP 8 has so many new features. It includes JIT, for example. I found the Attributes feature especially interesting among them.
PHP 8 Attributes has the following syntax:
#[Attribute('foo')] class Foo { ... }
This attaches the instance of Attribute class to Foo class. The instance can be retrieved as the below:
$reflector = new \ReflectionClass(Foo::class); $reflector->getAttributes();
So PHP's Attributes are like Attributes of C# or Annotations of Java. They are not like the decorators of Python or the decorators of the TC39 proposal. PHP Attributes just append metadata to the attributed elements, not dynamically replace or modify them.
TC39's decorators proposal has been experiencing hard time for over 5 years. It faces so many negative reactions from the implementers of JS engines and transpilers and their early adopters. All these negative reactions are rooted, IMO, from its too dynamical nature. Decorators modifies too much things at runtime, and that reduces the benefit of JIT. Any measures against that problem has caused other problems for now and we don't see the reasonable exit route at this moment.
PHP didn't chose Decorators, but chose Attributes. I think that was a very right choice. Most decorators' use cases are, IMO, covered by Attributes, and it doesn't make such bad impact to the runtime performance. So now Attributes seem a right tool to do Aspect Oriented Programming in dynamic language. TC39 should have promoted Attributes instead of Decorators. So I started writing Proposal Attributes in my scrapbox ( https://scrapbox.io/kt3k/proposal-attributes ).
Life
Scrapbox
- Still feels very comfortable with Scrapbox. It feels like a smart drug without chemicals.
Hammock
-
We bought a hammock.
ハンモックで揺れながらプログラム書くおじさん pic.twitter.com/gWyitC2641
— あずき (転職活動中) (@okomekirai) September 30, 2020
Iyo's kitchen
-
This week's Iyo's kitchen!
クリームシチューと
— あずき (転職活動中) (@okomekirai) September 28, 2020
おいしい食パン🍞 pic.twitter.com/yDMAI64Fnv今までで一番おいしいからあげだった pic.twitter.com/CSQJ7qEEJ5
— あずき (転職活動中) (@okomekirai) October 4, 2020
Mother
- This weekend Iyo-chan's mother visited our house. We talked about a lot of things, had dinner together, and spent a happy time.