<FromGitter>
<girng> if i use crsfml, it binds crystal lang to SFML does that mean i can use any sfml extension as well?
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 246 seconds]
jhass has quit [Ping timeout: 260 seconds]
jhass has joined #crystal-lang
<FromGitter>
<Timbus> Hm, wouldn't it be better if `File.open` took the access modes as enums, for type safety? Also things like start position, and the 'binary' mode, couldn't they be named args?
<woodruffw>
@Timbus: IIRC there was some movement on unifying (or otherwise relating) symbols and enums that would make that a lot nicer, but as it is enums would probably make using `File.open` pretty tedious
<FromGitter>
<Timbus> I thought symbols now resolved to enums
<FromGitter>
<Timbus> in some cases
<woodruffw>
oh, did that change go through?
<woodruffw>
ah, 0.25 added support for enum literal symbols
<woodruffw>
i'd be a big fan of making `File.open`
<FromGitter>
<Timbus> All thats left is to turn symbols into frozen strings and the celebration can begin
<woodruffw>
*'s arguments more type-safe
<FromGitter>
<Timbus> Yeah the mode-string stuff just feels a bit old
<woodruffw>
agree completely...one possible issue is representing multiple flags; something like `File.open "foo", :read | :write` would be really pretty, but probably also new syntax
asterite has quit [Ping timeout: 264 seconds]
jhass has quit [Ping timeout: 252 seconds]
asterite has joined #crystal-lang
jhass has joined #crystal-lang
<FromGitter>
<Timbus> Yeah, it looks nice but I guess :r, :w and :rw are understandable and terse enough.
<woodruffw>
yeah, i was looking at the PR that added symbol -> enum support and it'd probably be a real pain
v2px__ has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
DTZUZO has quit [Ping timeout: 245 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
<FromGitter>
<j8r> I think this can Enum, and use it directly as an argument. This will bring compile time checking
Groogy1 has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
<FromGitter>
<drum445> Hi Guys, how do you all go about making HTTP requests, is there something similar to the requests lib that Python has?
<FromGitter>
<drum445> Seen HTTP::Client but does that allow you to send files over http?
<FromGitter>
<j8r> yeah bindings are pretty painless, just require the shard and have the `-dev` library and you're done. I think you best bet here is to go with RocksDB
<FromGitter>
<trashhalo> good feedback. thank you
<FromGitter>
<j8r> you're welcome @trashhalo , thanks for the Go link :) I've recently cgo to static link TiDB - I've to set `LDFLAGS='-linkmode external -extldflags "-static"'`
<FromGitter>
<j8r> and there is no ffi overhead for when including C on a Crystal project (unlike Go) :D
<FromGitter>
<trashhalo> Im not sure if thats the right way to do it
DTZUZO has quit [Ping timeout: 272 seconds]
<wontruefree>
so the crystal docs tool generates an html file but is there any way to get more or an `ri` type doc?
<wontruefree>
I was looking to not have a web browser when using docs
<wontruefree>
I am not sure if this is something someone else has already worked on
<z64>
wontruefree: not that i've seen. there is docs/index.json that is generated that you would have to parse. what i usually do is just grep lib/ inside my editor and just read them in the source code
<f1refly>
I plan on building a simple xmpp library for practice purposes. Is there a way i could use the OpenSSL module from the standard library to get starttls?
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 244 seconds]
<wontruefree>
z64: yeah I might build something. I have not looked through the json yet but that seems like a good place to start for a tool like that
<wontruefree>
it would be nice to be able to display the doc in an editor
<wontruefree>
at least the interface to the method
<wontruefree>
does anyone know of a plugin that does that?
<FromGitter>
<vladfaust> Hey @girng, you have GoDot avatar and writing in Crystal - are these things related? ;)
ua_ has quit [Ping timeout: 252 seconds]
<oprypin>
vladfaust, he's making them related, trying to use godot with a server in crystal
<FromGitter>
<vladfaust> Awesome. What's the progress?
<FromGitter>
<vladfaust> Ah, I thought writing game code in Crystal
<FromGitter>
<vladfaust> One day it would be possible
<oprypin>
what do u mean lol
<oprypin>
you can even write games for Windows in Crystal
<FromGitter>
<vladfaust> GoDot supports multiple scripting languages IIRC. Crystal could be one of them
<oprypin>
it's not scripting tho
<FromGitter>
<vladfaust> It doesn't matter, you understand what I'm saying
<oprypin>
although at this point this word doesn't even mean anything
ua has joined #crystal-lang
shalmezad has joined #crystal-lang
Groogy1 has quit [Ping timeout: 272 seconds]
<FromGitter>
<xababafr> Hi there. Is it okay to ask for help on the language here?
<FromGitter>
<j8r> I can't help you on that question @xababafr . I'm Kinding 😄 You're very welcome, ask anything about Crystal
<FromGitter>
<xababafr> I'm looking for a way to create a class that can contain a data of any type. I'm using a Generic : "MyContainer(T)" which contains a property data, with the same type T. but since at the initialization the data will be nil (the object is filled later), I used the notation "property : data : T?". My question is : at the instanciation, a MyContainer(Nil) class will be created, since my data object is nil,
<FromGitter>
... right? Then, if I write some data, lets say a Int32 into my container, will I get a MyContainer(Int32) ? ⏎ ⏎ I hope I'm clear... :(
<FromGitter>
<xababafr> thanks a lot for the welcome anyway :)
<oprypin>
xababafr, no, that is not correct. youre using `T` in a context with `T | Nil` but that doesn't affect T itself, it will still always be Int32
<FromGitter>
<xababafr> Wow, that's nice! thanks a lot! SImplifies what i'm trying to do quite a lot :)
<FromGitter>
<j8r> The type of its instance variable will be `T | Nil`
<FromGitter>
<j8r> Nils can be ennoying sometimes, depensing on your use case you might like to set a default value like `property data : Int32 = 0` for example
<FromGitter>
<xababafr> Well.. So, im creating a channel class : you instanciate the channel between two entities, and then, when you want to send data, I want my channel to be typed with the same type as the Data. But I mean, even the data itself is typed as T | Nil , it's not a big deal. I can just cast it to T with a if nil? right?
<oprypin>
right
<oprypin>
but prefer `if x` over `unless x.nil?`
<wontruefree>
+1
<FromGitter>
<xababafr> perfect ! thanks for you help !
<wontruefree>
unless is great to have in a language but in general if is more clear when I am reading code
<FromGitter>
<girng> @vladfaust lol oprypin saying the word "trying". i already have a 100% functional bidirectional server code (crystal lang) that works flawlessly with godot's client side tcp. it works great too, godot's tcp api works great with crystal's tcp!
<FromGitter>
<girng> i just had issues with the tcp_nodelay stuff that what causing my response time to be greater than normal. however, once u disable that for client and server, it's fine
<FromGitter>
<vladfaust> That's great
<FromGitter>
<vladfaust> However, writing a crystal server is a trivial taks
<FromGitter>
<vladfaust> I hope one day I could write a game on a mature engine using Crystal
<FromGitter>
<girng> yeah, i just have a lot of free time.. i like to spend it on crystal instead of going outside in the real world (partying, drugs, etc)
<FromGitter>
<girng> yeah,i was looking into crsfml but i might choose it for a new project, too invested in my current one in godot
<FromGitter>
<vladfaust> You could start implementing Crystal bindings for GoDot. Set up a Patreon or BountySource and when Crystal got released, you'll begin reaping a bounty from game devs
<FromGitter>
<girng> the thing that i like about crystal's tcp as a server, as making "messaging" out of a stream is far more simple, and more streamlined if you will. for example, gets/puts will use the delimiter `\n`, or, you can just do `socket.read_bytes(Int32)`. basically turns the stream into messages (previously i was using a websocket server, and it was far more easier for message parsing, however i heard there is a tiny bit
<FromGitter>
... of added latency)
<FromGitter>
<vladfaust> I'm thinking of why there's no system to collect donations and automatically resend a part to selected projects? E.g. if I collected donations for my OSS project on Crystal, sending a % to Crystal devs automatically. Or maybe Webpack devs could earn on every donation to a project which is using webpack?
<FromGitter>
<girng> yeah, am not sure. gdscript language they have is soo popular not sure it would be worth it lol. iuno how to do bindings and stuff, i'm a newb :D
<FromGitter>
<xababafr> @oprypin one last thing! when I define my data ( = my fifo) : "getter capacity : Int32, fifo : Array(T)?", shoukd I declare its type as Array(T) or Array of T ?
AndreasLutro has left #crystal-lang [#crystal-lang]
<FromGitter>
<bew> Array(T)
<FromGitter>
<vladfaust> Why is everyone so afraid of the money topic? Are we all robots without needs or all have rich daddies allowing us to do 24/7 what we like? What's bad on earning on what you love?
<FromGitter>
<girng> i don';t know if bounty hunters supports sending a percent to another project
<FromGitter>
<girng> bountysource*
<FromGitter>
<j8r> Talking about money, how goes the creation of the Open Collective Crystal account?
wontruefree has quit [Quit: bye]
OvermindDL1 has joined #crystal-lang
wontruefree has joined #crystal-lang
shalmezad has quit [Quit: Leaving]
zorp_ has quit [Ping timeout: 245 seconds]
<FromGitter>
<girng> man. i just exported my items table in mysql to csv instead of json... csv uses so much less data