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
montanonic has quit [Ping timeout: 245 seconds]
rurban has quit [Quit: Leaving.]
montanonic has joined #ponylang
mvzink has quit [Ping timeout: 244 seconds]
mvzink has joined #ponylang
mvzink has quit [Ping timeout: 260 seconds]
mvzink has joined #ponylang
mvzink has quit [Ping timeout: 252 seconds]
mvzink has joined #ponylang
mvzink has quit [Ping timeout: 245 seconds]
_andre has quit [Ping timeout: 245 seconds]
_andre has joined #ponylang
mvzink has joined #ponylang
mvzink has quit [Ping timeout: 260 seconds]
rurban has joined #ponylang
rurban has quit [Client Quit]
amclain has quit [Quit: Leaving]
mvzink has joined #ponylang
mvzink has quit [Ping timeout: 260 seconds]
mvzink has joined #ponylang
mvzink has quit [Ping timeout: 265 seconds]
jemc has quit [Ping timeout: 260 seconds]
mvzink has joined #ponylang
mvzink has quit [Ping timeout: 252 seconds]
mvzink has joined #ponylang
mvzink has quit [Ping timeout: 250 seconds]
montanonic has quit [Ping timeout: 260 seconds]
rurban has joined #ponylang
mvzink has joined #ponylang
mvzink has quit [Ping timeout: 250 seconds]
notwas has joined #ponylang
mvzink has joined #ponylang
mvzink has quit [Ping timeout: 245 seconds]
jmiven has quit [Ping timeout: 258 seconds]
mvzink has joined #ponylang
mvzink has quit [Ping timeout: 245 seconds]
jmiven has joined #ponylang
mvzink has joined #ponylang
mvzink has quit [Ping timeout: 260 seconds]
mvzink has joined #ponylang
mvzink has quit [Ping timeout: 245 seconds]
mvzink has joined #ponylang
mvzink has quit [Ping timeout: 245 seconds]
mvzink has joined #ponylang
mvzink has quit [Ping timeout: 244 seconds]
mvzink has joined #ponylang
mvzink has quit [Ping timeout: 245 seconds]
rurban1 has joined #ponylang
montanonic has joined #ponylang
rurban has quit [Ping timeout: 245 seconds]
<notwas> hello?
mvzink has joined #ponylang
mvzink has quit [Ping timeout: 250 seconds]
rurban has joined #ponylang
rurban has quit [Client Quit]
rurban1 has quit [Ping timeout: 252 seconds]
mvzink has joined #ponylang
mvzink has quit [Ping timeout: 260 seconds]
mvzink has joined #ponylang
mvzink has quit [Ping timeout: 256 seconds]
mvzink has joined #ponylang
<SeanTAllen> hello
mvzink has quit [Ping timeout: 244 seconds]
Praetonus has joined #ponylang
mrkishi has joined #ponylang
mvzink has joined #ponylang
mvzink has quit [Ping timeout: 260 seconds]
montanonic has quit [Ping timeout: 245 seconds]
mvzink has joined #ponylang
mvzink has quit [Ping timeout: 250 seconds]
<notwas> hi
<notwas> why is it necessary to define the type here? let array: Array[String] = source.split("\r\n")
mvzink has joined #ponylang
dinfuehr has quit [Ping timeout: 245 seconds]
dinfuehr has joined #ponylang
mvzink has quit [Ping timeout: 250 seconds]
mcguire has quit [Ping timeout: 250 seconds]
mcguire has joined #ponylang
mvzink has joined #ponylang
mvzink has quit [Ping timeout: 265 seconds]
<SeanTAllen> is the question, why doesn't it infer the type notwas ?
<SeanTAllen> because it can. so i'm not sure what you mean. For example:
<malthe> SeanTAllen: this finally seems to be not failing: https://github.com/ponylang/ponyc/pull/1320
<malthe> changelogs should have a .d-directory to avoid conflicting..
<notwas> @SeanTAllen: hmm, I cannot rcreate my problem I had with the missing type inference. sorry and thanks.
<notwas> But I have another question. This problem is trivial, but I cannot get it to work: to "explode" a string. source.split("") doesn't work. Neither Regex(".").split(source).
mvzink has joined #ponylang
<malthe> notwas: what do you mean it doesn't work? you get an error?
mvzink has quit [Ping timeout: 260 seconds]
<notwas> no, but it doesn't split a string in its chars
titi has joined #ponylang
<malthe> notwas: code snippet?
<notwas> let chars : Array[String] = "All I want is a Pony".split("")
<notwas> env.out.print(chars.size().string())
<malthe> notwas: just use split() with no arguments
<malthe> or pass " " as an argument.
<malthe> (you were passing an empty string which makes no sense.)
<notwas> malthe: your solution gives me the single words, but I'd like to have the single characters. Thanks for your help anyway.
<malthe> let s = "All I want is a Pony"
<malthe> let chars: Array[U8] = chars.create(s.size()).append(s)
<malthe> env.out.print(chars.size().string())
<malthe> I think your example actually shows a bug in the implementation because what else should "" do than what you propose.
<notwas> that would actually make me proud :-)
FrozenFox is now known as DarkFox
<notwas> malthe: your solution gives me an internal failure. Probably because of .. = chars.create..
mvzink has joined #ponylang
<Praetonus> notwas: I don't get the internal failure on that example. What version of ponyc are you using?
jemc has joined #ponylang
<notwas> Praetonus: sorry, I forgot the type declaration
emilbayes has quit [Ping timeout: 258 seconds]
mvzink has quit [Ping timeout: 256 seconds]
<Praetonus> Ah, it does fail without the explicit type. It should check that a variable isn't used in its own initialisation
emilbayes has joined #ponylang
titi has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
<notwas> Praetonus: this might be a stupid question. But why does Array.create(...) doesn't work here?
titi has joined #ponylang
mvzink has joined #ponylang
<Praetonus> Because in `let chars = chars.create`, you're trying to infer the type of `chars` from an expression depending on the type of `chars`. It's a circular dependency
SeanTAllen has quit [Ping timeout: 250 seconds]
<notwas> Praetonus: I don't think we talk exactly about the same. I've meant literally Array.create().
<notwas> But I now see that Array[U8].create() seems to work, yes?
<Praetonus> notwas: Oh, sorry. Array is a generic type, which means it isn't a concrete type on its own. You have to supply a generic parameter, which will give you a reified Array type that can be instantiated
<notwas> Another question: how can I go back from U8 to its string representation
SeanTAllen has joined #ponylang
<notwas> and I have a question to the meaning of this expression (s is a String): let chars = Array[U8].create(s.size()).append(s)
titi has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
<notwas> does this mean that the String 's' is a Sequence?
<malthe> notwas: yes, it's a `ReadSeq`.
mrkishi has quit [Ping timeout: 265 seconds]
<notwas> malthe: cool! thanks.
amclain has joined #ponylang
graaff has joined #ponylang
graaff has quit [Quit: Leaving]
DarkFox is now known as FrozenFox
Candle has quit [*.net *.split]
Xe has quit [*.net *.split]
kushalp has quit [*.net *.split]
jtfmumm has quit [*.net *.split]
ericbmerritt_ has quit [*.net *.split]
jonrh has quit [*.net *.split]
CcxWrk has quit [*.net *.split]
doublec has quit [*.net *.split]
BweeZ has quit [*.net *.split]
Candle has joined #ponylang
BweeZ has joined #ponylang
CcxWrk has joined #ponylang
bbhoss has quit [Ping timeout: 250 seconds]
Xe has joined #ponylang
jonrh has joined #ponylang
ericbmerritt_ has joined #ponylang
jtfmumm_ has joined #ponylang
bbhoss has joined #ponylang
kushalp_ has joined #ponylang
Matthias247 has joined #ponylang
Chris___ has joined #ponylang
<Chris___> Hello?
<SeanTAllen> hello
<Chris___> Is this the right area to get help on installing Pony?
Chris___ has quit [Quit: Page closed]
<jemc> Chris___: yes, and welcome
<notwas> hello (again), I still have a question: how can I get the string representaion of a char that is represented by an U8?
<notwas> I couldn't find a solution in the docs.
<notwas> hello?
<notwas> I figured something. Please tell me this isn't true: env.out.print(String.from_utf32(mychar.u32()).string())
<SeanTAllen> what are you trying to do?
<SeanTAllen> you have a u8 and you want to get the ascii character that corresponds to that value?
<notwas> correct
<SeanTAllen> well, pony strings are assumed to be utf8
<SeanTAllen> taking a step back, what are you trying to do?
<SeanTAllen> i might be a little slow in answering. i'm at work and well, working.
<notwas> maybe the term is tokenization: take a string, cut the string in pieces (this was also complicated to do), then working with the single characters
<SeanTAllen> and you are doing this for?
<SeanTAllen> if you are working with this as a String
<SeanTAllen> then runes() and values() will get you iterators over codepoints and bytes respectively
<SeanTAllen> if you are tokenizing and then i assume you aren't getting individual characters but larger characters which can be a ByteSeq or a String
<notwas> interesting, is it correct that runes() and values() give the same result?
<malthe> no, runes give codepoint strings back.
<malthe> err codepoints (u32)
<malthe> values() gives back u8's. both as iterators.
<notwas> ah yes I see StringRunes and StringBytes
<notwas> that means with runes() I can get the string representation a little shorter with: env.out.print(String.from_utf32(ii).string())
<malthe> SeanTAllen: should String.split actually work in a zero-copy fashion instead of building new strings?
Matthias247 has quit [Quit: Matthias247]
<jemc> malthe: probably
<malthe> because you could always just copy it first, if you wanted it isolated.
Matthias247 has joined #ponylang
<jemc> however that would only work for `String val`, not for `String box`
<jemc> so it may need to be a separate method
<malthe> I think val is fine.
<malthe> like you'll just copy it to a val and then split.
<malthe> s.clone().split() should just work if the compiler is able to auto-recover it.
<notwas> while I'm still working with my splitted string I run in to a next problem: How do I compare a single StringRune?
<malthe> notwas: you mean compare two u32's?
<notwas> As I loop over the runes() iterator, I'd like to something like: if i == "h".u32() then ... But this gives me a "body can raise an error" error
Matthias247 has quit [Ping timeout: 250 seconds]
<SeanTAllen> you need to handle the error
<SeanTAllen> try ... else ... end
<notwas> I wrap the 'if' conditional into a try...end statement, but then every conditional fails
<jemc> notwas: you should give us a more complete code example of what you're trying to compile - from the description you've given it's not very clear so far
<jemc> http://gist.github.com/ is a good way to share code snippets
FrozenFox has quit [Ping timeout: 252 seconds]
<notwas> jemc: thanks for the link, I'm go and set this up.
<jemc> notwas: if you don't already have a github account, and don't want to sign up for one, there are other alternatives for no-login one-off snippets like http://hastebin.com/
<notwas> #quit
DarkFox has joined #ponylang
<notwas> ok here is the snippet: http://hastebin.com/otogocifus.lua
DarkFox is now known as Guest64682
mrkishi has joined #ponylang
<notwas> And to describe what I want to do, without taking care of the underlying concepts: 1. Split a text in its single characters 2. loop over this characters 3. Compare every character against a set of other characters
<jemc> I don't think I see anything that could raise an unhandled error there - maybe the error is pointing to a part of your code that you did not paste?
<SeanTAllen> you have a syntax error
<SeanTAllen> its if condition then
<SeanTAllen> you are missing the `then`
<jemc> regarding your `"h".u32()`, I think you will want to use single-quotes for that `h` instead of double-quotes - that will give you a number literal instead of a string literal
<notwas> yes sorry
<SeanTAllen> i'd also go ahead and get the value you are looking for once before the loop then compare to that
<SeanTAllen> faster
<SeanTAllen> rather than getting the u32() value each time through the loop
<SeanTAllen> although the compiler will probably take care of that from you
<notwas> first make it work, than make it fast :-) (you absolutely right)
<notwas> here is the corrected snippet: http://hastebin.com/vizakitomo.lua
<SeanTAllen> so does that compile?
mrkishi has quit [Remote host closed the connection]
<notwas> no, and when I use single quotes (jemc) I get an "cannot look up memberu32 on a literal" error
Guest64682 has quit [Ping timeout: 250 seconds]
<jemc> notwas: sorry, try `U32('h')` instead
FrozenFox has joined #ponylang
FrozenFox is now known as Guest70379
<SeanTAllen> can you include the compile error you are getting in your gist?
<notwas> jemc: U32('h') works, thanks, I've tried U32("h") with double quote and this always failed with 'String val is not a subtype ...' error
<mollymorphic> notwas: do you mind if I ask what larger problem you are solving? just to satisfy my own curiousity
<jemc> notwas: right, double quotes is a string literal, and single quotes is a number literal that corresponds to the given character code
_andre has quit [Quit: leaving]
<notwas> mollymorphic: I've tried to explained it a few times, so I hope you dont mind if I copy/paste from above: And to describe what I want to do, without taking care of the underlying concepts: 1. Split a text in its single characters 2. loop over this characters 3. Compare every character against a set of other characters
<notwas> jemc: you mean single quote is a character literal?
<mollymorphic> notwas: right, but I mean is that literally all your want your program to do, or is that part of solving a larger problem?
<notwas> are character literals described in the documentation?
<jemc> notwas: well the character is resolved to a number at parse time, and treated as a number literal from that point on - so writing `U32('h')` works exactly the same as if you had written `U32(104)` or `U32(0x68)` - all different ways of expressing the same number, and once it gets past the parser, the compiler and the program don't know the difference
<mollymorphic> notwas: or in other words, *why* do you want to split a text into single characters, loop over them, and compre them to a set of other characters - if you don't mind me asking :3
<jemc> notwas: it's not in the tutorial at the moment - there's an open issue ticket for somebody to take the time to add it - https://github.com/ponylang/pony-tutorial/issues/102
<notwas> mollymorphic: The reason I try this is because I'd like to learn Pony. After multiple failed attemps to understand how the capabilities system work, I thougth that maybe I should start to first learn the basic stuff.
Matthias247 has joined #ponylang
<SeanTAllen> notwas: i'd suggest starting somewhere other than strings. the string api needs lots of love.
<notwas> mollymorphic: and to explain why I want to learn Pony so much that I annoy all this nice people here. I work with very simple programming languages that work as long as you dont work with multiple threads or god forbid multiple cores.
<notwas> SeanTAllen: but I need and really love strings. Is there something I can help with ?
<mollymorphic> notwas: thanks, though that was more abstract than I was looking for
<mollymorphic> notwas: I just mean, this feels like one small step in a longer process, I was curious what that was
<mollymorphic> I didn't know if you are working through say, the exercises in a particular comp sci book or website
<SeanTAllen> notwas: it involves a reasonably deep understanding of pony to rework the Strings api
<mollymorphic> or translating a particular command line utility to pony, or what
<mollymorphic> like, the other characters - where do they come from and why are you comparing them?
<mollymorphic> I'm just asking out of idle curiousity
<notwas> btw. I think Erlang was always criticized to be not good with strings ...
<notwas> mollymorphic: the reference characters can come from me. For example if I'd like count/react/transform/... (on) a particular character.
<malthe> I'm trying to develop an RFC based on https://github.com/ponylang/ponyc/issues/1088. I kind of want to suggest that a String should be type-aliased to Array[U8].
doublec has joined #ponylang
<malthe> If you then want to interpret as e.g. UTF8, then you wrap it in an UTF-8 character view (as per the Swift API).
<malthe> although this does require that an array's entries can be compared for equality.
<mollymorphic> notwas: sure, makes sense - in terms of reacting/transforming did you have particular transformations in min?
<mollymorphic> ^min^mind
<notwas> malthe: do you think it would be possible to let the string api stay in its corrent form but build an additional 'Unicode' api for all the (streambased) enc/decoding?
<notwas> mollymorphic: nothing yet. I'm not at this point yet
<mollymorphic> notwas: oki so you just came up with an exercise yourself to do a char comparison
<notwas> mollymorphic: yes that's it. And you, why are you interested in Pony?
<SeanTAllen> you arent allowed to be my friend unless you are interested in Pony and mollymorphic is my friend therefore....
<mollymorphic> ya, actually that p much is it - I saw SeanTAllen tweeting about it, and I read the docs and my interest was piqued
<mollymorphic> In particular there was a list of design goals that really resonated with me
<mollymorphic> I mean, to begin I appreciate it when a language HAS a coherent and articulated set of philosophies/goals/etc, coz not all of them do
<mollymorphic> but it's especially nice when they're v much in agreement with your own thinking
<malthe> notwas: I think the Swift API is pretty convincing, but actually it does have a separate string class that gives some additional convenience over an Array[U8] such as easy access to a UTF-8 character view.
<malthe> but I think in Pony, `String` could just embed `Array[U8]` and thereby extend it with string-specific functionality such as ``String.cstring()``.
<notwas> malthe: I'm not familiar with this stuff and I'm tired and sick so this might be pure BS, but if you had something like an 'Unicode' class you could make an 'Unicode' interface and then make other functions in you api explicitely utf8 aware.
<malthe> notwas: unfortunately, there are very good reasons to design it as views on top of an Array[U8].
<notwas> mollymorphic: you're right. I think what brought me back to Pony after I gave up on it was the youtube video where Silvan talks about Ponys concepts. I never met a language where they begun with the hardest problems, because normaly a language evolves gradually.
<mollymorphic> ya, though you can end up with a language with sort of the opposite problem - it addresses the concerns that inspired it well but falls flat with other problems
<mollymorphic> and you can have problems where you are v opinionated on certain things, that much later realize taking that stances causes problems elsewhere
<mollymorphic> so you have to decide whether to do a bunch of work to go back and change things or just ofer workarounds or accept it as a tradeoff
<mollymorphic> I dunno, "growing" languages is a werid thing...it's like a years long plate spinning act where everyone just yells at you every time one starts to wobble
<notwas> malthe: thanks for the link, does it make sense if I discuss this here with you. I don't want to waste anybodys time.
notwas has quit [Ping timeout: 260 seconds]
notwas has joined #ponylang
M-Ingo has quit [Ping timeout: 256 seconds]
srenatus[m] has quit [Ping timeout: 256 seconds]
irx[m] has quit [Ping timeout: 256 seconds]
<malthe> notwas: you can also post it to the user group.
M-hrjet has quit [Ping timeout: 256 seconds]
M-Ingo has joined #ponylang
irx[m] has joined #ponylang
srenatus[m] has joined #ponylang
M-hrjet has joined #ponylang
<malthe> the idiomatic thing to do is probably to say `match ii | U32('h') => env.out.print("fff") etc.`
montanonic has joined #ponylang
prettyvanilla has joined #ponylang
Matthias247 has quit [Read error: Connection reset by peer]