samvera-deprecated / rdf-vocab

Shared RDF Vocabularies (rdf-vocab <= v0.7.0)
https://github.com/ruby-rdf/rdf-vocab
Apache License 2.0
4 stars 2 forks source link

Vocabs should be lazily loaded #53

Closed dchandekstark closed 9 years ago

dchandekstark commented 9 years ago

@gkellogg @acoburn We initially adopted different naming conventions and file organization from RDF.rb, which creates a few challenges. Given what we have now, I think the path of least resistance is to key off the config file. This would require adding non-generated vocabs to the config (#39), and probably making the keys reflect the require path relative to lib/rdf-vocab/vocab (e.g., changing "premis" to "premis/v1"). We also have one vocab file (fcrepo3) which include several vocab classes in a module, and we might have to break those out into separate source files.

As to the specific lazy loading strategy, I'm inclined to try const_missing rather than autoload, since Matz has declared the latter deprecated (https://www.ruby-forum.com/topic/3036681#1032667).

jcoyne commented 9 years ago

@dchandekstark you may be prematurely optimizing. That autoload thing isn't scheduled until ruby 3.0 which is scheduled to be delivered in 22 years: https://bugs.ruby-lang.org/versions/5

jcoyne commented 9 years ago

@dchandekstark also it seems like that issue was fixed: https://bugs.ruby-lang.org/issues/5653#note-28

dchandekstark commented 9 years ago

@jcoyne I try to plan ahead. :) autoload does make things a little cleaner, also makes manual listing a more palatable option, at least until we can sort out the naming issues.

dchandekstark commented 9 years ago

Lazy-loading will be implemented in https://github.com/ruby-rdf/rdf-vocab.