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 | Please consider participating in our mailing lists => https://pony.groups.io/g/pony
smandy has joined #ponylang
<smandy> HI all, Just trying to compile helloworld on arch. get "helloWorld.pony: couldn't locate this path"
<smandy> any ideas?
<smandy> cmd is ponyc helloWorld.pony, helloWOrld.pony is verbatim from the documentation.
<jemc> smandy: this a common trip-up for folks who are used to C compilers - Pony doesn't compile files, it compiles a directory
<jemc> so, when you do `ponyc helloWorld.pony`, it's looking for a subdirectory named `helloWorld.pony` in your current working directory
<jemc> what you probably want is to run `ponyc` without arguments to compile all files in the current directory, or something like `mkdir helloWorld && mv helloWorld.pony helloWorld/main.pony && ponyc helloWorld` if you want to put the file in its own subdirectory to isolate it from other examples you may want to have in your current working directory
<jemc> `ponyc --help` can give you info on additional options, like specifying where your output binary should go, if you care about that
amclain has quit [Quit: Leaving]
jemc has quit [Ping timeout: 240 seconds]
bimawa has joined #ponylang
endformationage has quit [Ping timeout: 268 seconds]
nyarum has joined #ponylang
nyarum has quit [Ping timeout: 240 seconds]
jemc has joined #ponylang
jemc has quit [Client Quit]
jemc has joined #ponylang
kajstrom_ has joined #ponylang
dom96_ has joined #ponylang
dom96 has quit [Ping timeout: 260 seconds]
kajstrom has quit [Ping timeout: 260 seconds]
CcxWrk has quit [Ping timeout: 260 seconds]
dom96_ is now known as dom96
CcxWrk has joined #ponylang
jemc has quit [Ping timeout: 260 seconds]
jemc has joined #ponylang
jemc has quit [Ping timeout: 255 seconds]
_whitelogger has joined #ponylang
nyarum has joined #ponylang
nyarum has quit [Ping timeout: 240 seconds]
vaninwagen has joined #ponylang
vaninwagen has quit [Ping timeout: 255 seconds]
papey_lap has joined #ponylang
smandy has quit [Ping timeout: 268 seconds]
CcxWrk has quit [*.net *.split]
CcxWrk has joined #ponylang
vaninwagen has joined #ponylang
vaninwagen has quit [Ping timeout: 240 seconds]
nyarum has joined #ponylang
nyarum has quit [Remote host closed the connection]
nyarum has joined #ponylang
nyarum has quit [Ping timeout: 276 seconds]
vaninwagen has joined #ponylang
vaninwagen has quit [Ping timeout: 260 seconds]
Praetonus has joined #ponylang
bimawa has quit [Read error: Connection reset by peer]
jemc has joined #ponylang
aav has joined #ponylang
<adam_> What is the correct way to turn a ByteSeq into a string? It seems I have to do a match like "match byte_seq | let s: String => s | let a: Array[U8 val] val => String.from_array(a) end"
<adam_> But that seems rather complicated for this
<Praetonus> adam_: That's the correct way. Whenever you need to downcast an object (i.e. go from a given type to a more specific subtype), you have to use a match expression
<jemc> adam_: there's not a better way currently, though it seems to me that adding `String.from_byte_seq` would be a nice addition
<jemc> though I suppose that's not as straightforward as it sounds - if it's a constructor it would be forced to allocate a *new* `String` object, which isn't what we want
<jemc> (and if it's not a constructor you'd be forced to allocate a new `String` just to be able to call the method)
<adam_> I see there is a Stringable interface, I would think the nicest way would be that both String and Array[U8] being Stringable, and that their union ByteSeq should be too by inference.
<jemc> adam_: unfortunately, we don't currently have a way to define a method for only some special cases of a generic type - so we couldn't define `Array[U8].string` without also defining it for `Array[F64]`, `Array[String]`, `Array[Foo]`, etc
<jemc> that feature is actualy on our roadmap, though even when we have it I'm not totally sure that would be the best meaning of the `string` method for `Array[U8]`
<jemc> I'd expect `Array[U8].string` to give output like: `[1; 2; 3]`, instead of converting the byte sequence to a string
<jemc> that is, I'd want to define `Array[A].string` for cases where `A <: Stringable` to print an array representation where each element is the displayed as its `string` representation
<adam_> I see, although I'd want to call that "show"
<adam_> Thanks, I just wanted to check whether I was missing something or not.
amclain has joined #ponylang
bimawa has joined #ponylang
joncfoo has joined #ponylang
<joncfoo> just curious - is there a particular reason why Env.vars() returns an array of strings instead of a map?
nyarum has joined #ponylang
nyarum has quit [Ping timeout: 240 seconds]
<SeanTAllen> joncfoo: i'm not aware of one. that's an interesting possible change. are you familiar with the RFC process? its perfect for getting that sort of change through.
<jemc> joncfoo, SeanTAllen: one issue with making it a `Map` is that `Map` is in the `collections` package - we don't want anything in `builtin` to depend on another package
<jemc> however, making it an `Array[(String, String)]` instead of `Array[(String)]` would likely be a good choice, and would be easily convertible to a `Map` in a simple line
<jemc> that is, you could get a `Map` out of it with a line like: `let map = Map[String, String].concat(env.vars().values())`
<jemc> joncfoo: however, if you're just looking for a turnkey solution right now, check out the `cli.EnvVars` type, which was added recently to the stdlib: https://github.com/ponylang/ponyc/blob/master/packages/cli/env_vars.pony
<jemc> it's a nice little utility (thanks, cquinn!) for converting the `env.vars()` to a `Map`, and also includes some other nifty optional features (see the docstring)
<joncfoo> thanks jemc, for now I simply hacked up the following: https://is.gd/LPMOCE
<joncfoo> I think perhaps changing Env.vars() to return Array[(String, String)] would be reasonable
<joncfoo> SeanTAllen: I'm not familiar with the RFC proceess but will have a look. Thanks!
<adam_> Elapsed time, 18 hours
<adam_> src/libponyc/pass/scope.c:19: set_scope: Assertion `ast_id(name) == TK_ID` failed.
endformationage has joined #ponylang
<adam_> Does this really happen that often?
<adam_> The following crashes the compiler
<adam_> use "itertools"
<adam_> actor Main new create(env: Env) => let plop = Filter[(F64 | None)](Array[(F64|None)].create().values(), {(x) => match x | (let f: F6 4) => true | (let n:None) => false end})
<adam_> oops, that has some extra spaces, should read:
<adam_> actor Main new create(env: Env) => let plop = Filter[(F64 | None)](Array[(F64|None)].create().values(), {(x) => match x | (let f: F64) => true | (let n:None) => false end})
<adam_> 0.14.0-f70dba0 [release] compiled with: llvm 3.9.1 -- cc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
<adam_> Shorter:
<adam_> actor Main new create(env: Env) => Filter[F64](Array[F64].create().values(), {(x) => match x end})
<endformationage> adam_: I'll defer debuging of your example to the experts, though it looks like a compiler bug to me. You may find http://playground.ponylang.org/ helpful for sharing code, it's great!
<Praetonus> Compiler assertion failures definitely are bugs
<Praetonus> adam_: Can you open a Github issue with the minimal case and the backtrace printed by the compiler on the assertion failure?
<joncfoo> Is there a collection of publicly available libraries for pony posted somewhere?
<adam_> Praetonus, done. Minimal example is indeed rather minimal
<Praetonus> Thank you
<SeanTAllen> @joncfoo not really. im planning on adding to the website. there's the wiki on ponyc repo but its not really up todate. you can also check the "pony language" label on github
<jemc> joncfoo: here's how to see all repos on github with that "topic" label: https://github.com/search?q=topic%3Apony-language&type=Repositories
<adam_> If I have an Array[(X | None)], what's a sensible way to get an Array[X] of non-none entries?
<jemc> adam_: the "simple" way would be something like `let array' = Array[X]; for x in array.values() do try array'.push(x as X) end end`
<adam_> Ok. I was trying to do this in a functional fashion, and couldn't work it out. That, though slightly yucky, seems the better approach
<jemc> if you want something more functional in style, you could probably put together something using the `itertools` package
<adam_> I can filter out those entries which are None, so I have an Array[(X|None)] where I know every entry is in-fact X. But how do I map (X|None) to X, swallowing those errors that I know will not occur. The compiler insisted I need a try block, which would then need a default value, which I would prefer not to have.
<jemc> adam_: you're talking about the `itertools` package now?
<jemc> yeah, looking through that API, it looks like it needs another API method, or a modification of the `filter` method that knows how to filter by type and produce an iterator of the refined type
<adam_> and it would have to do that by the iterative pushing back on an array?
<jemc> adam_: sorry, not sure what you're asking
<jemc> adam_: actually, a correction - I'm not very familiar with the itertools API, but there is actually already a way to do it
<jemc> `iter.map[X]({(x: (X | None)): X ? => x as X }` should do it
Matthias247 has joined #ponylang
_andre has quit [Quit: leaving]
mrallen1 has joined #ponylang
papey_lap has quit [Ping timeout: 255 seconds]
<adam_> At runtime, given some value of a union type, is there a way to print it's type without manually writing a case statement?
Matthias247_ has joined #ponylang
Matthias247 has quit [Ping timeout: 240 seconds]
Praetonus has quit [Quit: Leaving]
joncfoo has quit [Ping timeout: 246 seconds]
<SeanTAllen> adam_: nope
Matthias247_ has quit [Read error: Connection reset by peer]