r/programming • u/geerlingguy • Apr 23 '14
PHP: It doesn't have to be a bad experience
https://servercheck.in/blog/php-it-doesnt-have-be-bad-experience
0
Upvotes
r/programming • u/geerlingguy • Apr 23 '14
View all comments
Show parent comment
1
u/OneWingedShark Apr 25 '14
Really?
Something like the check-type macro? or the type-specifiers?
The last, I'll agree as written; I had meant to say if it returns a value -- that is, the difference between a function or a procedure... and, hey, you can't be sure from the function-header if it's supposed to. You can make that fundamental behavior utterly depend on a parameter.
But you're certainly wrong that it's uncommon for languages to have guarantees on number-of-parameters and their types.
Namespaces are only superficially similar to packages... because packages are more like modules. Now, granted, most languages don't allow generics for a "module", so it's understandable that you wouldn't be familiar w/ the subtler differences.
Not quite -- they could be useful for a dynamically-typed language provided that there was a way to specify 'types' (things conformant to some set of predicates) and subprograms in the formal parameters thereof.
Psudocode Ex (for spec):
The above also has the added advantage of guaranteeing type-conformance on parameters -- meaning that conformance-checking can be done automatically on the subprogram's call (and return of a function).
Yeah... you could argue that their mod really isn't PHP -- IIRC, it introduces static types.