RE: Pike 8.0 RC1
郭雪松 <[email protected]>
| Newsgroups | gmane.comp.lang.pike.user |
|---|---|
| Message-ID | <[email protected]> |
The CHANGES file:
o Added new syntax for literal-string constants
#{, #( and #[ starts a literal string, and it is ended by the
corresponding end marker: #}, #) and #] respectively.
No character is modified at all inside the literal string, including
newlines, \ " and '.
So, the string #["\n\'##] will be equivalent to "\"\\n\\'#".
The main use-case is to write code in code:
| string code = #[
| void main(int c, array v) {
| string x = "";
| foreach( v[1..], string elm )
| x += reverse(elm)+",";
| write("Testing: %s\n", reverse( x ));
| #];
The three different start/end markers might be useful if you write
code in code in code, since there is no way to quote the start/end
markers.
o Added the '?:' operator for compatibility with other C-like
languages. It is identical to '||' in pike.
> Subject: RE: Pike 8.0 RC1
> To: [email protected]
> From: [email protected]
> Date: Sun, 26 Oct 2014 14:20:01 +0000
>
> I've never seen #{ etc, where/when are those used?
>
> >About '?:' . Is it just equal to '||' ? if so, why should we added
> >this? We cannot be compatible with every C-like languages. Why
> >should we be compatible with a special one?
>
> ?: is not equal to || and it has been in Pike since µLPC (1993 or so).
>
I think it's not a same '?:' we talked about.