00:01
mvzink has quit [Quit: A merry Christmas to all, and to all a good night!]
00:12
polypus74 has joined #ponylang
00:13
<
polypus74 >
was trying: 'type X is Y if windows' as with use declarations, but get syntax error. is there some way to do this?
00:32
<
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?
00:57
<
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)
00:58
<
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
00:59
<
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")
01:00
<
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
01:00
<
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
01:01
<
jemc >
see `packages/process/process_monitor.pony` for more examples of platform-specific code in method bodies
01:01
<
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?
01:22
<
polypus74 >
i'm trying to pass in a c string to an ffi call which needs to write to the string. i'm doing
01:22
<
polypus74 >
let s = String(max_len)
01:23
<
polypus74 >
@wcstombs(s.cstring(), wchars, max_len)
01:23
<
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?
01:24
<
SeanTAllen >
you need to call null_terminated() on it before passing to the ffi call polypus74
01:25
<
SeanTAllen >
that will make a new copy of the string with a null terminator
01:26
<
polypus74 >
but wcstombs takes a size argument. and does not check for null termination
01:27
<
polypus74 >
well it probably does on the second argument 'wchars' but that is a pointer into C-land in my code.
01:28
<
SeanTAllen >
¯\_(ツ)_/¯
01:28
<
polypus74 >
so what i'm doing, should theoretically be ok?
01:29
<
SeanTAllen >
o i see you want it to fill out the String... well that, that i'm not sure at all
01:30
<
SeanTAllen >
ive never done that
01:31
<
polypus74 >
i guess the main question is whether String(n) allocates n bytes and whether cstring() returns a pointer to it
01:31
<
polypus74 >
which is safe to write to in c-land
01:33
<
SeanTAllen >
it seems weird to create a string to get the pointer to pass to a c function
01:33
<
SeanTAllen >
rather than just allocing using a Pointer[U8]
01:33
<
SeanTAllen >
like: _ptr = Pointer[U8]._alloc(_alloc)
01:34
<
polypus74 >
SeanTAllen: yes, when you know you can do that with a pointer, it's weird :) i'll try that
01:36
<
doublec >
isn't _alloc private?
01:36
<
polypus74 >
yeah. it is
01:37
<
doublec >
polypus74: you should be able to create a String ref and pass the cstring() to your api to be filled
01:37
<
doublec >
polypus74: are you passing the correct length?
01:38
<
polypus74 >
yes passing in same length as in string ctor
01:39
<
doublec >
you'll need to null_terminatd() your 'wchars'.
01:39
<
doublec >
But not your 's'.
01:40
<
polypus74 >
the wchars is a Pointer[U32] which came from c-land. i did not allocte it. it should already be null terminated.
01:42
<
polypus74 >
this is my ffi declaration:
01:42
<
polypus74 >
use @wcstombs[USize](dest: Pointer[U8] tag, src: Pointer[WChar] tag, n: USize)
01:43
<
polypus74 >
the c prototype:
01:43
<
polypus74 >
size_t wcstombs(char *dest, const wchar_t *src, size_t n);
01:43
<
doublec >
Why 'tag'?
01:43
<
doublec >
I'd get rid of the rcap
01:44
<
doublec >
Not that that would be the cause of the error, just noting it
01:44
<
polypus74 >
just because String#cstring returns Pointer[U8 val] tag. but yeah C shouldn't care either way right?
01:44
<
doublec >
Oh I didn't realise it did
01:45
<
doublec >
I guess tag is fine then
01:47
<
doublec >
Is "foobar" null terminated in pony?
01:47
<
doublec >
ie. a string literal
01:47
<
polypus74 >
i don't think so hence String#null_terminated
01:48
<
doublec >
(The WChar > U8 change shouldn't matter, I just needed a quick way to test)
01:52
<
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.
01:55
polypus74 has quit [Remote host closed the connection]
03:36
jonrh has quit [Ping timeout: 248 seconds]
03:37
amclain_ has joined #ponylang
03:37
unbalanced has joined #ponylang
03:37
NhanH has quit [Ping timeout: 272 seconds]
03:37
hakvroot has quit [Read error: Connection reset by peer]
03:37
bodie_ has quit [Ping timeout: 244 seconds]
03:37
sjums_ has joined #ponylang
03:37
unbalancedparen has quit [Read error: Connection reset by peer]
03:37
jemc has quit [Ping timeout: 240 seconds]
03:37
SeanTAllen has quit [Ping timeout: 255 seconds]
03:37
jmiven has quit [Ping timeout: 240 seconds]
03:37
jmiven has joined #ponylang
03:37
mankyKitty has quit [Ping timeout: 272 seconds]
03:37
shepheb has quit [Ping timeout: 240 seconds]
03:37
jemc_ has joined #ponylang
03:38
srenatus[m] has quit [Ping timeout: 264 seconds]
03:38
shepheb has joined #ponylang
03:38
lisael has quit [Ping timeout: 260 seconds]
03:38
graaff has joined #ponylang
03:38
amclain has quit [Ping timeout: 278 seconds]
03:38
Corwin has quit [Ping timeout: 265 seconds]
03:38
hakvroot has joined #ponylang
03:39
emilbayes has quit [Ping timeout: 250 seconds]
03:39
bodie_ has joined #ponylang
03:40
bbhoss has quit [Ping timeout: 248 seconds]
03:41
dinfuehr has quit [Ping timeout: 240 seconds]
03:41
pyon has quit [Ping timeout: 248 seconds]
03:41
strmpnk has quit [Ping timeout: 248 seconds]
03:42
shepheb has quit [Ping timeout: 240 seconds]
03:42
kajstrom_ has quit [Ping timeout: 240 seconds]
03:42
kajstrom has joined #ponylang
03:44
shepheb has joined #ponylang
03:45
k0nsl has quit [Ping timeout: 248 seconds]
03:48
sjums has quit [*.net *.split]
03:48
adamkittelson has quit [*.net *.split]
03:48
bodie_ has quit [Ping timeout: 264 seconds]
03:48
omarkj has quit [Ping timeout: 250 seconds]
03:48
sjums has joined #ponylang
03:48
jemc_ has quit [Ping timeout: 240 seconds]
03:48
bodie__ has joined #ponylang
03:48
sylvanc_ has joined #ponylang
03:48
prettyvanilla_ has joined #ponylang
03:48
bodie__ is now known as bodie_
03:48
hakvroot has quit [Read error: Connection reset by peer]
03:48
dinfuehr has joined #ponylang
03:48
sjums_ has quit [Read error: Connection reset by peer]
03:49
prettyvanilla has quit [Remote host closed the connection]
03:49
sylvanc has quit [Ping timeout: 255 seconds]
03:49
jemc has joined #ponylang
03:49
M-hrjet has quit [Ping timeout: 272 seconds]
03:50
adamkittelson has joined #ponylang
03:50
hakvroot has joined #ponylang
03:50
lisael has joined #ponylang
03:51
Corwin has joined #ponylang
03:57
jonrh has joined #ponylang
04:06
mankyKitty has joined #ponylang
04:06
c355e3b has quit [Quit: Connection closed for inactivity]
04:07
NhanH has joined #ponylang
04:09
bbhoss has joined #ponylang
04:10
strmpnk has joined #ponylang
04:13
SeanTAllen has joined #ponylang
04:15
emilbayes has joined #ponylang
04:20
jonrh has quit [Ping timeout: 250 seconds]
04:20
prettyvanilla has joined #ponylang
04:20
prettyvanilla_ has quit [Read error: Connection reset by peer]
04:20
dinfuehr has quit [Ping timeout: 272 seconds]
04:20
adamkittelson has quit [Ping timeout: 272 seconds]
04:20
dinfuehr has joined #ponylang
04:20
NhanH has quit [Ping timeout: 255 seconds]
04:26
bbhoss has quit [Ping timeout: 250 seconds]
04:29
jonrh has joined #ponylang
04:29
adamkittelson has joined #ponylang
04:29
NhanH has joined #ponylang
04:32
bbhoss has joined #ponylang
04:43
amclain_ has quit [Quit: Leaving]
04:51
k0nsl has joined #ponylang
04:55
jemc has quit [Ping timeout: 244 seconds]
05:21
pyon has joined #ponylang
06:21
srenatus[m] has joined #ponylang
06:30
shelajev has joined #ponylang
06:31
shelajev has quit [Client Quit]
07:35
omarkj has joined #ponylang
07:35
omarkj has joined #ponylang
07:35
omarkj has quit [Changing host]
07:53
M-hrjet has joined #ponylang
08:07
dinfuehr has quit [Ping timeout: 272 seconds]
08:08
dinfuehr has joined #ponylang
08:21
k0nsl has quit [Ping timeout: 255 seconds]
08:22
k0nsl has joined #ponylang
09:16
montanonic has joined #ponylang
09:21
k0nsl has quit [Ping timeout: 265 seconds]
09:32
k0nsl has joined #ponylang
09:41
TonyLo has joined #ponylang
10:09
montanonic has quit [Ping timeout: 250 seconds]
10:55
c355e3b has joined #ponylang
13:00
mitnk has joined #ponylang
13:09
TwoNotes has joined #ponylang
13:11
<
TwoNotes >
How to use 'match' to decrement a (USize | None) only if it is a USize?
13:20
<
SeanTAllen >
something like this...
13:20
<
SeanTAllen >
but i havent compiled that
13:22
<
TwoNotes >
that seems to work
13:23
<
TwoNotes >
I notice that 'match' insists on there being an else clause even if all possible matches have been explicitly stated.
13:23
<
TwoNotes >
If the value of the match is required
13:25
<
SeanTAllen >
i should have put that
13:46
<
TwoNotes >
I did not mean in response to my first question.
13:46
<
TwoNotes >
I have a fun thet returns Bool.
13:47
<
TwoNotes >
I have a vraiable that is (None | USize)
13:47
<
TwoNotes >
match x | let n: USize => (n > 0) | None => fun_that_returns_Bool() end
13:48
<
TwoNotes >
ponyc invents an "else None"
14:34
polypus74 has joined #ponylang
14:35
pyon has quit [Quit: We've run out of supplies and stuff. Let's go shopping.]
15:21
Praetonus has joined #ponylang
16:16
pyon has joined #ponylang
16:21
graaff has quit [Quit: Leaving]
16:40
TwoNotes has quit [Quit: Leaving.]
18:19
atk has quit [Ping timeout: 265 seconds]
18:20
atk has joined #ponylang
18:30
nitbix has joined #ponylang
18:44
_whitelogger_ has joined #ponylang
18:44
jmiven has quit [Ping timeout: 240 seconds]
18:44
M-Ingo has quit [Ping timeout: 240 seconds]
18:44
bbhoss has quit [*.net *.split]
18:44
adamkittelson has quit [*.net *.split]
18:44
malthe has quit [*.net *.split]
18:44
srenatus[m] has quit [*.net *.split]
18:44
NhanH has quit [*.net *.split]
18:44
jonrh has quit [*.net *.split]
18:44
emilbayes has quit [*.net *.split]
18:44
strmpnk has quit [*.net *.split]
18:44
mankyKitty has quit [*.net *.split]
18:44
gornikm has quit [*.net *.split]
18:44
_whitelogger has quit [*.net *.split]
18:44
TonyLo has quit [Ping timeout: 255 seconds]
18:44
sjums has quit [Ping timeout: 272 seconds]
18:44
irx[m] has quit [Ping timeout: 313 seconds]
18:44
shepheb has quit [Ping timeout: 272 seconds]
18:44
otremblay has quit [Ping timeout: 272 seconds]
18:44
pyon has quit [Ping timeout: 272 seconds]
18:44
lisael has quit [*.net *.split]
18:44
sylvanc_ has quit [*.net *.split]
18:44
kajstrom has quit [*.net *.split]
18:44
polypus74 has quit [Ping timeout: 620 seconds]
18:45
adamkittelson_ is now known as adamkittelson
18:45
sjums has joined #ponylang
18:45
unbalancedparen has joined #ponylang
18:45
Praetonus_ has joined #ponylang
18:45
mcguire has joined #ponylang
18:45
Praetonus_ has quit [Client Quit]
18:45
dinfuehr has joined #ponylang
18:45
Praetonus has quit [Ping timeout: 356 seconds]
18:45
SeanTAllen has quit [Ping timeout: 418 seconds]
18:46
sylvanc has joined #ponylang
18:46
shepheb has joined #ponylang
18:46
CcxCZ has joined #ponylang
18:46
NhanH_ has quit [Ping timeout: 252 seconds]
18:47
emilbayes has joined #ponylang
18:47
otremblay has joined #ponylang
18:47
malthe has joined #ponylang
18:47
jmiven has joined #ponylang
18:47
prettyvanilla has quit [Remote host closed the connection]
18:47
TonyLo has joined #ponylang
18:48
prettyvanilla has joined #ponylang
18:48
kajstrom has joined #ponylang
18:49
lisael has joined #ponylang
18:49
jonrh_ is now known as jonrh
18:51
M-hrjet has joined #ponylang
18:52
nitbix has joined #ponylang
18:56
otremblay has quit [Ping timeout: 265 seconds]
18:57
darach has quit [Ping timeout: 250 seconds]
18:57
sylvanc has quit [Ping timeout: 265 seconds]
18:57
otremblay has joined #ponylang
18:57
ericbmerritt has quit [Ping timeout: 250 seconds]
18:57
jmiven_ has joined #ponylang
18:57
malthe has quit [Ping timeout: 265 seconds]
18:58
atk has quit [Ping timeout: 240 seconds]
18:58
prettyvanilla_ has joined #ponylang
18:59
atk has joined #ponylang
19:00
jtfmumm has quit [Ping timeout: 250 seconds]
19:01
sjums_ has joined #ponylang
19:01
unbalanced has joined #ponylang
19:02
jeremyheiler has quit [Ping timeout: 250 seconds]
19:03
c355e3b has quit [Ping timeout: 250 seconds]
19:03
kajstrom has quit [Ping timeout: 255 seconds]
19:03
CcxCZ has quit [Ping timeout: 272 seconds]
19:03
emilbayes has quit [Ping timeout: 272 seconds]
19:03
shepheb has quit [Ping timeout: 272 seconds]
19:03
sjums has quit [Ping timeout: 272 seconds]
19:03
M-hrjet has quit [*.net *.split]
19:03
lisael has quit [*.net *.split]
19:03
prettyvanilla has quit [*.net *.split]
19:03
k0nsl has quit [*.net *.split]
19:03
dom96 has quit [*.net *.split]
19:03
Candle has quit [*.net *.split]
19:03
lisael_ has joined #ponylang
19:03
unbalancedparen has quit [Ping timeout: 264 seconds]
19:04
jmiven has quit [*.net *.split]
19:04
pyon has joined #ponylang
19:05
CcxCZ has joined #ponylang
19:09
k0nsl has joined #ponylang
19:09
k0nsl has quit [Changing host]
19:09
k0nsl has joined #ponylang
19:10
gornikm has joined #ponylang
19:10
kajstrom has joined #ponylang
19:11
malthe has joined #ponylang
19:14
sylvanc has joined #ponylang
19:15
strmpnk has joined #ponylang
19:15
shepheb has joined #ponylang
19:17
mankyKitty has joined #ponylang
19:18
Candle has joined #ponylang
19:20
dom96 has joined #ponylang
19:21
darach has joined #ponylang
19:21
SeanTAllen has joined #ponylang
19:21
jtfmumm has joined #ponylang
19:22
NhanH_ has joined #ponylang
19:24
ericbmerritt has joined #ponylang
19:27
c355e3b has joined #ponylang
19:28
bbhoss has joined #ponylang
19:29
jeremyheiler has joined #ponylang
19:34
emilbayes has joined #ponylang
19:36
TonyLo_afk has joined #ponylang
19:37
TonyLo has quit [Ping timeout: 276 seconds]
19:38
prettyvanilla has joined #ponylang
19:39
Candle has quit [Ping timeout: 276 seconds]
19:39
malthe has quit [Ping timeout: 276 seconds]
19:39
kajstrom has quit [Ping timeout: 276 seconds]
19:39
sjums_ has quit [Ping timeout: 276 seconds]
19:39
jmiven_ has quit [Ping timeout: 276 seconds]
19:39
kajstrom has joined #ponylang
19:39
prettyvanilla_ has quit [Ping timeout: 276 seconds]
19:39
hakvroot has quit [Ping timeout: 276 seconds]
19:39
so has quit [Ping timeout: 276 seconds]
19:40
sjums has joined #ponylang
19:40
malthe has joined #ponylang
19:40
hakvroot has joined #ponylang
19:41
jmiven has joined #ponylang
19:44
so has joined #ponylang
19:52
sjums has quit [Ping timeout: 265 seconds]
19:53
dom96 has quit [Ping timeout: 265 seconds]
19:54
hakvroot has quit [Ping timeout: 265 seconds]
19:54
malthe has quit [Ping timeout: 265 seconds]
19:55
sjums has joined #ponylang
19:58
mcguire has quit [Ping timeout: 250 seconds]
20:04
hakvroot has joined #ponylang
20:10
malthe has joined #ponylang
20:16
pyon has quit [Ping timeout: 250 seconds]
20:17
sylvanc_ has joined #ponylang
20:17
TonyLo has joined #ponylang
20:17
prettyvanilla_ has joined #ponylang
20:17
malthe_ has joined #ponylang
20:17
TonyLo_afk has quit [Ping timeout: 272 seconds]
20:17
c355e3b has quit [Ping timeout: 272 seconds]
20:17
emilbayes has quit [Ping timeout: 272 seconds]
20:17
jeremyheiler has quit [Ping timeout: 272 seconds]
20:17
sjums has quit [Ping timeout: 272 seconds]
20:17
kajstrom has quit [Ping timeout: 272 seconds]
20:17
mankyKitty has quit [Ping timeout: 272 seconds]
20:17
shepheb has quit [Ping timeout: 272 seconds]
20:17
sylvanc has quit [Ping timeout: 272 seconds]
20:17
CcxCZ has quit [Ping timeout: 272 seconds]
20:17
lisael_ has quit [Ping timeout: 272 seconds]
20:17
malthe has quit [Ping timeout: 272 seconds]
20:17
hakvroot has quit [Ping timeout: 272 seconds]
20:17
prettyvanilla has quit [Ping timeout: 272 seconds]
20:17
gornikm has quit [Ping timeout: 272 seconds]
20:18
hakvroot has joined #ponylang
20:19
Candle has joined #ponylang
20:20
sjums has joined #ponylang
20:20
NhanH_ has quit [Ping timeout: 265 seconds]
20:21
bbhoss has quit [Ping timeout: 265 seconds]
20:26
atk has quit [Ping timeout: 250 seconds]
20:27
hakvroot has quit [Ping timeout: 250 seconds]
20:28
kushalp has quit [Ping timeout: 250 seconds]
20:30
hakvroot has joined #ponylang
20:31
cquinn has quit [Ping timeout: 250 seconds]
20:32
<
TonyLo >
Hi, is there a way to read/write from/to a serial port in Pony or do I need to use C?
20:33
lisael has joined #ponylang
20:33
k0nsl has quit [*.net *.split]
20:33
atk has joined #ponylang
20:35
montanonic has joined #ponylang
20:36
shepheb has joined #ponylang
20:38
k0nsl has joined #ponylang
20:39
CcxCZ has joined #ponylang
20:42
kajstrom has joined #ponylang
20:44
mankyKitty has joined #ponylang
20:45
TonyLo has quit [Ping timeout: 265 seconds]
20:45
jeremyheiler has joined #ponylang
20:46
prettyvanilla has joined #ponylang
20:46
lisael_ has joined #ponylang
20:46
malthe_ has quit [Ping timeout: 265 seconds]
20:46
prettyvanilla_ has quit [Ping timeout: 265 seconds]
20:46
TonyLo has joined #ponylang
20:49
gornikm has joined #ponylang
20:52
atk has quit [Ping timeout: 272 seconds]
20:52
lisael has quit [Ping timeout: 272 seconds]
20:52
jmiven has quit [*.net *.split]
20:52
k0nsl has quit [Ping timeout: 248 seconds]
20:53
atk has joined #ponylang
20:55
malthe has joined #ponylang
20:55
jmiven has joined #ponylang
20:57
runehog has quit [Ping timeout: 244 seconds]
20:57
runehog has joined #ponylang
20:57
jmiven has quit [*.net *.split]
20:58
bbhoss has joined #ponylang
21:00
kushalp has joined #ponylang
21:00
jmiven has joined #ponylang
21:10
NhanH_ has joined #ponylang
21:12
c355e3b has joined #ponylang
21:18
montanonic has quit [Quit: My laptop is sleeping.]
21:18
montanonic has joined #ponylang
21:19
emilbayes has joined #ponylang
21:20
montanonic has quit [Client Quit]
21:20
montanonic has joined #ponylang
21:24
cquinn has joined #ponylang
21:24
<
SeanTAllen >
There's nothing in place for that yet
21:25
polypus74 has joined #ponylang
21:44
doublec has quit [Ping timeout: 244 seconds]
21:49
malthe has quit [Ping timeout: 244 seconds]
21:52
mcguire1 has joined #ponylang
21:52
polypus74 has quit [*.net *.split]
21:52
bbhoss has quit [*.net *.split]
21:52
atk has quit [*.net *.split]
21:57
irx[m] has joined #ponylang
22:13
malthe_ has joined #ponylang
22:13
bbhoss has joined #ponylang
22:13
atk has joined #ponylang
22:13
polypus74 has joined #ponylang
22:17
bbhoss has quit [Ping timeout: 272 seconds]
22:24
bbhoss has joined #ponylang
22:45
dom96 has joined #ponylang
22:58
<
polypus74 >
are there octal integer literals in pony?
22:59
k0nsl has joined #ponylang
23:00
srenatus[m] has joined #ponylang
23:00
M-Ingo has joined #ponylang
23:00
M-hrjet has joined #ponylang
23:04
montanonic has quit [Ping timeout: 250 seconds]
23:09
montanonic has joined #ponylang
23:44
<
polypus74 >
i have a C library which exports an opaque struct via a header file. how do i represent it on the pony side?
23:45
<
polypus74 >
i.e. i only need to pass around a pointer, never alloc it, and don't need to know it's structure.