Replies: 11 comments 14 replies
-
I just ran in to 2 issues where namespacing would have helped. Working on an app for building out a computer with specs, and I wanted a model named Generating apps with a default namespace could help to solve these issues, I think. I'm not sure about the secondary level of namespace, but at least a top level would help. |
Beta Was this translation helpful? Give feedback.
-
This is a good point. It would also helps with class collisions because you'd always need to preface it with the namespace I have a few concerns/questions with this approach:
Any other thoughts/concerns with this approach? Any thoughts about this @edwardloveall? |
Beta Was this translation helpful? Give feedback.
-
Actually it looks like we can define top-level classes from within a class 🤯 class User
class ::User::BaseQuery
end
end
User::BaseQuery.new # Works So we could still have |
Beta Was this translation helpful? Give feedback.
-
I'm not particularly keen on the secondary level namespacing idea, though I can see how it could be helpful. What I was seeing was something more like: module MyBlogApp
class Admin::Users::Index < BrowserAction
end
end
module MyBlogApp
class UserQuery < User::BaseQuery
end
end In my use case, I could then do module FunApp
class Event < BaseModel
table :events do
end
end
end This makes |
Beta Was this translation helpful? Give feedback.
-
Ah I see. One issue I have with this is that it makes guides/tutorials strange because some people use |
Beta Was this translation helpful? Give feedback.
-
I'd be ok with a simple |
Beta Was this translation helpful? Give feedback.
-
I'm wholly unfamiliar with Lucky's codebase, but I read this issue and it sounded similar to a problem I had, so thought I would bring it up: I don't know what would be appropriate for Lucky, but when I ran into this I solved it by using a simple marker annotation to collect classes at compile time that are meant to integrate with the app. module MyWebsite
@[Lucky::App]
class Blog
# ..
end
end Anyway, just an idea 🙂 |
Beta Was this translation helpful? Give feedback.
-
I still don't understand annotations much. What would this do exactly? With lucky, you'd have something like class Event < Avram::Model
end but since you can't have a class named |
Beta Was this translation helpful? Give feedback.
-
Hm any concluding thoughts? |
Beta Was this translation helpful? Give feedback.
-
I've actually started using very custom namespaces because I have to share models between apps. I have 2 different models both named If we do decide to add this in, then I think default should be no namespace, and then some flag or maybe just the syntax itself.
But I'll defer to @paulcsmith on this one. |
Beta Was this translation helpful? Give feedback.
-
While not 100% related, I also ran into a namespace issue just now. One of the sections in my app is under |
Beta Was this translation helpful? Give feedback.
-
This is a just a suggestions but I thing it would be much cleaner and less error prone if all generated code would be namespaced at least to the application name. Even more preferable in my opinion would be further namespacing by
Models
,Pages
,Actions
etc.Beta Was this translation helpful? Give feedback.
All reactions