function( arguments ) { block };The function will be called with an extra argument (the block as a lambda function) as it's argument. As an example, you can write:
thread_create() { while( 1 ) { write("I am a thread\n"); sleep( 1 ); } };
Note that this can also be used for older versions of Pike; a Pike 7.0 or 0.6 script won't take offence just because you add a #pike line in the beginning of it but it will give 7.2 or later versions of pike a fair chance of running it witout complaining about incompatible changes to pike that were introduced later. By running the pike with a -V 7.0 (or 0.6 in the example given), you explicitly tell the compiler to assume compatibility mode of the given version, except where overridden by other #pike directives.
More or less the same information is also available as an task in the Administration interface.
Software......Pike Version.......Pike v7.2 release 30 WWW...........http://pike.idonex.se/ Main author...Fredrik Hübinette pike binary.../export/d1/nilsson/pike/7.2.30/bin/pike master.pike.../export/d1/nilsson/pike/7.2.30/lib/master.pike Module path.../export/d1/nilsson/pike/7.2.30/lib/modules Include path../export/d1/nilsson/pike/7.2.30/lib/include Program path.. Features......dynamic_modules threads out-of-band_data Crypto GL GTK Gdbm Gmp Gz Image.JPEG Image.GIF Image.TIFF Image.TTF Image.PNG Java Mird Mysql
search() et al are now faster than before.
Also, the Pike compiler itself is now 50% faster than before.
int a, b; foo: for (int i = 1; i <= 4; i++) { a = i; switch (1) { case 1: if (i >= 3) break foo; if (i >= 2) continue foo; } b = i; } return ({a, b}); // Returns ({3, 1})
As an example, the following code is no longer valid:
int a = 10; int a = 20;
db->query("SELECT * FROM things WHERE id > %d AND name LIKE %s", lowest, pattern);
class Foo { int a; protected string b; protected void create(int _a, string _b) { a = _a; b = _b; } } class Foo(int a, protected string b) { }
class A { int foo() { return 1; } int bar() { return foo(); } int baz() { return local::foo(); } } class B { inherit A; int foo() { return 2; } }B()->bar() will return 2 while B()->baz() returns 1.
constant boolean = typeof(0)|typeof(1); boolean flag = 1; int main( int argc, array(string) argv ) { flag = (argc>1)?(int)argv[1]:flag; write( "Type of flag is %O\n", typeof(flag) ); write( "Value of flag is %O\n", flag ); return 0; }
typedef int(0..1) boolean; boolean flag = 1; int main( int argc, array(string) argv ) { flag = (argc>1)?(int)argv[1]:flag; write( "Type of flag is %O\n", typeof(flag) ); write( "Value of flag is %O\n", flag ); return 0; }
enum boolean { false,true } boolean flag = true;
Protocols.HTTP now also accepts Standards.URI objects as input to all methods that previously used to accept only URL strings.