Re: Where have all the Pikers gone?
On Fri, Oct 8, 2021 at 2:57 PM Duke Normandin wrote: > > Long time passing ... > > Is this list/language THAT dead? > No community chatter? At all? No users? > > Maybe everybody is on IRC maybe? Is there an IRC Pike channel? > It's been pretty quiet here. The language itself still sees changes though, and I'm currently browsing the 34 commits since I last pulled. So the language isn't dead even if the mailing list is quiet. ChrisA
Re: Where have all the Pikers gone?
On Fri, Oct 8, 2021 at 3:43 PM Duke Normandin wrote: > > On Fri, 8 Oct 2021 15:04:47 +1100 > Chris Angelico wrote: > > > On Fri, Oct 8, 2021 at 2:57 PM Duke Normandin > > wrote: > > > > > > Long time passing ... > > > > > > Is this list/language THAT dead? > > > No community chatter? At all? No users? > > > > > > Maybe everybody is on IRC maybe? Is there an IRC Pike channel? > > > > > > > It's been pretty quiet here. The language itself still sees > > changes though, and I'm currently browsing the 34 commits since I > > last pulled. So the language isn't dead even if the mailing list > > is quiet. > > Good to know! This Pike noob was getting worried! It just seemed to > me - at first glance - that Pike should be as popular in the Web > development domain as Ruby for example. I was beginning to think > that Pike was all but buried! Hmm, Pike's a bit more niche than Ruby, so it's never going to be quite as popular or as visible. But it is incredibly useful, and as such, won't die easily :) ChrisA
Re: Where have all the Pikers gone?
On Fri, Oct 8, 2021 at 4:00 PM Duke Normandin wrote: > > On Fri, 8 Oct 2021 15:53:56 +1100 > Chris Angelico wrote: > > [snip] > > > > Good to know! This Pike noob was getting worried! It just > > > seemed to me - at first glance - that Pike should be as popular > > > in the Web development domain as Ruby for example. I was > > > beginning to think that Pike was all but buried! > > > > Hmm, Pike's a bit more niche than Ruby, so it's never going to be > > quite as popular or as visible. But it is incredibly useful, and > > as such, won't die easily :) > > Out of curiosity, what IS Pike's niche? For some reason I always > supposed that it was web back-ends. That and MUD servers, largely. It's also very good at eternal uptime (since it makes on-the-fly updates easy). I use Pike for my MUD server, my MUD client, my Twitch channel bot, and a variety of other things. Of course, it's also a general-purpose language with a rich standard library, so there'll be times when it's the right choice even if it isn't specifically its niche (for example, I have a savefile analyzer for Europa Universalis IV written in Pike, partly to take advantage of socket services and async I/O, and partly because of the LR Parser module). > BTW, IS there an IRC channel for Pike users? Not sure. I don't use IRC, other than for my Twitch bot. ChrisA
Re: Arrays
On Tue, Oct 19, 2021 at 9:19 AM Duke Normandin wrote: > > Pike v8.0 release 702 running Hilfe v3.5 (Incremental Pike Frontend) > > > array(string) flat = ({"this", "that", "the", "other"}); > > flat[1];(4) Result: "that" > > > flat[1]=3; > (5) Result: 3 > > > flat[1]; > (6) Result: 3 > > I was under the impression that array(string) would exclude any > other data types but strings. > > What's going on? It doesn't work in Hilfe, but "#pragma strict_types" will flag a script as wanting more stringent type checking, and will flag assignments like that. ChrisA
Re: Arrays
On Tue, Oct 19, 2021 at 10:03 AM Duke Normandin wrote: > > On Tue, 19 Oct 2021 09:26:34 +1100 > Chris Angelico wrote: > > > On Tue, Oct 19, 2021 at 9:19 AM Duke Normandin > > wrote: > > > > > > Pike v8.0 release 702 running Hilfe v3.5 (Incremental Pike > > > Frontend) > > > > > > > array(string) flat = ({"this", "that", "the", "other"}); > > > > flat[1];(4) Result: "that" > > > > > > > flat[1]=3; > > > (5) Result: 3 > > > > > > > flat[1]; > > > (6) Result: 3 > > > > > > I was under the impression that array(string) would exclude any > > > other data types but strings. > > > > > > What's going on? > > > > It doesn't work in Hilfe, but "#pragma strict_types" will flag a > > script as wanting more stringent type checking, and will flag > > assignments like that. > > Do you mean that the #pragma can be used in Hilfe as well as > scripts? Or just in scripts? Pragmas don't directly work in Hilfe, but you can use this directive to enable strict_types: > set warnings strict Unfortunately, the version of Pike I'm using (a trunk build of 8.1.14) has a lot of spurious warnings from strict_types, so I tend not to use it. But if it works for you, then go for it. ChrisA
Re: Fredrik Hübinette Book
On Wed, Oct 20, 2021 at 6:19 AM H William Welliver wrote: > The only major flaw I am aware of is that the GTK example doesn’t work as > described because GTK1 isn’t supported anymore and it wasn’t updated to GTK2. > ... and needs to be updated to GTK3 if it's to survive. As the Red Queen explained it, it takes all the running you can do just to stay in the same place, and you have to go twice that fast to actually get anywhere. > At the end of the day, the situation Pike finds itself in is the same today > as it was 15 years ago: it is largely a volunteer project. The Pike High > Wizards are busy doing their wizarding, and they have left it up to others to > fill in the gaps. That seems to be an entirely reasonable position for them > to take. I took that as a call to arms and over the years spent many, many > hours trying to fill gaps [1] and have always welcomed assistance, but almost > without exception, it’s been a solo effort. None of it has seemed to move the > needle. So, I find myself resigned to the idea that advocacy by one person > simply comes across as a crazy person yelling into the wilderness. I continue > to use pike because for almost all tasks, it continues to be the most > efficient way for me to solve a given problem. > > I’m always happy to take time when a reasonably well defined problem is > identified, so please feel free to do so and we’ll see if it can be solved. > > Thoughts? Comments? Suggestions? > There are some fairly cool features in the latest Pike builds that, to my knowledge, aren't well documented yet. Maybe someone - and I'm fully aware that that probably means "I" - should put together an example of a socket server with on-the-fly updates and asynchronicity provided by continue functions. ChrisA
Re: Fredrik Hübinette Book
On Wed, Oct 20, 2021 at 8:09 AM wrote: > > There are some fairly cool features in the latest Pike builds that, to > > my knowledge, aren't well documented yet. Maybe someone - and I'm > > fully aware that that probably means "I" - should put together an > > example of a socket server with on-the-fly updates and asynchronicity > > provided by continue functions. > > > > I don't think there's much in the way of documentation of the Concurrent > and async stuff that's landed in 8.1. A tutorial of that (or some > subset) ala the annotations document I wrote would be really welcome, > even if it's not "publication ready"! I don't want to promise to do it, but I'll see what I can knock together. Oh, another thing that would be really awesome to have better documented - and this time, I sincerely hope that I'm not the best one to do this, since I know very little about it - is the Parser.LR module. I've used it to very good effect in a number of projects, but still feel like I'm messing around blindly a bit. ChrisA
Re: Fredrik Hübinette Book
On Wed, Oct 20, 2021 at 8:11 AM Chris Angelico wrote: > > On Wed, Oct 20, 2021 at 8:09 AM wrote: > > > There are some fairly cool features in the latest Pike builds that, to > > > my knowledge, aren't well documented yet. Maybe someone - and I'm > > > fully aware that that probably means "I" - should put together an > > > example of a socket server with on-the-fly updates and asynchronicity > > > provided by continue functions. > > > > > > > I don't think there's much in the way of documentation of the Concurrent > > and async stuff that's landed in 8.1. A tutorial of that (or some > > subset) ala the annotations document I wrote would be really welcome, > > even if it's not "publication ready"! > > I don't want to promise to do it, but I'll see what I can knock together. > Starting the document in my bot's repository. Can be lifted straight into Pike's own docs if/when it's good enough - license terms are very free (MIT). https://rosuav.github.io/StilleBot/Asynchronicity ChrisA
Re: Fredrik Hübinette Book
On Wed, Oct 20, 2021 at 2:44 PM James Latham wrote: > > Dear Pike lovers: > Thanks for the very informative Blog that you have created. > I would love to join in. > Is there any way to create a distributable pike program? > Ideally it would be all in one module. > Jim Latham Yes, absolutely! I've often made one-file Pike programs. For instance, I have a git hook that I use in a number of projects, and it's all contained in one file (called, surprisingly enough, "githook.pike"), marked executable, and with an appropriate shebang. ChrisA
Re: Fredrik Hübinette Book
On Wed, Oct 20, 2021 at 9:10 PM Robert J. Budzyński wrote: > > > > On Wed, Oct 20, 2021 at 7:44 AM Chris Angelico wrote: >> >> On Wed, Oct 20, 2021 at 2:44 PM James Latham wrote: >> > >> > Dear Pike lovers: >> > Thanks for the very informative Blog that you have created. >> > I would love to join in. >> > Is there any way to create a distributable pike program? >> > Ideally it would be all in one module. >> > Jim Latham >> >> >> Yes, absolutely! I've often made one-file Pike programs. For instance, >> I have a git hook that I use in a number of projects, and it's all >> contained in one file (called, surprisingly enough, "githook.pike"), >> marked executable, and with an appropriate shebang. >> >> ChrisA >> > > Er, that assumes the pike runtime is available. I believe what Jim had in > mind was a situation where you can't assume that on the user's end. Oh. Having had experience with this kind of thing in Python, I am of the opinion that it's a lot more hassle than it's worth. Trying to make a single executable that runs on every target platform is a nightmare, so what usually happens is that someone spins up a thing using the exact version of Python and Windows (it's always Windows) on the dev system, and it won't run properly on other systems. Much much cleaner to distribute a script and then have the interpreter installed elsewhere. What would be nice, though, would be to have a cross-platform way to have a script say "hey, I need this, if you don't have it please install it". ChrisA
Re: Defining Functions / Procedures
On Fri, Dec 10, 2021 at 1:10 PM Duke Normandin wrote: > > Greetings .. > > function hello =lambda() {} > > or > > void hello() {} > > In Pike, which form is prefered or optimal? Why? > TIA ... Definitely the second, unless you need it to be a variable. ChrisA
Re: OOP syntax help
On Sat, Jan 8, 2022 at 10:46 AM Duke Normandin wrote: > > I've /never/ been fond of OOP, but if I'm to continue with Pike, I > figure I should at least try to understand Pike's very of OOP. > > From: https://pike.lysator.liu.se/docs/tut/oop/creation_and_usage.md > > [quote] > Creating and Using Objects > > Assuming that we have the class animal, we can define some > variables that can be used to store animals. Remember that the > class is also a data type. We can also create some animals to put > in those variables. To create an animal, we use the syntax > *classname*(), i e the name of the class followed by a pair of > parentheses. > > animal some_animal; > some_animal = animal(); > animal my_dog = animal(); > [/quote] > > The three statements are confusing to me. > So a class called "animal" has been created and exists! OK .. > > "animal some_animal;" ?? Are we cloning the class here to create an > object? At that point, you're just declaring a variable, same as saying "int some_number;" or "array some_collection;". Since you don't initialize it, it defaults to 0 (specifically UNDEFINED, the special zero with that flag). > "some_animal = animal(); ?? So what's this than? This is actually cloning the animal program, or instantiating the animal class, or whatever you want to call it. This is actually constructing an animal and assigning it to some_animal. > "animal my_dog = animal(); ?? It seems to me that this should be > the cloning statement to create a particular object of the animal > class? This is the combination of the previous two lines: declaring my_dog and also constructing a dog. > It's all a bloody muddle to me. I'm sure that I must be reading it > wrongly. The thing to bear in mind is that variable declarations are just a hint saying "hey, this thing should store this type of thing". It doesn't actually construct anything. You could put a generic "object" there instead (or even "mixed") and it would behave the same way: object some_animal; some_animal = animal(); object my_dog = animal(); Calling a type constructs an object, just as it does in Python (and in JavaScript if you use the "new" keyword with the call). You can then assign that object to any compatible variable; notably, a variable that wants a Foo can accept any object that inherits Foo (or if you like: an object counts as all of its supertypes). ChrisA
Re: OOP syntax help
On Sat, Jan 8, 2022 at 11:12 AM Duke Normandin wrote: > > On Sat, 8 Jan 2022 10:58:53 +1100 > Chris Angelico wrote: > > [snip] > > > > "animal my_dog = animal(); ?? It seems to me that this should be > > > the cloning statement to create a particular object of the > > > animal class? > > > > This is the combination of the previous two lines: declaring > > my_dog and also constructing a dog. > > This was what confusing me. Makes sense now that I know the > statement is a combo of the two preceding ones - like declaring and > initialising a variable all one statement in some languages. > > [snip] > > Thanks for clearing that up. I also notice that class declarations > are called "programs" - not to be confused with the "main" program > to be executed. Is that a correct interpretation? If a class is > declared within a program, in Pike its a "program" within a > program? :? (Redirecting back to the list.) It's a bit of history from LPC, and others would be better at explaining than I am, but my understanding is that it derives from the fact that your whole script is itself a class definition. In fact, you can actually clone a program by its file name - there's a standard way to cast a string to a program (or directly to an object), which loads the script from disk and parses it. object parsevdf = (object)"parsevdf.pike"; The file "parsevdf.pike" contains a program, by any definition of the word. According to Pike, it contains the definition of a class - which means that this class is a program. ChrisA
Re: Where have all the Pikers gone?
On Fri, 20 May 2022 at 23:51, Duke Normandin wrote: > > On Fri, 20 May 2022 12:55:32 +0200 > "Stephen R. van den Berg" wrote: > > > Duke Normandin wrote: > > >Awesome! So it seems to me that Pike should be able to give Ruby, > > >PHP, Perl, Python etc a good run for their money in the Web > > >backends domain. > > > > It does, actually. > > It's odd then that Pike is never mentioned on Slashdot or Hacker > News etc! There's not even an IRC channel for it. Other than your > own site, do you know of any others besides roxen.com? > My Twitch channel bot runs its own web interface, if that counts. https://sikorsky.rosuav.com/ I take advantage of Pike features to run that site with real-time updates (via websockets) that slide to the latest code every time I do an update (even without reconnecting the socket). Very handy when live-streaming code changes (although I do occasionally manage to segfault it). ChrisA
Re: Where have all the Pikers gone?
On Sat, 21 May 2022 at 09:42, chikega wrote: > > I’m a new learner. It's interesting to see results on Google Trend comparing > various high-level programming languages like Perl, PHP, Ruby, Lua. When I > punch in 'Pike programming language', I get this: "Hmm, your search doesn't > have enough data to show here." :-/ > > https://trends.google.com/trends/explore?date=all&geo=US&q=lua,ruby,Perl,PHP > I usually explain to people that Pike is an obscure, but excellent, language, with similarities to Python, C++, and various others, with a focus on networking. But it's impossible to sum up a programming language in a single sentence without omitting a lot of what makes it great :) ChrisA
Re: Pike in the News
On Mon, 23 May 2022 at 05:28, wrote: > b) Where's the source code? > > Here, I actually sort of agree that there's a discoverability problem. Yeah, more than sort-of for me; I can't really just link someone to the landing page and assume that they'll be able to find everything. Not sure that it counts as low-hanging fruit, but it's certainly fruit if someone wants to put in some effort. > Some things I found really interesting: > > a) Concurrency, ie the GIL > > What are the ways for improving concurrency, and how big of a problem is > it? I'm sure it can be a real problem, just wondering if anyone has any > experience probing what they are? Aside from unlocking in c-language > modules, seems like the solutions for single-process improvements are > pretty invasive. Is there an opportunity to provide some tooling to > allow tasks to be spread across a number of pike processes in order to > get around the GIL? I did some work with zeromq, which positions itself > as a way to improve concurrency without the risks of multi-threading. > Perhaps some sort of pike clustering module/etc could provide > performance improvements? Removing the GIL? I think that that's likely to be a major issue, given how hard it is to do it in CPython. Or rather, given that every attempt to remove the GIL from CPython has resulted in enough of a performance hit for single-core work that it's simply not worth the cost. There was some work being done a while ago on memory arenas, where different threads could have their own address spaces, and thus their own independent locks; the GIL would then only be needed for guarding access to global/shared objects. Did that go anywhere? Another thing that I'd love to see, in terms of concurrency, is some enhancements to asynchronous I/O. Pike currently *far* outstrips Python in the convenience of going to a back-end event loop (just return -1 from main(), where in Python you have to play around with the asyncio module); but on the flip side, Python has actual native support for async functions, and Pike only recently gained the underlying structure of continue functions. If I could just dream for a bit, here's what I'd love to see in Pike: 1) Asynchronous functions are declared to return their "ultimate" return value, but can always yield a Concurrent.Future without needing to declare this. Currently, I use declarations like this: continue mapping|Concurrent.Future some_function(...) { ... } which is just noise - in reality, it will only ever "return ([...])" and only ever "yield some_future". 2) A built-in function that tells you whether something is a continue function, a continuation function, or a regular function. I currently use this hack to recognize when it's the special function returned from a continue function, but there's no way to know about the other two: int(0..1) is_genstate(mixed x) {return functionp(x) && has_value(sprintf("%O", x), "\\u");} Even better if it can indicate that a continuation function has finished. (Or maybe that's a separate function.) That would, with no ambiguity, tell you whether the last thing it did was "yield" or "return". Currently, the only way to tell is to call the function again and see if you get back a 0, which is not guaranteed anyway, since it could yield 0. 3) Minor, but an easier way to raise an exception into a continue function. Currently, the way to do that is: resp = gen(0) {throw(err);}; and I don't think that's very obvious. A direct way to throw something into the continue function like "raise_in(gen, err)" would make that clearer, and hopefully more efficient (the convenient shorthand that I used there, since it's implicit-lambda, is probably quite inefficient). 4) A function (probably in the Concurrent module) that takes all of the above and wraps up the logic of repeatedly calling a generator function with the results of a promise. The way I've implemented it is the spawn_task class here: https://github.com/Rosuav/StilleBot/blob/master/globals.pike#L150 (Line number might be wrong in the future, as that's a live project and does see changes on a regular basis.) With all of those features, the language itself would have great concurrency support, and you could simply call Concurrent.spawn(some_func()) to set an asynchronous operation going. > b) Embedded/embedding > > 2 possible meanings here; > > a) embedding a pike interpreter in another program, which is possible > and I've shipped several projects that use this. Don't think this would > be of interest to most people, but could be made a lot nicer with just a > little effort. > > b) running some variant of a pike interpreter on microcontroller scale > devices (Ala micropython, etc). Potentially huge audience, but seems > like the pike interpreter isn't really suited to being scaled down to > fit/run: a pretty hefty controller would be necessary and without a real > os and limited ram, you'd probably give up a lot of the things that pike > excels at: networki
Re: Hash mark prefix to a string
On Sun, 29 May 2022 at 10:21, Duke Normandin wrote: > > I asked this question on the Pike channel on libera.chat but nobody > is lurking at the moment. :) > > what does the # mean herein the following? > > [code] > str = > #"This is a multiline string > terminated by a double-quote like any other string"; > [/code] > > I've searched all the available docs that I can find, but have yet > to stumbled on an explanation of this syntax. TIA .. A hash-quoted string can go across multiple lines. It's a preprocessor directive, like #define or #if, so the hash is indicative of that. (Unlike most preprocessor directives, it can happen anywhere in the line.) You can actually see what the preprocessor does by running "pike -E scriptname.pike", which will print out the code after preprocessing. A hash-quoted string is replaced with a string containing "\n" newline escapes, which is what the main parser then works with. ChrisA
Re: Promises and MySql seem to not return
On Wed, 20 Mar 2024 at 08:09, Henrik Grubbström (Lysator) @ Pike (-) importmöte för mailinglistan <6...@lyskom.lysator.liu.se> wrote: > > > Hey, folks. > > Hi Mike. > > > We have a MySql database we need to connect to on this project, and > > having trouble getting asynchronous requests to work. > > > > If we use `dbconn->typed_query`, we get the expected response. > > > > With promise_query, seeing: `SQL status: still running...` > > > > Chris Angelico promises (pun intended) to pry further into it, and I > > hope you don't mind more spam from me in the meantime. > > > [...] > > The first thing to check is: Have you started the default backend (ie > returned -1 or a Concurrent.Future from main()? > Yes, the backend is running. I did some further tests and have found that the PostgreSQL bindings work fine either synchronously or asynchronously, and MySQL works synchronously, but not async. Here's my test code, using async functions: Concurrent.Future main() {return test();} __async__ void run_test(string uri, string query) { werror("** %s ***\n", uri); Sql.Sql dbconn = Sql.Sql(uri); werror("Query result: %O\n", dbconn->typed_query(query)); mixed q = dbconn->promise_query(query); werror("Promise: %O\n", q); mixed result = await(q); werror("Result: %O\n", result); werror("Rows: %O\n", result->get()); } __async__ void test() { await(run_test("pgsql://USER:PASSWORD@127.0.0.1/DATABASE", "select 1")); await(run_test("mysql://USER:PASSWORD@127.0.0.1/", "select 1 from dual")); } Equivalent using explicit promises: int main() {test(); return -1;} Concurrent.Future run_test(string uri, string query) { werror("** %s ***\n", uri); Sql.Sql dbconn = Sql.Sql(uri); werror("Query result: %O\n", dbconn->typed_query(query)); mixed q = dbconn->promise_query(query); werror("Promise: %O\n", q); return q->then() {[mixed result] = __ARGS__; werror("Result: %O\n", result); werror("Rows: %O\n", result->get()); }; } void test() { run_test("pgsql://USER:PASSWORD@127.0.0.1/DATABASE", "select 1")->then() { run_test("mysql://USER:PASSWORD@127.0.0.1/", "select 1 from dual")->then() {exit(0);}; }; } Running with -DSP_DEBUG shows something rather curious: Query result: ({ /* 1 element */ ([ /* 1 element */ "1": 1 ]) }) Create future mysql(/*127.0.0.1 via TCP/IP*/) "select 1 from dual" 0 Create future result mysql(/*127.0.0.1 via TCP/IP*/) "select 1 from dual" 0 Callback got ({ /* 1 element */ ({ /* 1 element */ 1 }) }) Callback got 0 Future succeeded "select 1 from dual" Promise: __builtin.Sql.Promise(no future,FutureResult from query: "select 1 from dual", bindings: 0 recordcount: 1 SQL status: still running...) The final line of output here comes from printing out the promise before awaiting it, but the query has already actually been run at this point (the "Callback got" lines show the incoming data). This isn't the case with the PostgreSQL bindings. It's possible something in the MySQL bindings is operating synchronously. Side note: Pike actually doesn't build against the latest MySQL due to the removal of some ancient deprecated functions, so I have been using the MariaDB client which is what ships with Debian anyway. They're meant to be equivalent so I doubt this is the cause of the issue. ChrisA
Re: Promises and MySql seem to not return
On Wed, 20 Mar 2024 at 21:30, Henrik Grubbström wrote: > > Thanks for the report and test case. > > Fixed in Pike master. It was due to the initialization order > in Sql.Promise::create(). Thanks! Confirmed fixed. > > Side note: Pike actually doesn't build against the latest MySQL due to > > the removal of some ancient deprecated functions, so I have been using > > the MariaDB client which is what ships with Debian anyway. They're > > meant to be equivalent so I doubt this is the cause of the issue. > > Please make a report at https://git.lysator.liu.se/pikelang/pike/. > Done. https://git.lysator.liu.se/pikelang/pike/-/issues/10149 ChrisA