You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The default crystal init app foo template generates something like this:
require"./foo/*"moduleFoo# TODO: put your code hereend
That's probably OK for a library, but for an app there's no need to put the main code inside the module. Well, you can do that, but it's not common, and then some people are confused by this (they might want to define methods inside the module and call them, but that doesn't work (you have to use def self.), or you might wonder why you have to put that code inside that module).
I propose we remove that module Foo declaration in that file for apps, and simply generate something like:
require"./foo/*"# TODO: put your app code here
The text was updated successfully, but these errors were encountered:
I prefer to put app code in a module namespace as well, and only have a MyApp.run(ARGV) in the top level. This could also be provided by the template. But it doesn't really matter that much what the template produces, so I'm fine with this change.
So I like what you are saying I would also say specs depend on the module sapce.
require"./spec_helper"
describe Foodo# TODO: Write tests
it "works"dofalse.should eq(true)
endend
I like the idea of crystal init being very basic with flags to configure the setup. So the default generates shards, src, editorconfig, and gitignore. But you can build a project with flags for a test suite, shard dependencies, and CI.
The default
crystal init app foo
template generates something like this:That's probably OK for a library, but for an app there's no need to put the main code inside the module. Well, you can do that, but it's not common, and then some people are confused by this (they might want to define methods inside the module and call them, but that doesn't work (you have to use
def self.
), or you might wonder why you have to put that code inside that module).I propose we remove that
module Foo
declaration in that file for apps, and simply generate something like:The text was updated successfully, but these errors were encountered: