|
|
|
|
|
by twiss
315 days ago
|
|
I may be missing something about how the PHP compiler/interpreter works, but I don't quite understand why this is apparently feasible to implement: class BlogPostRepository extends BaseRepository<BlogPost> { ... }
$repo = new BlogPostRepository();
but the following would be very hard: $repo = new Repository<BlogPost>();
They write that the latter would need runtime support, instead of only compile time support. But why couldn't the latter be (compile time) syntactic sugar for the former, so to speak?(As long as you don't allow the generic parameter to be dynamic / unknown at compile time, of course.) |
|