Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 19 18:56
    asterite ready_for_review #12405
  • Aug 19 18:56
    asterite edited #12405
  • Aug 19 17:43
    asterite labeled #12405
  • Aug 19 16:38
    Blacksmoke16 labeled #12405
  • Aug 19 16:38
    Blacksmoke16 labeled #12405
  • Aug 19 16:02
    asterite synchronize #12405
  • Aug 19 16:01
    asterite opened #12405
  • Aug 19 15:34
    kramerul synchronize #12404
  • Aug 19 15:23
    kramerul synchronize #12404
  • Aug 19 15:13
    kramerul synchronize #12404
  • Aug 19 15:10
    kramerul synchronize #12404
  • Aug 19 15:08
    Blacksmoke16 labeled #12404
  • Aug 19 15:08
    Blacksmoke16 labeled #12404
  • Aug 19 15:08
    Blacksmoke16 labeled #12404
  • Aug 19 15:06
    wonderix opened #12404
  • Aug 19 14:20
    asterite closed #12403
  • Aug 19 12:42
    straight-shoota milestoned #12403
  • Aug 19 12:42
    straight-shoota milestoned #12403
  • Aug 19 12:03
    asterite synchronize #12403
  • Aug 19 11:34
    straight-shoota closed #11420
Kent 'picat' Gruber
@picatz
I love ruby, a lot.
Weston
@wwselleck
i want to love ruby, but have always been turned off by the speed
Kent 'picat' Gruber
@picatz
There's also some really nice debugging support that I miss when developing crystal.
Ruby's speed has come into play a handful of times in my life.
But, usually I just like the syntax compared to something like go
Weston
@wwselleck
oh i use go at work and do not like it at all
Kent 'picat' Gruber
@picatz
I love the crystal takes the best of both worlds in a way
Weston
@wwselleck
i tried making that "my" language, but just coudlnt
Kent 'picat' Gruber
@picatz
I've done some weird stuff like doing go bindings to ruby.
Weston
@wwselleck
its just tooo bare bones. Just to make a data type sortable takes like 50 lines.
Kent 'picat' Gruber
@picatz
I think Crystal does everything go does better ( in my opinionated opinon )
Feel free to make issues or whatever as you find them and we can address them on github / put that shiz into version control
Even if you have questions for how something works.
That way, if someone else had a similar question, at least it'd be documented.
This would be triggered using ./myprogram --read
?
Kent 'picat' Gruber
@picatz
it'd be $ruby app.rb --read file.txt
for that one
( I'm dumb sometimes, sorry :smile: )
I'd like to add :file type I'd think
That way I can have a nice little wrapper for when users are working with files perhaps.
It'd be an opt-in thing, where they could just use :string and then open the file.
But, I'd like for a :file type to have some sort of builtin helper method to abort if the file doesn't exist or something maybe.
Weston
@wwselleck
command :hello do
  flag "hello"
is the flag redudant there
Kent 'picat' Gruber
@picatz
The flag would probably be redundant there, yeah.
Don't forget the end of course ;)
The command :index is used to basically be able to reference the command object elsewhere in the app.
commands and options ( which are direct subclasses of commands ) are indexed in hashes basically.
the index ( key ) being the :index symbol you give it.
The index is also used as the default flag if not specified otherwise.
I've sort of recently adopted that.
But, I'm cool with it. I think it makes things simpler without adding too much complexity. I think.
In practice there wouldn't be a big problem being redundant if people didn't know and always set the flag
I almost never use the flags block in my examples
There you can explicitly set short and long flag types.
I gotta go do some stuff, but I'll be back later :v:
Weston
@wwselleck
l8r
Weston
@wwselleck
oh boy this whole block/yield stuff is going to take some practice.
it seems similar to nodeish callbacks on the surface, but they're used very differently it seems
Kent 'picat' Gruber
@picatz
It's not too bad, but takes some getting used to: https://gist.github.com/picatz/7f280bea5b8cf05491df95fbb445d78c
You can do some nifty things with blocks.
Best thing to do is load up crystal play and play around with stuff.
For really small examples.
Stephan Langeveld
@Fanna1119
whats the difference between block one and 2 ?
1.upto(100) do |x|
    puts x
end

1.upto(100) {|x| puts x}
Kent 'picat' Gruber
@picatz
Basically a do can be a { and a end can be a }.
So, my understanding is, basically nothing.
Stephan Langeveld
@Fanna1119
@picatz ahh thank you :), coming from a non ruby background. i am still in the phase where i don't what works and what doesn't as well as not sure what is the "right" way of doing some things just yet haha
Kent 'picat' Gruber
@picatz
No worries :+1: