jemc changed the topic of #ponylang to: Welcome! Please check out our Code of Conduct => https://github.com/ponylang/ponyc/blob/master/CODE_OF_CONDUCT.md | Public IRC logs are available => http://irclog.whitequark.org/ponylang
<shepheb> I seem to be unable to find the right spot for this, or the right way to spell the constraint
<SeanTAllen> If you don't get it worked out, can you send your code to the mailing list shepheb ?
<shepheb> sure
<SeanTAllen> Thanks
<doublec> shepheb: I'm trying a cut down example
<shepheb> there's the complete code for this module so far
<shepheb> this is my second attempt at the parsers. the previous one was kind of screwy, so I scrapped it and I'm rewriting.
<shepheb> the main source of trouble is the last function; I can't create the alias res
trapped has quit [Read error: Connection reset by peer]
<doublec> shepheb: I got something to compile, let me paste
<shepheb> cool, I'll check it out
<doublec> shepheb: http://pastebin.com/ACr2JE3j
<doublec> shepheb: idea stolen from builtin/tostring.pony
<doublec> shepheb: The #read, etc needs to come after a type constraint
<doublec> shepheb: So I created an empty interface type constraint
<doublec> shepheb: called ParserItem
<doublec> shepheb: maybe there's something that the A has in common with Array[A] that would be better
<shepheb> i see
jemc has quit [Ping timeout: 244 seconds]
Scramblejams has joined #ponylang
jemc has joined #ponylang
jemc has quit [Ping timeout: 276 seconds]
dos000 has quit [Quit: Page closed]
trapped has joined #ponylang
copy` has quit [Quit: Connection closed for inactivity]
trapped has quit [Read error: Connection reset by peer]
srenatus has joined #ponylang
lispmeister has joined #ponylang
trapped has joined #ponylang
_andre has joined #ponylang
<shepheb> doublec: that worked perfectly. thanks!
<shepheb> it seems like this shouldn't be necessary, though, since any type can be an instance of this empty interface.
<shepheb> that is, there's no semantic difference between [A #read] and [A: EmptyInterface #read], except that the latter is legal and parses, while the former is illegal.
<shepheb> is there some theoretical problem I'm missing?
TwoNotes has joined #ponylang
Praetonus has joined #ponylang
trapped has quit [Read error: Connection reset by peer]
<TwoNotes> Is there any problem with an actor constructor doing a lot of I/O work?
<sblessing> TwoNotes: not really, since the constructor is similar to a behaviour
<TwoNotes> I have an actor that reads two disk files during its constructor. If I comment out that I/O, then the regfault I reported does not happen
<TwoNotes> segfault. Issue 623
<sblessing> huh
<sblessing> interesting
<sblessing> can you share the code of that constructor?
<TwoNotes> It creates other classes, reads and parses files, starts a TCP link. Many pages of code.
<TwoNotes> I could put my whole program into github and I could point you to the right place
<TwoNotes> I was going to publish it anyway eventuially
trapped has joined #ponylang
<sblessing> would certainly make debugging this easier
copy` has joined #ponylang
<TwoNotes> The actor in question is in speechin.pony
<TwoNotes> It then creates a Recognition class in recognizer.pony
<hakvroot> cool project btw TwoNotes :)
<TwoNotes> That then creates a class RuleSTore in grammar.pony
<TwoNotes> That is where the disk I/O happens, in two routines _loadTerms and _loadRules
<TwoNotes> Commenting out BOTH of those _load routines makes the segfault go away
<TwoNotes> Leaving EITHER ONE of them in, breaks it.
<TwoNotes> The two _load routines follow a similar pattern of how they read some disk files.
<SeanTAllen> TwoNotes: can you update the issue with the additional info? Thanks.
<TwoNotes> On startup it will try to connect to a program named "julius" which you will not have. But that is ok - you will still see the segfault
<TwoNotes> I will put that in the Issue. It will be a little while - breakfast time
<SeanTAllen> thanks TwoNotes
<shepheb> when writing an interface
<TwoNotes> Ok, info has been added to the Issue
<shepheb> can I constrain a parameter to be not any MyInterface, but the same one as "this"
<SeanTAllen> interface B
<SeanTAllen> A is B
<SeanTAllen> C is B
<SeanTAllen> Foo[B] but it has to an A because ... yeah that is where I get lose shepheb
<shepheb> I mean, I can write in the docs that implementations will error if you pass in a different implementation
<shepheb> but that's not very satisfying
<shepheb> (that's what I'm doing, though)
<shepheb> in practice, it's probably fine, since this is mostly internal and I'm writing all the code in question.
<SeanTAllen> I don't follow what it is you are trying to accomplish, got a gist?
<sblessing> same here ^^
<shepheb> ack, okay.
<shepheb> I want reset to be this->ParseBuffer, as in, if class A is ParseBuffer, reset(A) not reset(ParseBuffer)
<SeanTAllen> why?
<shepheb> because it needs to inspect internal bits
<shepheb> maybe this whole design is crap
<shepheb> I basically want to be able to save/restore some internal state in an opaque way
<shepheb> which is currently done with clone/reset.
<TwoNotes> There may be another way to accomplish what you want
<shepheb> I'm not thrilled about the whole scheme.
<shepheb> really I should just change the parsing tree to return a pair of a result and a new ParseBuffer.
<shepheb> on the other hand, then there's no way to fail-and-consume
<shepheb> maybe that isn't important.
<SeanTAllen> so would this type 'A' have methods that aren't on ParseBuffer ?
<SeanTAllen> I take it some types can be cloned/reset like this but not others?
<shepheb> yeah. I'm going to be writing code for them either way
<shepheb> I've rewritten to make this a non-issue now, anyways.
<shepheb> immutable state that gets copied as parsing proceeds is probably safer against bugs anyway.
aturley has joined #ponylang
jemc has joined #ponylang
aturley_ has joined #ponylang
amclain has joined #ponylang
aturley has quit [Ping timeout: 260 seconds]
<shepheb> I seem to have found a case that makes ponyc spin for a loooong time.
<shepheb> though, this is on a RasPi 2, so it's not exactly zippy.
<shepheb> aaand it died for want of memory I think
<shepheb> yep, slow and steady climb to using all the memory
<shepheb> I'm not sure what part of it caused the recursive(?) mess, I'm going to try binary-searching it
<shepheb> ah, dropping PThen fixes it. not sure what was going on there, but it's definitely busted. I can do without that for now, but it's still an interesting case that might reveal a compiler bug.
<TwoNotes> I always have a small HDD connected to my RPi, with swap space on it, if I am going to be doing compiling or soemthing
<shepheb> the 1GB RAM on the Pi 2 is sufficient for most things. and normally ponyc for this code takes 0.5s and dozens of megs
<shepheb> so something was weirdly wrong with the Gisted code.
<jemc> shepheb: you're probably hitting some infinite recursion in the compiler - any chance you can run under gdb and get a stack trace?
<shepheb> probably. stand by.
<shepheb> I suppose I need to have a debug config ponyc for this.
<shepheb> or you won't get a useful trace.
<shepheb> though, the OOM killer won't give me a useful error, I thought?
<shepheb> I suppose I can send SIGUSR1 or whatever signal it is that triggers a break in GDB
<jemc> you should be able to Ctrl+C in gdb
<shepheb> working on it
<shepheb> as I'm currently demonstrating, I have a lot more experience with Chrome's DevTools than with gdb.
<jemc> simplest thing you can do is 1) use Ctrl+C to halt the compilation sometime during the assumed inifinite recursion, then 2) use the `bt` command to print a backtrace
<shepheb> yep. I didn't say I had no experience with GDB. but not enough to remember that you can Ctrl-c in it to stop it.
<shepheb> still recompiling ponyc with debug.
<TwoNotes> A debug copy of ponyc is also useful to have around because in building it you also get a debug copy of libponyrt. Useful for getting more useful annotations on bt at runtime.
<shepheb> yeah
<shepheb> yep, infinite recursion. 1250 stack frames and counting...
<shepheb> I wonder if I can redirect bt to a file?
<jemc> shepheb: you probably don't need to gist the whole thing - just enough to show the recursion pattern
<TwoNotes> Only need one loop of the recursion
<shepheb> it changes a few hundred in, from my glance at it.
<shepheb> let me check again
<TwoNotes> run the compiler with bash redirection of outpur. ctrl-C after a while, then look in the file
<TwoNotes> after you do a bt
<TwoNotes> Not sure how GDB cooperates with redirection though
<TwoNotes> Or set your terminal scrollback real high temporarily.
<shepheb> you can "set logging on filename"
<shepheb> then bt 500 and gist that file; stand by
Praetonus has quit [Ping timeout: 244 seconds]
<shepheb> remote machine, this is a Chromebook. I need a gist CLI tool.
<shepheb> is Github down for anyone else?
<TwoNotes> yeah, me too. It was working a few mins ago
<TwoNotes> The world comes to a stop when github is down.
<shepheb> Github seems to be recovering.
<shepheb> yeah, they're in the awkward territory of being vital to a lot of people, and big enough to have loads of traffic, but not big enough to have hundreds of people building infrastructure and monitoring its performance moment by moment.
aturley_ has quit [Ping timeout: 244 seconds]
Praetonus has joined #ponylang
<shepheb> their uptime is decent, though.
<TwoNotes> I have not looked into gitlab. The project sharing at github is just too valuable.
<shepheb> it's just growing pains; they'll get there eventually.
<TwoNotes> It is surprising how many of these 'core services' do not have replicated data centers on multiple continents. Even the ones that rely on AWS or GoogleCompute do not take advantage of the multiple center features.
<shepheb> yeah. and my impression from the outside is that Github is a hand-rolled colo service in a bunch of places, and they run a lot of servers because many parts are slow Ruby code.
<shepheb> that is the payoff for the insane complexity of Google's infrastructure. so much to learn to use it properly, but it does handle this crap nicely.
<shepheb> it's just overkill when you're writing some small service with a few hundred global QPS
<shepheb> using a steam hammer to crack a nut and all that
aturley has joined #ponylang
<TwoNotes> There are also pieces you can use that are designed to handle this sort of thing. Like the Riak database. Ive been working on distributed applications for decades, and the things you have to think about are not covered in college programming class, and most programmers never run into them.
aturley has quit [Ping timeout: 276 seconds]
<shepheb> it's perversely opposite of my working world
<shepheb> which is mostly Javascript in browsers, where we would pay dearly for threads
<shepheb> since rule one of UI performance is "don't do any work on the main thread" and Javascript falls flat right out of the gate.
<shepheb> having concurrency problems would be a welcome evil!
<TwoNotes> When I did browser GUIs I used WebSockets and event-driven code. But I don't think that is widely accepted these days. Not all browsers support WebSockets.
<shepheb> that isn't the trouble
<shepheb> it's that I want to animate something or keep the UI responsive to the user
<shepheb> but then a JSON blob arrives from the server, and I drop 20 frames while it's parsing, because I can't do that in the background
<shepheb> all main thread all the time.
<TwoNotes> I recall debugging a race condition in a database distributed 2-phase commit. It was a very small timing window that was hard to recreate. I worked daytimes on it while a colleague in Australia worked while I was asleep. It was an important customer who needed the fix right away. Exhausting.
<TwoNotes> be careful what you wish for :)
<shepheb> :)
srenatus has quit [Quit: Connection closed for inactivity]
mcguire has joined #ponylang
<mcguire> Goofy question: how do you set the runtime shared library search path when compiling with ponyc?
<mcguire> Longer goofy question: I just tried "make test" for the first time, and the stdlib tests blew up because it couldn't find libpcre2-8; I'm on Ubuntu and have a weird libpcre3 package (I have no idea where that comes from). I built the most recent libpcre2 and used "ponyc -p <libdir>" to compile the tests, which then detonated at runtime. Using LD_RUN_PATH didn't work, either; I had to use LD_LIBRARY_PATH.
<shepheb> for building ponyc, LD_LIBRARY_PATH has worked for me.
<shepheb> once that's done, it's not needed to run ponyc
<shepheb> I think
<shepheb> \o/ my parser library has the basics compiling and working.
<shepheb> now to try to use it for something simple and see how far I get.
<TwoNotes> It seems to look for the library in the same directory where the compiler came from.
<SeanTAllen> mcguire: what happens at runtime when you use libpcre2?
<mcguire> Ok, if I modify the test rule in the Makefile to have: "@$(PONY_BUILD_DIR)/ponyc -d -s -p /home/mcguire/soft/pony/libpcre2/lib packages/stdlib" and then run make test, I get "./stdlib: error while loading shared libraries: libpcre2-8.so.0: cannot open shared object file: No such file or directory".
<mcguire> If I do "LD_LIBRARY_PATH=/home/mcguire/soft/pony/libpcre2/lib make test" then it runs happily.
aturley has joined #ponylang
<TwoNotes> ponyc -h tells how to do this on the command line, but does not mention LD_LIBRARY_PATH. I guess that is assumed to be common Linux knowledge
<mcguire> I would have thought LD_RUN_PATH (at compile time) would have told the linker to add the path to the executable's search list.
_andre has quit [Quit: leaving]
lispmeister has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
TwoNotes has quit [Quit: Leaving.]
pulpfiction has joined #ponylang
aturley has quit [Ping timeout: 244 seconds]
shepheb has quit [Ping timeout: 244 seconds]
trapped has quit [Read error: Connection reset by peer]
<doublec> I've done a pull request for linux build prerequisites https://github.com/ponylang/ponyc/pull/627
<doublec> Tested on a clean ubuntu 15.10 install