Re: [NASL2] Auto-conversion with + and -
Pavel Kankovsky <[email protected]>
| Newsgroups | gmane.comp.security.nessus.devel |
|---|---|
| Message-ID | <[email protected]> |
On 9 Feb 2003, Michel Arboi wrote: > BTW, I am adding a strcat function. Maybe we'll get rid of this + > operator > (we'll have to do something with - too) String - is wierd. It appears to be pretty useful at the first glance but AFAIK 9 of 10 times it is used 1. together with strstr() to extract a given part of the string (in a rather cumbersome way), 2. together with ereg_replace() to split a string into parts (cumbersome as well), 3. to remove trailing newlines. Ad 1. can be solved with a single ereg_replace(). Ad 2. can be solved with eregmatch(). Ad 3. can be solved with chomp(). > > I think the whole concept of pure/impure strings creates considerably more > > problems than it solves. > > So do I. That's why I implemented "pure strings". But we cannot > get rid of "impure strings" without rewriting many plugins. That's why > I used a different separator for pure strings (single quote instead of > double quote) Can we declare them obsolete and avoid them in (new) scripts, please? :) Perhaps the interpreter could have something like "pragma(NASLpre2)" to mark scripts relying on obsolete features of the language. (Or the exact opposite marking new scripts not relying on them but I think it is better to make it default to the new (and presumably better) style.) > > Is there any script that (really) needs to work with impure strings > > It's easier to declare regex patterns with "impure strings" than with > pure strings. That's the only example I can think of. > e.g. ereg_replace(string: s, pattern: "A(.*)B", replace: "\1"); This means "strings where baslashes are never interpreted" rather than impure strings with magical backslashes. --Pavel Kankovsky aka Peak [ Boycott Microsoft--http://www.vcnet.com/bms ] "Resistance is futile. Open your source code and prepare for assimilation."