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
<autodidaddict> really dumb question.. how do I do an "is not" ?
<autodidaddict> e.g. "if id is not None"
<autodidaddict> arg. nvm. needed parens
* autodidaddict facepalms
<plietar_> autodidaddict: `if id isnt None`
<autodidaddict> isnt is a keyword? nice
<autodidaddict> of course now I'm having trouble setting a value in a JSONDoc
<autodidaddict> refcaps, obviously
Candle has quit [Ping timeout: 255 seconds]
<autodidaddict> trying to convert fields that are ref into vals so I can add them to a map
* autodidaddict pulls out his last remaining hair follicle
<doublec> autodidaddict: that part of the JSON library is thorny
<autodidaddict> I'm just calling from_map
<doublec> autodidaddict: the irc logs are littered with the remains of people usin git
<autodidaddict> I'm running into the refcaps issue with simple things like `mymap("data") = foofield`
<doublec> ( I jest, it's not too bad)
<autodidaddict> I'm getting the "ref is not a subtype of val" stuff
<doublec> autodidaddict: viewtype adaption is important here
<autodidaddict> yeah, it was last time I had this problem and couldn't figure it out :D
<doublec> autodidaddict: the refcap of the map, vs the refcap of the map internal to the JSONDoc etc
<autodidaddict> I'm not even using jsondoc yet
<autodidaddict> I simply can't set mymap(foo)
<doublec> autodidaddict: if you can paste some code, or show the refcap of the map, the elements in the map and the thing you are assiging too I can try to help
<autodidaddict> let result : JsonType
<autodidaddict> dmap("result") = result
<autodidaddict> that doesn't work
<autodidaddict> the let result is a field
Candle has joined #ponylang
<doublec> What is dmap?
<autodidaddict> var dmap: Map[String, JsonType] = Map[String, JsonType]
* doublec looks at json code
<autodidaddict> that's the type that JsonObject expects for its from_map
<autodidaddict> JsonType is a big union
<autodidaddict> my problem is my fields are ref and I need to put a value into my map
<autodidaddict> er, val
<doublec> autodidaddict: what's the error you are getting?
<doublec> autodidaddict: your 'result' is a val?
<doublec> Ah right, can reproduce, let me see
<autodidaddict> it looks like I just need a val copy of the field
<doublec> autodidaddict: why not make the element of the map the same rcap as what you are putting in?
<doublec> ie. both at the default should work
<autodidaddict> I don't know what you mean by result is a val, it's a field on my class
<autodidaddict> of type JsonTYpe
<autodidaddict> so it's whatever JsonType's union is
<autodidaddict> I am defaulting everything
<doublec> autodidaddict: I'm assuming, from the error, that 'result' has an rcap that is not the same as the rcap of the element of the map
<autodidaddict> field declaration : "let result : JsonType"
<doublec> autodidaddict: and trying to find out why
<autodidaddict> map: var dmap: Map[String, JsonType] = Map[String, JsonType]
<doublec> autodidaddict: are you doing this insert into the map from a method of the class that contains the field?
<autodidaddict> yes
<doublec> ok, what's the rcap on that method? Is it box?
<autodidaddict> I'm not returning the map from the method
<autodidaddict> so it doesn't really mappy
<autodidaddict> matter
<autodidaddict> the method is fun to_json(): String =>
<doublec> Yes, it matters if you are accessing the field from a box method
<doublec> because of viewtype adaption
<doublec> if the field is a 'ref', your method is a 'box' then it's seeing the field as box->ref
<autodidaddict> all I want to do is manually manipulate some Json and then stringify it before exiting the method
<doublec> Which is box
<doublec> autodidaddict: is the map a field too?
<autodidaddict> no
<autodidaddict> it's a variable defined in my method
<autodidaddict> I get the same errors when I try and use the `data` map on the JsonObject directly
<autodidaddict> so I definitely need to do something to my fields
<autodidaddict> I just don't know _what_
<doublec> autodidaddict: I think this reproduces it: https://pastebin.com/bgHBWRnc
<doublec> Note the Foo definition fails to compile but the one in the Main actor does compile
<doublec> autodidaddict: the fix for that is to make the method 'ref' not 'box'
<autodidaddict> so how does one fix this?
<autodidaddict> that looks nearly identical to my class
<doublec> autodidaddict: so in my example: fun ref bar() =>
<autodidaddict> I can't set map values
<doublec> autodidaddict: so this works https://pastebin.com/6DzsFLJ0
<doublec> And it's viewtype adaption as mentioned above
<autodidaddict> wow.. just adding "ref", even though I'm not mutating my fields :(
<doublec> box->ref was giving a rcap of box to the JsonType and you can't add a "JsonType box" to the map
<autodidaddict> more confusion
<doublec> but ref->ref gives an rcap of ref to the JsonType and you can add a "JsonType ref" to the map
<autodidaddict> this makes no sense to me.
<doublec> autodidaddict: which part
<autodidaddict> why I need to declare a function as a ref, when the function _does not_ mutate any fields
<doublec> autodidaddict: Ok, the field is a 'ref', you understand that, right?
<autodidaddict> yes, but I'm not modifying it
<doublec> autodidaddict: you are in a box method so you aren't allowed to modify it
<autodidaddict> how the hell do I know I'm in a box method?
<doublec> autodidaddict: so within that box method that "ref" field does not look like a "ref"
<autodidaddict> how does fun foo(): String => equal box?
<doublec> autodidaddict: it looks like a readonly field - in this case box from the viewtype adaption table
<doublec> autodidaddict: all methods are box by default
<doublec> autodidaddict: "fun foo() =>" is the same as "fun box foo() =>
<autodidaddict> argh
<autodidaddict> I give up.
<doublec> This needs to be a FAQ
* autodidaddict defenestrates
<doublec> I should feed some of that back into the tutorial
<doublec> Your example is a good one too
<doublec> because of your "I'm not modifying it why does it need to be ref" intuition
<doublec> So the thing to be aware of, if you are accessing a 'ref' field, and you want to use it as a 'ref' field, your method needs to be ref.
<doublec> Otherwise you could access a ref field and store it somewhere giving a writeable alias from a method that is supposed to never allow writing to the object.
<SeanTAllen> do not defenestrate!
<autodidaddict> fun ref fixed all of my assignments but one
<doublec> autodidaddict: What is Error
<doublec> it's saying that Error can't be stored in a JsonType
<autodidaddict> it's an object I wrote.. yeah I think i've got to fix that
<doublec> Yeah, jsontype can't hold arbitary objects
<autodidaddict> I know.. I typo'd something
<autodidaddict> I think I might have it fix[ed|able]
<doublec> If it's any consolation, Pony saved you from a potential data race that's easy to miss without types :)
* doublec repeats that to himself constantly when bashing my head against the keyboard
<autodidaddict> "if it's any consolation, the grenade only took off your left leg"
<doublec> haha
<autodidaddict> tests pass!
<autodidaddict> 🍺
<doublec> \0/
<SeanTAllen> ¯\_(ツ)_/¯
<SeanTAllen> wait
<SeanTAllen> wrong one
<SeanTAllen> i am tired
<SeanTAllen> ᕕ( ᐛ )ᕗ
<SeanTAllen> that's better
<autodidaddict> sigh. went to go write another test, and now I have a refcap failure in my damn test
<SeanTAllen> you are making progress
<SeanTAllen> whats the error?
<autodidaddict> no, I'm dying
<autodidaddict> same damn one
<doublec> autodidaddict: the important thing when you solve these is to internalize why it failed and understand why you need the fix
<doublec> then you'll get less of them
<doublec> If you don't understand the fix, grill us and we'll try to help/fix the tutorial/etc
<doublec> I remember writing my first ATS programs. It'd take me hours to get a program of a few lines to compile.
<doublec> Until I finally understood why I needed to do the things that were fixing the errors.
<autodidaddict> so...
<autodidaddict> "let array = JsonArray" ... this causes a cascade of horrible failures
<autodidaddict> "let array:JsonArray = JsonArray" this compiles
<autodidaddict> style guides say we're supposed to let the compiler infer types
<SeanTAllen> where in the style guide does it say that?
<SeanTAllen> personally i tend to put the types, but that is me
<doublec> Somethings need types
<doublec> fields for example
<SeanTAllen> so is array a field or a local variable autodidaddict ?
<autodidaddict> local variable
<doublec> local variable should be fine, what are the errors?
<autodidaddict> the same refcap garbage I got before
<doublec> So one difference is: let x: JsonArray = JsonArray makes 'x' have the rcap specified in the class definition of 'JsonArray'
<autodidaddict> a seemingly infinite spam as it attempts to find some variant of JsonType that conforms
<doublec> but "let x = JsonArray" makes x have the rcap of the constructor
<doublec> so they are slightly different
<autodidaddict> ^^ this.. this is not discussed ANYWHERE
<autodidaddict> and that has burned me a number of times
<doublec> autodidaddict: I only just realized it :)
<autodidaddict> that should be in giant flashing red blinky lights
<doublec> good catch
<SeanTAllen> let x = JsonArray is iso
<SeanTAllen> let x: JsonArray = JsonArray is a ref
<autodidaddict> ^^ no one is going to guess that
<SeanTAllen> its buried in the tutorial
<autodidaddict> but why ? why are the two not identical?
<SeanTAllen> because that isnt how they were defined on JsonArray
<SeanTAllen> now why JsonArray is like that, I'm not sire
<doublec> I assume because it's easy to convert an iso to a ref
<doublec> but not a ref to an iso
<SeanTAllen> it appears all the json classes are like that
<doublec> maybe
<autodidaddict> ponyc
<autodidaddict> haha.
<autodidaddict> wrong window ;)
<SeanTAllen> i dont think anyone is particularly fond of the Json classes
<SeanTAllen> I started to rewrite them
<doublec> autodidaddict: I think the best idioms for the standard library are still being worked out
<SeanTAllen> but I am waiting for a union type to be able to refer to itsself
<doublec> And the Json stuff is certainly a pain point
<SeanTAllen> when this compiles, i have a feeling both jemc and i will finish our json libraries: https://playground.ponylang.org/?gist=36011686ecce1b8ff1118994e5f49250
<autodidaddict> I submitted a PR for proper capitalization ;)
<SeanTAllen> ha
<SeanTAllen> yes
<SeanTAllen> which is sadly a breaking change
<SeanTAllen> but a good change
<autodidaddict> better to break style stuff at 0.16.x instead of 1.16.x
<doublec> I do like that non-all case allows reading names that are multiple acronums easier to read
<doublec> JsonCom vs JSONCOM
<autodidaddict> yeah, but `JsonObject` is flagged as bad style in 3 different languages ;)
<doublec> yeah, I lose this war wherever I go :)
<SeanTAllen> autodidaddict: yes
<SeanTAllen> SO
<SeanTAllen> from looking around the standard library
<autodidaddict> btw, my tests pass again :D
<SeanTAllen> i have no idea why those JSON constructors all return isp
<SeanTAllen> uso
<SeanTAllen> iso
<SeanTAllen> god damn it
<SeanTAllen> did i mention im tired
<SeanTAllen> autodidaddict: if you find yourself always wanting a ref from the constructor, we can do an RFC to make the change
<SeanTAllen> i start all constructors as
<SeanTAllen> new create()
<SeanTAllen> and only change to
<SeanTAllen> new iso create()
<SeanTAllen> if its always/almost always used as an iso
<autodidaddict> I never do "new iso create()"
<SeanTAllen> well
<SeanTAllen> you will
<autodidaddict> mostly because I have no idea why I would ;)
<SeanTAllen> if you start doing the "notify pattern"
<SeanTAllen> so you did a little socket programming so far right?
<autodidaddict> I've learned one pattern, that's enough. Everything else hurts.
<SeanTAllen> and had to set up a notify object to pass to listen
<autodidaddict> yes i've done sockets
<SeanTAllen> the notify like
<SeanTAllen> TCPConnectionNotify
<SeanTAllen> is
<SeanTAllen> new iso create()
<SeanTAllen> because when you create one, you want an iso to give to TCPConnection
<SeanTAllen> so all those notify classes are rightly
<SeanTAllen> new iso create()
<autodidaddict> why do you want to give an iso to TCPConnection ?
<SeanTAllen> because its a class
<SeanTAllen> and TCPConnection will call it synchronously
<SeanTAllen> which will call user code
<SeanTAllen> that might update state
<autodidaddict> that doesn't help
<SeanTAllen> which means it needs to be iso
<autodidaddict> why iso? why not another refcap?
<SeanTAllen> TCPConnection is an actor
<SeanTAllen> there is only one mutable ref cap you can send to an actor
<SeanTAllen> that is `iso`
<SeanTAllen> that is why they are iso
<autodidaddict> why does a notifier need to be mutable?
<SeanTAllen> the notifier is a user supplied callback
<SeanTAllen> where you might want to do things like
<doublec> buffering for example
<SeanTAllen> record number of packets processed
<SeanTAllen> or buffer things
<SeanTAllen> or for a framed protocol, keep track of whether you are in the header or the body
<doublec> buferring data until you have a line, then it sends the line to a line notifier. That buffers data until it has a valid message then sends onto a message notifier, etc.
<autodidaddict> I'm gonna switch to Go for the rest of the night. At least I can write more than 6 lines an hour there
<SeanTAllen> :(
<SeanTAllen> god speed!
<doublec> autodidaddict: any thoughts you have on improving the learning docs appreciated!
<autodidaddict> I've been thinking about it. I'll jot some notes down once my compiler rage has subsided
jemc has quit [Ping timeout: 255 seconds]
https_GK1wmSU has joined #ponylang
https_GK1wmSU has left #ponylang [#ponylang]
<doublec> hmm, actor@ and compilation to C seems to be broken on my system
<doublec> it looks like pony_start is failing if the library parameter is set to false
<doublec> and it's failing because ponyint_serialise_setup is failing in the runtime
<doublec> dlsym(RTLD_DEFAULT, "__PonyDescTableSize") is returning NULL
<SeanTAllen> can you open a ticket doublec ?
<doublec> possibly because it's not using dlopen first
<doublec> SeanTAllen: will do
amclain has quit [Quit: Leaving]
<doublec> Possibly I'm not compiling with the right flags to the c compiler actually
<doublec> aha fixed
<doublec> I needed "-rdynamic" to the C compilation command
<doublec> https://github.com/doublec/pony-clib-example works now on linux at least
aceluck has joined #ponylang
plietar_ has quit [Remote host closed the connection]
plietar has joined #ponylang
plietar has quit [Ping timeout: 255 seconds]
jemc has joined #ponylang
jemc has quit [Client Quit]
jemc has joined #ponylang
Candle has quit [Ping timeout: 240 seconds]
Candle has joined #ponylang
plietar has joined #ponylang
jemc has quit [Ping timeout: 248 seconds]
aceluck has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
samuell has joined #ponylang
vaninwagen has joined #ponylang
Matthias247 has joined #ponylang
aceluck has joined #ponylang
vaninwagen has quit [Ping timeout: 240 seconds]
vaninwagen has joined #ponylang
MaybeDragon has joined #ponylang
plietar has quit [Remote host closed the connection]
plietar has joined #ponylang
vaninwagen has quit [Ping timeout: 240 seconds]
plietar has quit [Ping timeout: 246 seconds]
vaninwagen has joined #ponylang
vaninwagen has quit [Remote host closed the connection]
plietar has joined #ponylang
plietar has quit [Ping timeout: 240 seconds]
vaninwagen has joined #ponylang
Arjan has quit [Quit: bye]
Arjan has joined #ponylang
Arjan has quit [Client Quit]
_andre has joined #ponylang
plietar has joined #ponylang
plietar has quit [Ping timeout: 255 seconds]
dtz has quit [Ping timeout: 246 seconds]
ada[m] has quit [Ping timeout: 240 seconds]
M-hrjet has quit [Ping timeout: 255 seconds]
katafrakt[m] has quit [Ping timeout: 255 seconds]
irx[m] has quit [Ping timeout: 276 seconds]
mindB has quit [Ping timeout: 240 seconds]
srenatus[m] has quit [Ping timeout: 264 seconds]
vaninwagen has quit [Ping timeout: 240 seconds]
jmiven has quit [Quit: co'o]
jmiven has joined #ponylang
srenatus[m] has joined #ponylang
aceluck has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mindB has joined #ponylang
M-hrjet has joined #ponylang
dtz has joined #ponylang
irx[m] has joined #ponylang
katafrakt[m] has joined #ponylang
ada[m] has joined #ponylang
jemc has joined #ponylang
dougmacdoug has joined #ponylang
Praetonus has joined #ponylang
plietar has joined #ponylang
plietar has quit [Ping timeout: 240 seconds]
aceluck has joined #ponylang
<SeanTAllen> aceluck: we closed one of your issues-- https://github.com/ponylang/ponyc/pull/2117
<emilbayes> Shouldn't this have said "formal specification" and not "formal verification"? https://twitter.com/InfoQ/status/892391990318567426
<SeanTAllen> the pony type system has a proof showing its soundness
<SeanTAllen> but in the context of that
<SeanTAllen> they talk about formal verification as one of the topics
<SeanTAllen> and about garbage collection in general
<SeanTAllen> and about Pony's design
<emilbayes> SeanTAllen: Ah ok! Have been watching a lot of pony talks about the philosophy over the last two days and Sylvan keeps emphasizing that there is not yet a formal verification but that the type system and gc is formally specified :)
<Praetonus> emilbayes: I think he means that the type system and GC are sound but that the actual implementation isn't formally verified
<SeanTAllen> yes
<emilbayes> ah ok! He mentions a "Hand proof" of the type system in the MS Research talk too
<Praetonus> emilbayes: It's in this paper: https://www.doc.ic.ac.uk/%7Escd/fast-cheap.pdf
<emilbayes> Praetonus: Oh wow, what is that notation?
<emilbayes> ah okay, he defines it in the paragraph before
<emilbayes> I don't think I'm ready for the paper yet :)
dougmacdoug has quit [Ping timeout: 276 seconds]
<jmiven> emilbayes: there is also a Morning Paper article about it: https://blog.acolyer.org/2016/02/17/deny-capabilities/
<emilbayes> jmiven: Thanks! That's the one with the graphic he keeps showing :)
<jmiven> indeed!
_whitelogger has joined #ponylang
aceluck has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
plietar has joined #ponylang
amclain has joined #ponylang
plietar has quit [Ping timeout: 276 seconds]
endformationage has joined #ponylang
<autodidaddict> shocker. I'm having trouble converting a ref into a val :(
<jemc> autodidaddict: `ref` can only become `val` if it originates from an isolated context (a `recover` block)
<autodidaddict> yeah, recovering isn't working. I cannot recover from my stupidity
<jemc> if you share details, I can assist
<autodidaddict> at the moment my error actually causes a "should be sendable" failure in the stdlib json source :(
<autodidaddict> here's the response class:
<jemc> autodidaddict: the error message says "right side must be a subtype of left side", and the extended info says "Response val is not a subtype of Response ref: val is not a subcap of ref"
<autodidaddict> yep. I see that error message all day every day
<autodidaddict> and nothing about it helps me fix the problem :(
<jemc> your line looks like: `let r: Response = recover val Response(...) end`
<jemc> it should be `let r: Response val = recover val Response(...) end`
<autodidaddict> yeah that wouldn't compile before either. I usually try 100-200 permutations of random troubleshooting before using this chat
<autodidaddict> annnnd now the function I fixed last night by making it a ref fails
<autodidaddict> FFS
<jemc> I can only help with the errors you show me - the change I suggested will fix that particular error, but I can't guarantee there aren't other errors in your application
<autodidaddict> the tests were all passing last night
<autodidaddict> now that I fixed this one thing, it made my tests from last night not compile
<autodidaddict> woohoo
<autodidaddict> the map appears to want a ref
<autodidaddict> but I'm giving it a val
<SeanTAllen> how is the map defined?
jimdopango has joined #ponylang
<autodidaddict> same as it was last night
<autodidaddict> when it worked ;)
<jemc> autodidaddict: that error message is telling you that `to_jsonobject` is a `fun ref`, and you're trying to call it on a `val` reference, which is not allowed
<autodidaddict> yes that's what I just said
<autodidaddict> sorta
<jemc> in other words, it's telling you that you're trying to call a mutation method on an immutable reference (`Error val`)
<autodidaddict> I made that function a "fun ref" last night, and that fixed all the problems I had last night
<autodidaddict> no clue how to fix this one
<autodidaddict> I guess I want to make "e" a ref just long enough to call to_jsonobject on it
<SeanTAllen> i think i see the root of your problem autodidaddict
<autodidaddict> lackabrainz?
<autodidaddict> I've already made Error a val
<autodidaddict> oh, nevermind it isn't
<autodidaddict> I did about 20 minutes ago on one of my many fruitless attempts
<autodidaddict> so what's the root of the problem?
<SeanTAllen> well im not sure
<SeanTAllen> so in Error
<SeanTAllen> this JsonType that is the data field
<SeanTAllen> what's the purpose of that?
<SeanTAllen> should that be mutable or immutable?
<autodidaddict> it's an arbitrary value that I need to potentially pass back to a JSON-RPC 2.0 client. it's part of the spec
<autodidaddict> immutable, like everything else
<SeanTAllen> i officially hate these Json classes
<autodidaddict> I match on an error val .. so I need to either make error a val (which I can't, because as I discovered last night, I can't manipulate maps from inside a fucntion without it being a ref)
<autodidaddict> the json classes are not causing my problems
<autodidaddict> I match an error val, and I need to invoke a method on an error ref.. so how do I temporarily get an error ref to call that function ?
plietar has joined #ponylang
<SeanTAllen> autodidaddict: this isnt true " (which I can't, because as I discovered last night, I can't manipulate maps from inside a fucntion without it being a ref)"
<SeanTAllen> you made the to_jsonobject a fun ref last night right?
<autodidaddict> yes
<SeanTAllen> right
<SeanTAllen> that wasnt because you need it to manipulate the map
<autodidaddict> if I remove the ref it creates a few million other compile errors
<SeanTAllen> yes
<SeanTAllen> did you look at my gist?
<SeanTAllen> the problem is not with manipulating a map
<SeanTAllen> thats a local variable
<SeanTAllen> the problem is the JsonType field
<autodidaddict> yeah that's what mine looks like now and it creates that giant pile of errors
<autodidaddict> compiles when I comment out the ob.data("data")
<autodidaddict> ... so how does one fix thaT?
<SeanTAllen> well its complaining about JsonArray which is one of the types in the JsonType union
<SeanTAllen> im looking at that at the moment
<autodidaddict> it smells like some of the types in the union are ref and others aren't
<autodidaddict> but I don't know what I'm doing
<SeanTAllen> no that is exactly what it is
<SeanTAllen> im really unsure why this is the way it is
<SeanTAllen> jemc: any idea why JsonType has "String val" but then "JsonObject ref" and "JsonArray ref" ?
<autodidaddict> JsonObject and JsonArray are both mutable. One holds a map inside the other holds an array
<autodidaddict> the JsonXXX types each have a `data` field
<SeanTAllen> something something i really dislike this API
<autodidaddict> and the data field is either a map or the array
<autodidaddict> I can't recover a JsonType into a val in that function... so I don't know how to set that output field
<SeanTAllen> so looking at this api
<SeanTAllen> it seems like this was done entirely to build up json
<jemc> SeanTAllen: I'm on the same page with you - the API is inconvenient in practice
<SeanTAllen> autodidaddict: i think you are mostly experiencing pain with an API that doesnt meet your needs
<SeanTAllen> im looking at this and going "wtf"
<SeanTAllen> so ok,
<SeanTAllen> autodidaddict:
<SeanTAllen> when you turn an error into a json object
<SeanTAllen> do you really want a mutable json type for your "data" field or do you want a string?
<jemc> when this subject has come up in the past, I've been of the opinion that in a language like Pony, JSON parsing should probably take place in a collaborative/tokenized context, rather than deeply parsing the entire structure
<autodidaddict> it needs to be arbitrary. I don't care about mutable
<SeanTAllen> what does "it needs to be arbitrary" mean?
<autodidaddict> the JSON RPC 2.0 spec allows for the "data" field on the "error" object to be primitive or structured
<autodidaddict> it can be 12, "12", "foo", or ["foo", "bar"]
<SeanTAllen> right but...
<SeanTAllen> by the time we are here
<SeanTAllen> it would be the string representation of that, yes?
<autodidaddict> no.
<SeanTAllen> i dont understand
<autodidaddict> from the spec:
<autodidaddict> I'm thinking of just letting this data field be omitted ;)
<SeanTAllen> i would do that for now
<SeanTAllen> im stuck on helping you with some examples of what is in a data field and what a serialized error object looks like
<SeanTAllen> jemc: i agree. that json parser is awful and i dont think it makes much sense.
<autodidaddict> the serialized error object is easy, I already have that
<autodidaddict> it was just that data object that I couldn't do
<SeanTAllen> actually i know it makes no sense
<autodidaddict> I now have a functioning JSON RPC 2.0 method dispatcher
<SeanTAllen> autodidaddict: i will say this, the Json api is confused and is going to cause you pain
<SeanTAllen> i would "get it working"
<SeanTAllen> and then we should look at creating a replacement Json API
<SeanTAllen> this one is going to torture new folks
<SeanTAllen> ive never used it for anything of any size
<autodidaddict> unused APIs might as well not exist
<SeanTAllen> i didnt say it was unusued
<SeanTAllen> i said i have never used it
<SeanTAllen> i dont know who has or hasnt used it
<SeanTAllen> i think jemc has
<autodidaddict> I know. I'm just pointing out you only figure out what an API "feels" like when you have to use it for a real project
<SeanTAllen> right
<SeanTAllen> someone might have
<SeanTAllen> and then they have a high pain threshold
<SeanTAllen> jemc: id love to chat sometime about a new json api and your thoughts
<autodidaddict> OMG it's like a nightmare that never ends:
<autodidaddict> someone else would've had this library written in 12 seconds
<autodidaddict> getting an error saying I can't recover to that capability (val)
<autodidaddict> so I can't make this Request ref a val in order to send it to the dispatcher
<endformationage> SeanTAllen said reagarding a book: 'i would start with data sharing and concurrency'
<endformationage> ^ I've learned more about the isues/problems around sharing/concurrency from pony than from all my previous encounters in other languages.
<autodidaddict> still can't figure out how to make this ref a val.
<Candle> I used the json API for a recent minor task; it's pain was similar to using the basic Java json API; the org.json packages.
<autodidaddict> again, the problem I ran into now isn't json
<autodidaddict> trying to send an instance of my class to my actor
Matthias247 has quit [Read error: Connection reset by peer]
<SeanTAllen> you cant make a ref a val.
<SeanTAllen> ever.
<SeanTAllen> that is 99% true as a statement
<SeanTAllen> the only time you can
<SeanTAllen> is a ref that is coming out of a recover block
<SeanTAllen> Candle: if you have thoughts on a good pony json api, id love to hear them
<SeanTAllen> folks who are the early explorers can hopefully drive some much needed improvements
<autodidaddict> so the thing I want to do is physically impossible?
<endformationage> at it's birth, so to say
<autodidaddict> i made my Request class a val
<autodidaddict> ... which then generates a compiler error _in the stdlib_ and not in my code
<autodidaddict> :(
<SeanTAllen> i think you want it to be a val autodidaddict
<SeanTAllen> thats a good thing
<autodidaddict> yeah, but _nothing compiles_
<autodidaddict> it doesn't even tell me what line of code is causing the problem
<SeanTAllen> do you ever update a Request?
<SeanTAllen> is it being always immutable the correct thing tod o?
<autodidaddict> why the hell is the compiler pointing at stdlib and not my code?
<SeanTAllen> one thing at a time: "is it being always immutable the correct thing to do with request?"
<autodidaddict> yes
<SeanTAllen> ok
<SeanTAllen> godo
<SeanTAllen> so class val Request it is
<SeanTAllen> can you push this specific code to your repo on a branch
<SeanTAllen> and tell me the branch?
<autodidaddict> yeah hang on
<SeanTAllen> then i have to get back to work
<SeanTAllen> vroom vroom
<SeanTAllen> well that would be frustraintg
<endformationage> doublec: Great new article btw, much appreciated. Helped me understand viewpoint adaptation and subtyping a bit more!
<SeanTAllen> well taht is a bad error message
<SeanTAllen> jfc
<SeanTAllen> i hate the json package
<SeanTAllen> so autodidaddict its complaining in a very poor way about the params field of Request
<SeanTAllen> and JsonType maybe being mutable
<autodidaddict> ugh. it never even flagged that field
<autodidaddict> in an error message
<autodidaddict> what's the workaround/fix?
<SeanTAllen> my flippant answer is write a new json library
<SeanTAllen> working on the non-flippant answer
<autodidaddict> my flippant reply: Because this has been so much fun up until this point?
<autodidaddict> If I thought I could do it without murder, I'd write a new JSON library myself. But, my current average is no more than 6 new lines of code per indecipherable refcap fail
<SeanTAllen> ok non flippant answer
<SeanTAllen> `
<SeanTAllen> type JsonType is (F64 | I64 | Bool | None | String | JsonArray | JsonObject)
<SeanTAllen> `
<SeanTAllen> i don't know how to get around JsonArray and JsonObject being ref without massive amounts of trouble
<SeanTAllen> I dont see how JsonType is useful outside of the Json package itself
<SeanTAllen> i think
<autodidaddict> we don't even have a serializer
<SeanTAllen> someone could try and work around this
katafrakt[m] has quit [Quit: idle]
<SeanTAllen> i think their time would be better spent making a better api
<SeanTAllen> jemc has worked with this API i think
<SeanTAllen> he might have some better suggestions than me
<SeanTAllen> i would have to spend a good amount of time looking at this
<SeanTAllen> at the moment i don't have that time
<SeanTAllen> sorry autodidaddict
<autodidaddict> not your fault
<SeanTAllen> i know this is frustrating
<autodidaddict> I only had my lunch hour to look at this ;)
<SeanTAllen> i am frustrated because i know you are trying to get a language server protocol server working
<SeanTAllen> which would be a huge boon the the community
<SeanTAllen> jemc has put thought into how a json api could work well in Pony
<SeanTAllen> i think we should get feedback from him and step 1 is a json librarty
<SeanTAllen> which i can help you with
<SeanTAllen> we can do a repo and you can make me a collaborator and i can work on it with you
<SeanTAllen> if you are up to it (although i have many competing concerns on my time)
<jemc> the summary is that I think that a more useful JSON parsing library would be a tokenizing "cursor" into the JSON data
<jemc> which could be a persistent data structure, lazily loaded instead of eagerly
<jemc> how this new parsing API would relate to a JSON *writer* is a bit more complicated of a question
<autodidaddict> hopefully more fun than the tokenizing cursors used for XQuery/XPath traverals from back in the day
<autodidaddict> those APIs were awful
<jemc> I don't think a string-based path traversal like xpath would be very idiomatic in Pony - we'd want to stick to API patterns that can be statically typechecked
<autodidaddict> of course we're all spoiled. We can just create structs in Go, annotate the fields, and serialize an entire graph
<autodidaddict> I haven't used a low-level json object API in at least 18 months
<jemc> this is one of the main places where I think Pony needs macros
<jemc> but for now, those needs can be fulfilled (somewhat clumsily) with code generation
<autodidaddict> yeah the Rust serialization macros / libraries (e.g. serde) are very powerful
<jemc> that kind of feature is actually one of my most important goals (as I see it) with working on ponycc (the pony compiler in pony)
<SeanTAllen> i use "while" loops so often i had to go look up the syntax just to make sure
<autodidaddict> The cursor would have to have some kind of controller on top to allow people to refer to things as simple key-value pairs like regular JSON libraries. Forcing everyone to move the cursor forward manually would be a stretch
<autodidaddict> and you'd have to avoid the performance hit of re-scanning from the beginning each time someone wants to pull a given key off a level in the tree
ta3ta1 has joined #ponylang
<ta3ta1> Hi, I see your struggle about json-rpc library from public logs
<ta3ta1> that's all :)
ta3ta1 has quit [Quit: Page closed]
<cquinn> Is the developer sync happening on https://zoom.us/j/527527223 ?
<cquinn> oh, ha. my bad. wrong day
<autodidaddict> ta3ta1: thanks for all the input.. this cleared up a bunch of stuff. I still can't set the data field on an error without massive compilation failure, but that's okay
plietar has quit [Remote host closed the connection]
plietar has joined #ponylang
<SeanTAllen> jemc: you around
<SeanTAllen> ?
<jemc> SeanTAllen: yeah, around, though not undivided :D
<SeanTAllen> ill try you later when you are undivided if i havent reached a conclusion by then
samuell has quit [Quit: Leaving]
<SeanTAllen> ooo sylvan is home, im going that route for a duck/bouncer
<autodidaddict> no joke.. I add 2 lines, I get a massive failure.
<autodidaddict> I'm so done
plietar has quit [Ping timeout: 276 seconds]
<autodidaddict> all I want to do is call h.(pass?) if the promise is fulfilled, and h.fail("boo") if the promise is rejected
<autodidaddict> I can't get the lambda syntax to work
<jemc> show me the version with the lambda syntax, and the error you get
<autodidaddict> I can't even write the lambda syntax
<autodidaddict> the partial application is the error message above
<autodidaddict> here's one hideous version of the lambda syntax:
<autodidaddict> if anybody needs me, I'll be re-learning BASIC
<jemc> > show me the version with the lambda syntax, and the error you get
<autodidaddict> you asked for it:
<jemc> okay, so the error is telling you that your lambda has the wrong signature, and it's telling you the ways in which it's wrong
<jemc> for one part, the lambda needs to have an `iso` object cap rather than `ref` - you can accomplish this by putting `iso` after the closing `}` of the lambda
<jemc> that's what this message is telling you: "{(Promise[Response val]): None} ref is not a subtype of Fulfill[Response val, None val] iso: ref is not a subcap of iso"
<jemc> the other problem is that your parameter signature is wrong - you're accepting a `Promise[Response val]` param, but you should be accepting a `Response val` param
<jemc> that's what this message is telling you: "parameter Promise[Response val] tag is not a supertype of Response val"
<jemc> note that once I finish implementing this RFC both of those pieces could be omitted/inferred
<autodidaddict> sorry.. I missed an iso
<autodidaddict> though it doesn't actually work
<autodidaddict> I can do h.fail in either the pass or fail branch of the promise and the test passes
_andre has quit [Quit: leaving]
<jemc> are you using the `long_test` feature of the test suite, to mark that your test is not synchronous?
<jemc> if you don't mark it as a "long test" (an asynchronous test), the test suite will count it as passed if it has no failures when the function returns
<jemc> so you have to mark it as a "long test", and you have to mark it as "complete" when you receive fulfillment of the promise
<jemc> otherwise the test suite has no way of knowing that you're still waiting for something
<autodidaddict> the docs for long_test are nearly non-existent
<autodidaddict> the testing part of the tutorial doesn't even give me the method signature
<autodidaddict> `fun long_test(timeout: U64)`
<autodidaddict> what unit is timeout? seconds? milliseconds?
<autodidaddict> nanos?
<autodidaddict> added a timeout, my test is now deterministic
<autodidaddict> this is, imho, ugly code. And it'll very easily fail the "6 month smell" test.. (work on a different project for 6 months, come back... can you actually read the code you wrote?)
<SeanTAllen> autodidaddict: nanos
<autodidaddict> upside is if you want to build a json rpc 2.0 server you can
<SeanTAllen> note the last line in the method:
<SeanTAllen> ```
<SeanTAllen> The timeout is specified in nanseconds.
<autodidaddict> I didn't pull up the source code
<SeanTAllen> did that not make it into the stdlib docs?
<autodidaddict> searching stdlib is like the "I feel lucky" button on Google
<SeanTAllen> autodidaddict: nice on the build the server
<SeanTAllen> if you have suggestions for improvement, a couple folks are working on those
<autodidaddict> SeanTAllen: meh. Nobody's going to use it
<SeanTAllen> i put a lot of work into getting them into the state that they are
<SeanTAllen> so "i feel lucky" is somewhat insulting
<SeanTAllen> there are other people on the end of your frustration
<SeanTAllen> please keep that in mind
<autodidaddict> I'm not insulting anyone. I've built docs using those template generators before, so I know how limited they are.
<autodidaddict> and the docs are by no means a reflection of anyone here
<autodidaddict> if there is frustration, it's at the suckiness of the overall state of static site generators
<autodidaddict> the gitbook search is marginally better than the ones you get with stuff like hugo, etc
<autodidaddict> the biggest issue with search is if you search for a fairly common function name, you get 500 results and cannot differentiate them - the index doesn't contain the class/trait/actor etc
<autodidaddict> when you search Godocs for something common like "Find":
<autodidaddict> you get the dot notation that shows you package, type, and then method. This context is missing in our docs
<autodidaddict> the "feeling lucky" comment was in regard to having to randomly choose a link and hope that it's the method you were looking for
<SeanTAllen> the "our docs" makes me smile
jemc has quit [Ping timeout: 258 seconds]
jimdopango has quit [Quit: Page closed]
MaybeDragon has quit [Ping timeout: 240 seconds]