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
mvzink has quit [Quit: A merry Christmas to all, and to all a good night!]
polypus74 has joined #ponylang
<polypus74> was trying: 'type X is Y if windows' as with use declarations, but get syntax error. is there some way to do this?
<polypus74> also, what's the story with unicode in pony? String's doc says that String does not specify an encodeing, however there are comments to the effect that utf8 needs to be supported for certain methods. also env.out.print seems to handle utf8 strings. any documentation to read?
<jemc> polypus74: regarding string encodings, unfortunately it's a bit scatterbrained at the moment - some of the methods work in terms of bytes and others work in terms of unicode codepoints (and assume a UTF-8 encoding)
<jemc> not sure who wrote the doc line "Strings don't specify an encoding", but this is wrong or at least misleading - methods that work in terms of codepoints assume a UTF-8 encoding
<jemc> there are plans to make strings encoding-aware, so that the encoding can be made an explicit part of the string (perhaps that's what the doc author meant by "specify an encoding")
<jemc> regarding your other question `type X is Y if windows` - I don't think this is possible at the moment - all of your types must compile for all platforms
<jemc> you can use `ifdef windows then /* ... */ end` within a method body, but I don't think it works at the toplevel scope of a source file
<jemc> see `packages/process/process_monitor.pony` for more examples of platform-specific code in method bodies
<polypus74> ok ty. yeah i'm dealing with wchar_t which is U16 on windows and U32 on nix. has there been consideration of having differently typed strings for different encodings?
<polypus74> i'm trying to pass in a c string to an ffi call which needs to write to the string. i'm doing
<polypus74> let s = String(max_len)
<polypus74> @wcstombs(s.cstring(), wchars, max_len)
<polypus74> but i'm segfaulting. what is the proper procedure to pass a *char to an ffi call which will write to the passed pointer?
<SeanTAllen> you need to call null_terminated() on it before passing to the ffi call polypus74
<SeanTAllen> that will make a new copy of the string with a null terminator
<polypus74> but wcstombs takes a size argument. and does not check for null termination
<polypus74> well it probably does on the second argument 'wchars' but that is a pointer into C-land in my code.
<SeanTAllen> ¯\_(ツ)_/¯
<polypus74> so what i'm doing, should theoretically be ok?
<SeanTAllen> o i see you want it to fill out the String... well that, that i'm not sure at all
<SeanTAllen> ive never done that
<polypus74> yes
<polypus74> i guess the main question is whether String(n) allocates n bytes and whether cstring() returns a pointer to it
<polypus74> which is safe to write to in c-land
<SeanTAllen> it seems weird to create a string to get the pointer to pass to a c function
<SeanTAllen> rather than just allocing using a Pointer[U8]
<SeanTAllen> like: _ptr = Pointer[U8]._alloc(_alloc)
<polypus74> SeanTAllen: yes, when you know you can do that with a pointer, it's weird :) i'll try that
<doublec> isn't _alloc private?
<polypus74> yeah. it is
<doublec> polypus74: you should be able to create a String ref and pass the cstring() to your api to be filled
<doublec> polypus74: are you passing the correct length?
<polypus74> yes passing in same length as in string ctor
<doublec> you'll need to null_terminatd() your 'wchars'.
<doublec> But not your 's'.
<polypus74> the wchars is a Pointer[U32] which came from c-land. i did not allocte it. it should already be null terminated.
<doublec> ok
<polypus74> this is my ffi declaration:
<polypus74> use @wcstombs[USize](dest: Pointer[U8] tag, src: Pointer[WChar] tag, n: USize)
<polypus74> the c prototype:
<polypus74> size_t wcstombs(char *dest, const wchar_t *src, size_t n);
<doublec> Why 'tag'?
<doublec> I'd get rid of the rcap
<doublec> Not that that would be the cause of the error, just noting it
<polypus74> just because String#cstring returns Pointer[U8 val] tag. but yeah C shouldn't care either way right?
<doublec> Oh I didn't realise it did
<doublec> I guess tag is fine then
<doublec> Is "foobar" null terminated in pony?
<doublec> ie. a string literal
<polypus74> i don't think so hence String#null_terminated
<doublec> polypus74: this works for me http://pastebin.com/srNratyR
<doublec> (The WChar > U8 change shouldn't matter, I just needed a quick way to test)
<polypus74> ok thanks guys. i'm keeling over. will have to have a look again in the morning. if anybody thinks of anything, i check the logs.
<doublec> np
polypus74 has quit [Remote host closed the connection]
jonrh has quit [Ping timeout: 248 seconds]
amclain_ has joined #ponylang
unbalanced has joined #ponylang
NhanH has quit [Ping timeout: 272 seconds]
hakvroot has quit [Read error: Connection reset by peer]
bodie_ has quit [Ping timeout: 244 seconds]
sjums_ has joined #ponylang
unbalancedparen has quit [Read error: Connection reset by peer]
jemc has quit [Ping timeout: 240 seconds]
SeanTAllen has quit [Ping timeout: 255 seconds]
jmiven has quit [Ping timeout: 240 seconds]
jmiven has joined #ponylang
mankyKitty has quit [Ping timeout: 272 seconds]
shepheb has quit [Ping timeout: 240 seconds]
jemc_ has joined #ponylang
srenatus[m] has quit [Ping timeout: 264 seconds]
shepheb has joined #ponylang
lisael has quit [Ping timeout: 260 seconds]
graaff has joined #ponylang
amclain has quit [Ping timeout: 278 seconds]
Corwin has quit [Ping timeout: 265 seconds]
hakvroot has joined #ponylang
emilbayes has quit [Ping timeout: 250 seconds]
bodie_ has joined #ponylang
bbhoss has quit [Ping timeout: 248 seconds]
dinfuehr has quit [Ping timeout: 240 seconds]
pyon has quit [Ping timeout: 248 seconds]
strmpnk has quit [Ping timeout: 248 seconds]
shepheb has quit [Ping timeout: 240 seconds]
kajstrom_ has quit [Ping timeout: 240 seconds]
kajstrom has joined #ponylang
shepheb has joined #ponylang
k0nsl has quit [Ping timeout: 248 seconds]
sjums has quit [*.net *.split]
adamkittelson has quit [*.net *.split]
bodie_ has quit [Ping timeout: 264 seconds]
omarkj has quit [Ping timeout: 250 seconds]
sjums has joined #ponylang
jemc_ has quit [Ping timeout: 240 seconds]
bodie__ has joined #ponylang
sylvanc_ has joined #ponylang
prettyvanilla_ has joined #ponylang
bodie__ is now known as bodie_
hakvroot has quit [Read error: Connection reset by peer]
dinfuehr has joined #ponylang
sjums_ has quit [Read error: Connection reset by peer]
prettyvanilla has quit [Remote host closed the connection]
sylvanc has quit [Ping timeout: 255 seconds]
jemc has joined #ponylang
M-hrjet has quit [Ping timeout: 272 seconds]
adamkittelson has joined #ponylang
hakvroot has joined #ponylang
lisael has joined #ponylang
Corwin has joined #ponylang
jonrh has joined #ponylang
mankyKitty has joined #ponylang
c355e3b has quit [Quit: Connection closed for inactivity]
NhanH has joined #ponylang
bbhoss has joined #ponylang
strmpnk has joined #ponylang
SeanTAllen has joined #ponylang
emilbayes has joined #ponylang
jonrh has quit [Ping timeout: 250 seconds]
prettyvanilla has joined #ponylang
prettyvanilla_ has quit [Read error: Connection reset by peer]
dinfuehr has quit [Ping timeout: 272 seconds]
adamkittelson has quit [Ping timeout: 272 seconds]
dinfuehr has joined #ponylang
NhanH has quit [Ping timeout: 255 seconds]
bbhoss has quit [Ping timeout: 250 seconds]
jonrh has joined #ponylang
adamkittelson has joined #ponylang
NhanH has joined #ponylang
bbhoss has joined #ponylang
amclain_ has quit [Quit: Leaving]
k0nsl has joined #ponylang
jemc has quit [Ping timeout: 244 seconds]
pyon has joined #ponylang
srenatus[m] has joined #ponylang
shelajev has joined #ponylang
shelajev has quit [Client Quit]
omarkj has joined #ponylang
omarkj has joined #ponylang
omarkj has quit [Changing host]
M-hrjet has joined #ponylang
dinfuehr has quit [Ping timeout: 272 seconds]
dinfuehr has joined #ponylang
k0nsl has quit [Ping timeout: 255 seconds]
k0nsl has joined #ponylang
montanonic has joined #ponylang
k0nsl has quit [Ping timeout: 265 seconds]
k0nsl has joined #ponylang
TonyLo has joined #ponylang
montanonic has quit [Ping timeout: 250 seconds]
c355e3b has joined #ponylang
mitnk has joined #ponylang
TwoNotes has joined #ponylang
<TwoNotes> How to use 'match' to decrement a (USize | None) only if it is a USize?
mitnk has quit []
<SeanTAllen> something like this...
<SeanTAllen> but i havent compiled that
<TwoNotes> that seems to work
<TwoNotes> I notice that 'match' insists on there being an else clause even if all possible matches have been explicitly stated.
<TwoNotes> If the value of the match is required
<SeanTAllen> yes
<SeanTAllen> i should have put that
<TwoNotes> I did not mean in response to my first question.
<TwoNotes> I have a fun thet returns Bool.
<TwoNotes> I have a vraiable that is (None | USize)
<TwoNotes> match x | let n: USize => (n > 0) | None => fun_that_returns_Bool() end
<TwoNotes> ponyc invents an "else None"
polypus74 has joined #ponylang
pyon has quit [Quit: We've run out of supplies and stuff. Let's go shopping.]
Praetonus has joined #ponylang
pyon has joined #ponylang
graaff has quit [Quit: Leaving]
TwoNotes has quit [Quit: Leaving.]
atk has quit [Ping timeout: 265 seconds]
atk has joined #ponylang
nitbix has joined #ponylang
<nitbix> hello
_whitelogger_ has joined #ponylang
jmiven has quit [Ping timeout: 240 seconds]
M-Ingo has quit [Ping timeout: 240 seconds]
bbhoss has quit [*.net *.split]
adamkittelson has quit [*.net *.split]
malthe has quit [*.net *.split]
srenatus[m] has quit [*.net *.split]
NhanH has quit [*.net *.split]
jonrh has quit [*.net *.split]
emilbayes has quit [*.net *.split]
strmpnk has quit [*.net *.split]
mankyKitty has quit [*.net *.split]
gornikm has quit [*.net *.split]
_whitelogger has quit [*.net *.split]
TonyLo has quit [Ping timeout: 255 seconds]
sjums has quit [Ping timeout: 272 seconds]
irx[m] has quit [Ping timeout: 313 seconds]
shepheb has quit [Ping timeout: 272 seconds]
otremblay has quit [Ping timeout: 272 seconds]
pyon has quit [Ping timeout: 272 seconds]
lisael has quit [*.net *.split]
sylvanc_ has quit [*.net *.split]
kajstrom has quit [*.net *.split]
polypus74 has quit [Ping timeout: 620 seconds]
adamkittelson_ is now known as adamkittelson
sjums has joined #ponylang
unbalancedparen has joined #ponylang
Praetonus_ has joined #ponylang
mcguire has joined #ponylang
Praetonus_ has quit [Client Quit]
dinfuehr has joined #ponylang
Praetonus has quit [Ping timeout: 356 seconds]
SeanTAllen has quit [Ping timeout: 418 seconds]
sylvanc has joined #ponylang
shepheb has joined #ponylang
CcxCZ has joined #ponylang
NhanH_ has quit [Ping timeout: 252 seconds]
emilbayes has joined #ponylang
otremblay has joined #ponylang
malthe has joined #ponylang
jmiven has joined #ponylang
prettyvanilla has quit [Remote host closed the connection]
TonyLo has joined #ponylang
prettyvanilla has joined #ponylang
kajstrom has joined #ponylang
lisael has joined #ponylang
jonrh_ is now known as jonrh
M-hrjet has joined #ponylang
nitbix has joined #ponylang
otremblay has quit [Ping timeout: 265 seconds]
darach has quit [Ping timeout: 250 seconds]
sylvanc has quit [Ping timeout: 265 seconds]
otremblay has joined #ponylang
ericbmerritt has quit [Ping timeout: 250 seconds]
jmiven_ has joined #ponylang
malthe has quit [Ping timeout: 265 seconds]
atk has quit [Ping timeout: 240 seconds]
prettyvanilla_ has joined #ponylang
atk has joined #ponylang
jtfmumm has quit [Ping timeout: 250 seconds]
sjums_ has joined #ponylang
unbalanced has joined #ponylang
jeremyheiler has quit [Ping timeout: 250 seconds]
c355e3b has quit [Ping timeout: 250 seconds]
kajstrom has quit [Ping timeout: 255 seconds]
CcxCZ has quit [Ping timeout: 272 seconds]
emilbayes has quit [Ping timeout: 272 seconds]
shepheb has quit [Ping timeout: 272 seconds]
sjums has quit [Ping timeout: 272 seconds]
M-hrjet has quit [*.net *.split]
lisael has quit [*.net *.split]
prettyvanilla has quit [*.net *.split]
k0nsl has quit [*.net *.split]
dom96 has quit [*.net *.split]
Candle has quit [*.net *.split]
lisael_ has joined #ponylang
unbalancedparen has quit [Ping timeout: 264 seconds]
jmiven has quit [*.net *.split]
pyon has joined #ponylang
CcxCZ has joined #ponylang
k0nsl has joined #ponylang
k0nsl has quit [Changing host]
k0nsl has joined #ponylang
gornikm has joined #ponylang
kajstrom has joined #ponylang
malthe has joined #ponylang
sylvanc has joined #ponylang
strmpnk has joined #ponylang
shepheb has joined #ponylang
mankyKitty has joined #ponylang
Candle has joined #ponylang
dom96 has joined #ponylang
darach has joined #ponylang
SeanTAllen has joined #ponylang
jtfmumm has joined #ponylang
NhanH_ has joined #ponylang
ericbmerritt has joined #ponylang
c355e3b has joined #ponylang
bbhoss has joined #ponylang
jeremyheiler has joined #ponylang
emilbayes has joined #ponylang
TonyLo_afk has joined #ponylang
TonyLo has quit [Ping timeout: 276 seconds]
prettyvanilla has joined #ponylang
Candle has quit [Ping timeout: 276 seconds]
malthe has quit [Ping timeout: 276 seconds]
kajstrom has quit [Ping timeout: 276 seconds]
sjums_ has quit [Ping timeout: 276 seconds]
jmiven_ has quit [Ping timeout: 276 seconds]
kajstrom has joined #ponylang
prettyvanilla_ has quit [Ping timeout: 276 seconds]
hakvroot has quit [Ping timeout: 276 seconds]
so has quit [Ping timeout: 276 seconds]
sjums has joined #ponylang
malthe has joined #ponylang
hakvroot has joined #ponylang
jmiven has joined #ponylang
so has joined #ponylang
sjums has quit [Ping timeout: 265 seconds]
dom96 has quit [Ping timeout: 265 seconds]
hakvroot has quit [Ping timeout: 265 seconds]
malthe has quit [Ping timeout: 265 seconds]
sjums has joined #ponylang
mcguire has quit [Ping timeout: 250 seconds]
hakvroot has joined #ponylang
malthe has joined #ponylang
pyon has quit [Ping timeout: 250 seconds]
sylvanc_ has joined #ponylang
TonyLo has joined #ponylang
prettyvanilla_ has joined #ponylang
malthe_ has joined #ponylang
TonyLo_afk has quit [Ping timeout: 272 seconds]
c355e3b has quit [Ping timeout: 272 seconds]
emilbayes has quit [Ping timeout: 272 seconds]
jeremyheiler has quit [Ping timeout: 272 seconds]
sjums has quit [Ping timeout: 272 seconds]
kajstrom has quit [Ping timeout: 272 seconds]
mankyKitty has quit [Ping timeout: 272 seconds]
shepheb has quit [Ping timeout: 272 seconds]
sylvanc has quit [Ping timeout: 272 seconds]
CcxCZ has quit [Ping timeout: 272 seconds]
lisael_ has quit [Ping timeout: 272 seconds]
malthe has quit [Ping timeout: 272 seconds]
hakvroot has quit [Ping timeout: 272 seconds]
prettyvanilla has quit [Ping timeout: 272 seconds]
gornikm has quit [Ping timeout: 272 seconds]
hakvroot has joined #ponylang
Candle has joined #ponylang
sjums has joined #ponylang
NhanH_ has quit [Ping timeout: 265 seconds]
bbhoss has quit [Ping timeout: 265 seconds]
atk has quit [Ping timeout: 250 seconds]
hakvroot has quit [Ping timeout: 250 seconds]
kushalp has quit [Ping timeout: 250 seconds]
hakvroot has joined #ponylang
cquinn has quit [Ping timeout: 250 seconds]
<TonyLo> Hi, is there a way to read/write from/to a serial port in Pony or do I need to use C?
lisael has joined #ponylang
k0nsl has quit [*.net *.split]
atk has joined #ponylang
montanonic has joined #ponylang
shepheb has joined #ponylang
k0nsl has joined #ponylang
CcxCZ has joined #ponylang
kajstrom has joined #ponylang
mankyKitty has joined #ponylang
TonyLo has quit [Ping timeout: 265 seconds]
jeremyheiler has joined #ponylang
prettyvanilla has joined #ponylang
lisael_ has joined #ponylang
malthe_ has quit [Ping timeout: 265 seconds]
prettyvanilla_ has quit [Ping timeout: 265 seconds]
TonyLo has joined #ponylang
gornikm has joined #ponylang
TonyLo has quit []
atk has quit [Ping timeout: 272 seconds]
lisael has quit [Ping timeout: 272 seconds]
jmiven has quit [*.net *.split]
k0nsl has quit [Ping timeout: 248 seconds]
atk has joined #ponylang
malthe has joined #ponylang
jmiven has joined #ponylang
runehog has quit [Ping timeout: 244 seconds]
runehog has joined #ponylang
jmiven has quit [*.net *.split]
bbhoss has joined #ponylang
kushalp has joined #ponylang
jmiven has joined #ponylang
NhanH_ has joined #ponylang
c355e3b has joined #ponylang
montanonic has quit [Quit: My laptop is sleeping.]
montanonic has joined #ponylang
emilbayes has joined #ponylang
montanonic has quit [Client Quit]
montanonic has joined #ponylang
cquinn has joined #ponylang
<SeanTAllen> There's nothing in place for that yet
polypus74 has joined #ponylang
<SeanTAllen> 0.3.3 has been released. Its advised that everyone update. More info here: https://pony.groups.io/g/user/message/699?p=Created,0,,20,2,0,6820755&offset=0
doublec has quit [Ping timeout: 244 seconds]
malthe has quit [Ping timeout: 244 seconds]
mcguire1 has joined #ponylang
polypus74 has quit [*.net *.split]
bbhoss has quit [*.net *.split]
atk has quit [*.net *.split]
irx[m] has joined #ponylang
malthe_ has joined #ponylang
bbhoss has joined #ponylang
atk has joined #ponylang
polypus74 has joined #ponylang
bbhoss has quit [Ping timeout: 272 seconds]
bbhoss has joined #ponylang
dom96 has joined #ponylang
<polypus74> are there octal integer literals in pony?
k0nsl has joined #ponylang
srenatus[m] has joined #ponylang
M-Ingo has joined #ponylang
M-hrjet has joined #ponylang
montanonic has quit [Ping timeout: 250 seconds]
montanonic has joined #ponylang
<polypus74> i have a C library which exports an opaque struct via a header file. how do i represent it on the pony side?
<polypus74> i.e. i only need to pass around a pointer, never alloc it, and don't need to know it's structure.