RE: Pike 8.0 RC1
郭雪松 <[email protected]>
| Newsgroups | gmane.comp.lang.pike.user |
|---|---|
| Message-ID | <[email protected]> |
Safe index is nice, but if adding a ?(), it would be more useful.
X?(ARGS) should be eauivalent to ((auto _ = X),(_ && _(ARGS)))
o "Safe" index
Copied from a popular extension to other C-like languages.
X[?ind] is equivalent to ((auto _ = X),(_ && _[ind]))
while X?->ind is equivalent to ((auto _ = X),(_ && _->ind))
The main use is 'deep indexing' where some elements can be 0:
| request_id?->user?->misc?->x
vs
| request_id && request_id->user && request_id->user->misc
| && request_id->user->misc->x