<FromGitter>
<hello2dj> cause Struct is abstract class
<FromGitter>
<hello2dj> yeah i see it already
<FromGitter>
<hello2dj> if i want to lookup if a value is_a? Struct, it will be a problem, cause i can't define a Union to contains all Strcut type
<FromGitter>
<hello2dj> Union(Nil | Bool | Char | Number | Symbol | Pointer | Tuple | StaticArray | Reference)
<FromGitter>
<j8r> You RPC lib, what types it support?
<FromGitter>
<hello2dj> but 'struct Mem ... end can't not
<FromGitter>
<rishavs> Need some help with the db api returning composite types. For example, my query uses a json_object_agg function. ⏎ My expected result for this is an array returning Array of json objects. How do I map it to a return type? ⏎ This is what I am trying to do; ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5bf3ea5f4f4bb579f3a596c3]
<FromGitter>
<hello2dj> o, it support Class and primitives
<FromGitter>
<hello2dj> but i really want to know how to represent Struct now
<FromGitter>
<j8r> can you show me a piece of code?
<FromGitter>
<hello2dj> what's the 'as type' mean? @rishavs
<FromGitter>
<hello2dj> what's the 'as type' mean? @rishavs
<FromGitter>
<rishavs> I checked your comment. Sorry but I am completely off the base. I thought you wanted to send data from your go program to crystal and were having issues with the type mapping
ua has quit [Ping timeout: 244 seconds]
ua has joined #crystal-lang
marmotini has joined #crystal-lang
marmotini has quit [Remote host closed the connection]
marmotini has joined #crystal-lang
marmotini_ has quit [Ping timeout: 240 seconds]
marmotini has quit [Remote host closed the connection]
marmotini has joined #crystal-lang
<FromGitter>
<rishavs> > Need some help with the db api returning composite types. For example, my query uses a json_object_agg function. ⏎ My expected result for this is an Array of json objects. How do I map it to a return type? ⏎ This is what I am trying to do; ⏎ ⏎ ```code paste, see link``` ... [https://gitter.im/crystal-lang/crystal?at=5bf3f483f9993b42673b7c79]
<FromGitter>
<vladfaust> @rishavs finally use an ORM?
<FromGitter>
<rishavs> T_T
rohitpaulk has quit [Ping timeout: 250 seconds]
<FromGitter>
<j8r> @hello2dj `.as MyType`? This restricts the restriction
<FromGitter>
<j8r> If the variable isn't of `MyType`, this will raise an exception. But usually it's better to use a custom type restriction with a if `var.is_a? MyType` to have a useful error
<FromGitter>
<hello2dj> golang is simple, crystal ... harder
<FromGitter>
<j8r> for me that's the contrary
<FromGitter>
<j8r> matter of taste
<FromGitter>
<j8r> golang spec may be simpler, but I find to be harder for the user to be DRY
<FromGitter>
<hello2dj> yes, but the golang's reflect is good, interface is good...
<FromGitter>
<hello2dj> yes
<FromGitter>
<hello2dj> i have to learn more about crystal
marmotini has quit [Read error: Connection reset by peer]
marmotini_ has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 252 seconds]
<FromGitter>
<asterite> @Blacksmoke16 instance vars are known after the "finished" macro, because "finished" can add more instance vars
<FromGitter>
<Blacksmoke16> gotcha, what was that in regards to?
<FromGitter>
<bew> @asterite would be nice to have a hook that run after types are know, thus can only add methods (no new types)
<FromGitter>
<ilanusse> Hey guys
<FromGitter>
<ilanusse> I was wondering if you guys needed a Spanish translation for the docs
<jokke>
god damn alpine... why don't they accept the pull request already
<jokke>
ah ok
<jokke>
seems they're waiting for 0.27.1
<FromGitter>
<vladfaust> I'm trying to recreate an HTTP Server. I wonder why this code: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ I've gone through the server code but could not find anything interesting. Maybe some kind of magic socket switches? ... [https://gitter.im/crystal-lang/crystal?at=5bf423adb86c70503f5eb97a]
<FromGitter>
<vladfaust> I took a lot from HTTP server: https://github.com/vladfaust/crack. The main performance issue (tracked with commented lines) is reading from the request IO. What did I do wrong?
jemc_ has joined #crystal-lang
<jemc_>
in crystal, is it possible to run a Regex match starting at a particular byte offset in a String, without copying the bytes in the String?
<jemc_>
(trying to prevent unnecessary allocations in my parser)
<FromGitter>
<j8r> for parser often it's better to avoid regexes
<jemc_>
yeah, that's what I'm using for non-Regex matching
<jemc_>
I guess I'll just have to be less lazy and convert the rest of the Regex parts of my parser into proper PEG
FromGitter has quit [Remote host closed the connection]
FromGitter has joined #crystal-lang
marmotini_ has quit [Read error: Connection reset by peer]
marmotini_ has joined #crystal-lang
<FromGitter>
<vladfaust> Why is this code is 2 times slower than similar HTTP Server even when it's not actually reading from a request and writing a static string? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5bf42db21ad4155d3af50f2e]
<jokke>
you _really_ like reinventing the wheel :D
marmotini_ has quit [Read error: Connection reset by peer]
marmotini_ has joined #crystal-lang
<FromGitter>
<vladfaust> If speaking of TCPServer, it could be used outside of HTTP Server. And it's degraded performance would be confusing to a developer.
<FromGitter>
<vladfaust> Also `reuse_port` doesn't have an effect 😕
<FromGitter>
<vladfaust> Anyone?
<FromGitter>
<bararchy> @j8r so, an idea, how about adding `Address.local` or `Interface.address ` to hardware?
<FromGitter>
<bararchy> @vladfaust maybe because of peek
<FromGitter>
<vladfaust> Nope, replacing `io.peek` with `request = HTTP::Request.from_io(io)` doesn't change the result
<FromGitter>
<bararchy> @vladfaust what tcp settings are you using for sysctl.conf ? Maybe a few TCP tunning configs can speed it up
<FromGitter>
<vladfaust> How is it related to HTTP Server being faster?
akaiiro has quit [Ping timeout: 272 seconds]
akaiiro has joined #crystal-lang
<FromGitter>
<vladfaust> Oh, I got it. Single socket = single connection
<FromGitter>
<v9n> @wontruefree thank you. Let me try `cryn` ⏎ @j8r Thank you. I think I get the idea, basicall y define some kind of object with same interface but instead of store data into some buffer it just pipe out to browser
<FromGitter>
<v9n> let me try
<FromGitter>
<j8r> @bararchy for networks addresses? Also, I'm thinking to replace the file parsing logic by directly do system C calls. But then, we'll need to gen/bundle bindings. Maybe use https://github.com/performancecopilot/pcp ,don't know. Then this will be a new project different to hardware
<FromGitter>
<bararchy> @j8r yeha for network addresses, I just found my self in the need to programmable get the local address of the machine and its kinda sucky
<FromGitter>
<j8r> there is `/sys/class/net/`. Yes there are lots of files after the symlinks :o
marmotini_ has quit [Ping timeout: 245 seconds]
notdaniel has joined #crystal-lang
notdaniel has quit [Client Quit]
pbodev1 has joined #crystal-lang
<jokke>
crystal's markdown implementation doesn't support embedded html?
<FromGitter>
<7sedam7> same vars in ruby with Farady works normally: ⏎ `Faraday.new("#{BASE_URL}/#{API_VERSION}/items/get/list', headers: { "Cache-Control" => "no-cache", "X-Auth-Token" => API_TOKEN }).get`
<FromGitter>
<Blacksmoke16> whats the error you get?