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
aturley has joined #ponylang
johshoff_ has quit [Remote host closed the connection]
aturley has quit [Quit: aturley]
dipin has quit [Quit: dipin]
aturley has joined #ponylang
<SeanTAllen> if you want to read 1 byte then you don't want to read into a u32.
<SeanTAllen> codec1: Reader/Writer can be used for non-network data but it would be the most likely usecase
<SeanTAllen> Candle: I'm not in favor of adding "len" parameter to Reader functions. That's going to require an RFC and I don't think that makes a good API. Please read 8 bytes into a U32 is a rather specialized thing to do. I don't think that should be read into a U32.
markmarkmark has quit [Ping timeout: 240 seconds]
markmarkmark has joined #ponylang
jemc has quit [Ping timeout: 264 seconds]
samuell has joined #ponylang
aturley has quit [Quit: aturley]
SenasOzys has joined #ponylang
endformationage has joined #ponylang
jemc has joined #ponylang
endformationage has quit [Quit: WeeChat 1.9.1]
jemc has quit [Ping timeout: 240 seconds]
dipin has joined #ponylang
user10032 has joined #ponylang
notsgnik has quit [Ping timeout: 255 seconds]
notsgnik has joined #ponylang
codec1 has joined #ponylang
codec1 has quit [Read error: Connection reset by peer]
SenasOzys has quit [Ping timeout: 248 seconds]
user10032 has quit [Quit: Leaving]
SenasOzys has joined #ponylang
dipin has quit [Quit: dipin]
vaninwagen has joined #ponylang
dipin has joined #ponylang
<Candle> SeanTAllen: I'd come to the conclusion that Reader wasn't the right thing anyway. Partly because the 'peek' set of functions, which I'd have to use exclusively, don't opperate on just one array, but a list of arrays, and therefore have a series of loops; and partly due to the complicated API (At 13:57:27 (My time) I did state a concern over complicated APIs.)
codec1 has joined #ponylang
<notsgnik> hello everyone, can some kind person tell me is there a way of creating a define in pony? :p
<notsgnik> sorry i think i found my answer
<notsgnik> primitive Red fun apply(): U32 => 0xFF0000FF
<notsgnik> how can i print a floating point ? there is no .string() function to the class :/
gokr has joined #ponylang
ShalokShalom has quit [Remote host closed the connection]
SirRolin has joined #ponylang
samuell has quit [Quit: Leaving]
<Candle> notsgnik: Odd, because F{32,64} are both FloatingPoint, which is Real, which is Stringable. There's the https://stdlib.ponylang.org/format--index format package too.
codec1 has quit [Quit: Leaving.]
codec1 has joined #ponylang
samuell has joined #ponylang
<SirRolin> is there a way to put an array into a lambda function?
samuell has quit [Ping timeout: 240 seconds]
samuell has joined #ponylang
DDR has quit [Ping timeout: 258 seconds]
samuell has quit [Quit: Leaving]
DDR has joined #ponylang
<SeanTAllen> SirRolin: what do you mean "put an array into a lambda function"? do you have code that demonstrates the problem you are having?
<SeanTAllen> notsgnik: do you have code that demonstrates the problem you are having?
<SeanTAllen> that doesnt compile SirRolin. For reasons unrelated to the array.
<SeanTAllen> and the lambda
<SeanTAllen> it appears you are trying to index an array using a F32 (x)
<SeanTAllen> but array's aren't indexed using F32
<SeanTAllen> they are indexed using USize
<SeanTAllen> o i see array isnt an array
<SirRolin> it'snt?
<SeanTAllen> yes
<SeanTAllen> it isnt
<SeanTAllen> array literals are [] not ()
<SeanTAllen> after that you have a problem of trying to send a ref which isnt allowed
<SeanTAllen> you have multiple problems. this fixes all of them:
<SirRolin> so the recover val was what I needed to make [] array work, it seems. together with a try on the array. thanks Sean :)
<SeanTAllen> i have a question SirRolin
<SeanTAllen> the if x > 5, what is that?
<SirRolin> that was because I didn't want it to overflow the array, but the try else fixes that XD
<SeanTAllen> ok
<SeanTAllen> that would still be an error
<SeanTAllen> well
<SeanTAllen> rather
<SeanTAllen> your logic is wrong
<SeanTAllen> your array is size 4
<SirRolin> should had been x >= 5
<SeanTAllen> the max index is 3
<SirRolin> oh yeah
<SeanTAllen> but yes, try else around the entire thing is probably what you want without that check
<SeanTAllen> although
<SeanTAllen> if you expect it to be out of bounds a lot, using an `error` with try/else will be slower than checking to make sure your index isnt out of bounds
<SirRolin> once again, thanks sean, you are of great help :)
SenasOzys has quit [Ping timeout: 240 seconds]
<SeanTAllen> you're welcome
SenasOzys has joined #ponylang
markmarkmark has quit [Quit: WeeChat 1.9]
alxs has joined #ponylang
alxs has quit [Quit: Computer's gone to sleep. ZZZzzz…]
alxs has joined #ponylang
alxs has quit [Quit: Computer's gone to sleep. ZZZzzz…]
alxs has joined #ponylang
vaninwagen has quit [Ping timeout: 240 seconds]
aturley has joined #ponylang
SenasOzys has quit [Ping timeout: 276 seconds]
alxs has quit [Quit: Computer's gone to sleep. ZZZzzz…]
gokr has quit [Ping timeout: 268 seconds]
alxs has joined #ponylang
oraoro has joined #ponylang
SirRolin has quit [Ping timeout: 260 seconds]
Praetonus has joined #ponylang
jemc has joined #ponylang
jemc has quit [Read error: Connection reset by peer]
metadave has joined #ponylang
jemc has joined #ponylang
codec1 has quit [Read error: Connection reset by peer]
codec1 has joined #ponylang
oraoro has quit [Ping timeout: 258 seconds]
alxs has quit [Quit: Computer's gone to sleep. ZZZzzz…]
gokr has joined #ponylang
alxs has joined #ponylang
<notsgnik> hello btw :)
<SeanTAllen> So that's not a lack of string() problem notsgnik
<SeanTAllen> the issue is that Float is either F32 or F64
<SeanTAllen> but 1.01325 et al need a specific type as Float is a union type
<SeanTAllen> there are problems after that as well
<SeanTAllen> this is a working version of what you have but maybe not what you really wanted: https://playground.ponylang.org/?gist=67969b55ccf99a4f34597ed231ee0545
<notsgnik> it is, but it's nor really readable
<SeanTAllen> true
<SeanTAllen> so
<SeanTAllen> why are you using Float rather than F64 ?
alxs has quit [Quit: Computer's gone to sleep. ZZZzzz…]
<SeanTAllen> was the idea, this could be a F32 or F64 depending on the platform?
<notsgnik> to test union types
<notsgnik> i was trying to do a temple-like thing
<notsgnik> *tmeplates-like
<SeanTAllen> i don't follow. what do you mean to do test union types?
<SeanTAllen> template like?
<notsgnik> like in c++
<SeanTAllen> i know what a c++ template is, not sure how it relates
<SeanTAllen> so
<notsgnik> for the convertors functions
<SeanTAllen> still not following
<SeanTAllen> why did you use Float instead of F32 or F64?
<notsgnik> in order to write one code and be able to use multiple type on the same function
<notsgnik> i thought that union was the was to go :p
<notsgnik> *way
alxs has joined #ponylang
<SeanTAllen> well its an odd example
<SeanTAllen> because then you have to pick a specific type when you do
<SeanTAllen> "1.01325"
<SeanTAllen> that needs a type
<SeanTAllen> its either F32 or F64
<SeanTAllen> and you need to supply it
<SeanTAllen> so Float which is either F32 or F64 doesnt make much sense
<SeanTAllen> because you have to specify which it is
<SeanTAllen> the compiler cant see 1.01325 and pick for you, not safely anyway
<notsgnik> ok for Atmos
<notsgnik> but for Convertors?
<SeanTAllen> same thing
<SeanTAllen> you are saying x is either F32 or F64 and multiply it by...
<SeanTAllen> and the multiply it by... is going to have a type
<SeanTAllen> which is either F32 or F64
<notsgnik> can't it be Float?
<SeanTAllen> so x needs to be converted to that type
<SeanTAllen> Pony will not let you multiply an F32 and a F64 without you explictly doing the conversion
<notsgnik> can't x convert the right hand side?
<SeanTAllen> implicit conversions dont happy in pony
<SeanTAllen> they are a source of bugs
<notsgnik> i see
<SeanTAllen> conversions are required to be explicit
<SeanTAllen> so this code, you are going to have to pick a type either F32 or F64 so using Float is a lot of extra work and noise
<SeanTAllen> if you want to do something like a template
<SeanTAllen> what you want are generics
<notsgnik> i'll take a look
<SeanTAllen> but what you have still wouldnt make sense as a generic most likely
<notsgnik> to make a difference between a F32 and F64 ... not really, maybe between objects
alxs has quit [Quit: Computer's gone to sleep. ZZZzzz…]
<SeanTAllen> you have the same problem again notsgnik
<SeanTAllen> so with
<SeanTAllen> A(100000.0)
<SeanTAllen> if 'A' is a F32
<SeanTAllen> and the value you pass is larger than what a F32 can represent, what do you think should happen
<SeanTAllen> you have to supply a type for 100000.0
<SeanTAllen> if you supply a type and it overflows, well, that's on you the programmer
codec1 has quit [Read error: Connection reset by peer]
codec1 has joined #ponylang
<SeanTAllen> but the compiler shouldn't in my mind, be doing it for you
<SeanTAllen> this comes back to my question though
<SeanTAllen> why do you want to be able to do F32 or F64? instead of picking 1.
<notsgnik> i was just learned c++ and seen templates so i thought why not try to do the same with pony
<notsgnik> i understand now that the pony phylosophy is to make the compiler really efficient a avoiding programmer's bugs
<notsgnik> and in order to do that they should be constrains
<SeanTAllen> im not sure i would go that far
<SeanTAllen> for example
<SeanTAllen> pony doesnt prevent you from overflowing a number
<SeanTAllen> but it makes you do it, rather than having it happen through an implicit conversion
<codec1> syntax error probably
<codec1> I would say they are missing parenthesis for apply for Atmos
<codec1> and a lacking string() call
<notsgnik> ok, so the function apply is the "new create" for primitives
<codec1> I don't think so
<notsgnik> or only the default function that get called when using "()"
<notsgnik> ?
<codec1> yes except if there is a constructor called new which would take those parameters
<codec1> as far as I know
alxs has joined #ponylang
<notsgnik> wow, it takes time to learn pony actually
<notsgnik> and i'm not yet playing with iso, val and ref stuff ^^
<codec1> well I would say the more the language try to protect against yourself
<codec1> the more you have to learn its way of doing it
<notsgnik> and he is right, cause i'm really just a monkey behind a keyboard :D
<codec1> it depends of how you look at it
<codec1> there are some simple construct that are safe that the compiler won't allow you to do
<codec1> but the compiler can't have a deep understanding of what you are trying to achieve
<codec1> so it has to keep to some clearly defined rules that gurantees the behavior of your program
<notsgnik> and a mathematical proof :)
<codec1> but it is not specific to Pony, there are plenty languages that lean toward statically enforced rules to have some kind of guarantees such as Rust, Idris, etc...
<notsgnik> to me it still looks better than go and rust
<codec1> I don't think they are comparable
<codec1> I like Rust but it is quite different from Pony
<codec1> and go ,as far as I know, as a pretty weak type system
<notsgnik> in term of bending the language to adatp to modern needs, pony ( to me ) doses a better job at keeping it redable
<SeanTAllen> notsgnik: do you know why your example didnt compile?
<notsgnik> the last one?
<notsgnik> i forgot to call the apply function
<notsgnik> and just referensed the name of the primitive instead
<SeanTAllen> that's one of the two errors
<SeanTAllen> yes
<notsgnik> i don't understand the second parenteseis
<notsgnik> around Convertors
<SeanTAllen> because you call returns a PFloat
<SeanTAllen> not a string
<notsgnik> shouldn't he have the string function?
<SeanTAllen> pony will not automatically convert types for you
<notsgnik> k
<SeanTAllen> it doesnt matter that PFloat is an F32
<SeanTAllen> and F32 has string
<SeanTAllen> you have to call string() on it if you want to convert to a string
<notsgnik> i understood... no implicit conversions
user10032 has joined #ponylang
samuell has joined #ponylang
codec1 has quit [Read error: Connection reset by peer]
gokr has quit [Ping timeout: 240 seconds]
alxs has quit [Quit: Computer's gone to sleep. ZZZzzz…]
nisanharamati has joined #ponylang
alxs has joined #ponylang
alxs has quit [Quit: Computer's gone to sleep. ZZZzzz…]
alxs has joined #ponylang
alxs has quit [Quit: Computer's gone to sleep. ZZZzzz…]
alxs has joined #ponylang
codec1 has joined #ponylang
_andre has quit [Quit: leaving]
vaninwagen has joined #ponylang
gokr has joined #ponylang
xllndr has joined #ponylang
acarrico has quit [Ping timeout: 276 seconds]
samuell has quit [Ping timeout: 276 seconds]
DDR has quit [Ping timeout: 258 seconds]
DDR has joined #ponylang
samuell has joined #ponylang
xllndr has quit [Quit: Leaving]
vaninwagen has quit [Ping timeout: 250 seconds]
acarrico has joined #ponylang
acarrico has quit [Max SendQ exceeded]
user10032 has quit [Quit: Leaving]
acarrico has joined #ponylang
acarrico has quit [Ping timeout: 276 seconds]
alxs has quit [Quit: Computer's gone to sleep. ZZZzzz…]
gokr has quit [Ping timeout: 260 seconds]
codec1 has quit [Read error: Connection reset by peer]
samuell has quit [Quit: Leaving]
moony has joined #ponylang
<moony> what is the compiler trying to tell me? All i see is a lot of 'iso'. /home/moony/Projects/pony-projects/lost-islands/src/ebs/entity.pony:9:34: Entity iso! is not a subtype of Entity iso: iso! is not a subcap of iso
<SeanTAllen> moony: it would help to see the code
<SeanTAllen> but iso!
<SeanTAllen> means an alias of an iso
<SeanTAllen> that's bad
<SeanTAllen> so somewhere you are trying to either
<SeanTAllen> 1) share an iso by design (cant do that!)
<SeanTAllen> 2) you missed a consume of an iso
<moony> oh shoot, i've been missing consumes everywhere.
<moony> that explains it. Derp.
<moony> (I always seem to forget consume exists. I just think it's implict half the time for some reason)
<moony> Now just to figure out why array access seems to be adding the 'tag' capability and i can't figure out why.
<moony> wait. Oh. Right, non consuming read.