Skip to content

Instantly share code, notes, and snippets.

@jaytaph
Last active August 29, 2015 14:16
Show Gist options
  • Save jaytaph/a4c18c900b9b3c98f112 to your computer and use it in GitHub Desktop.
Save jaytaph/a4c18c900b9b3c98f112 to your computer and use it in GitHub Desktop.
search paths: [['.', './modules', '/usr/share/saffire/modules']]
/wwwroot/main.sf (namespace: '::')
----------------------------------------------
import io;
import framework;
import notexisting;
io.print("hello world");
framework.run();
----------------------------------------------
* import io; (import io class as alias io from module io)
* module io is an UQCN, so add namespace to it to create FQCN: ::io
* ::io is resolved to `io.sf`
* checking paths: ./io.sf, ./modules/io.sf, /usr/share/saffire/modules/io.sf
* cannot be resolved.
* change module "io" UCQN into the fallback module prefix: ::saffire::io
* ::saffire::io is resolved to `saffire/io.sf`
* checking paths: ./saffire/io.sf, ./modules/saffire/io.sf, /usr/share/saffire/modules/saffire/io.sf (found)
* resolved
* import framework; (import framework class as alias framework from module framework)
* module framework is an UQCN, so add namespace to it to create FQCN: ::framework
* ::framework is resolved to `framework.sf`
* checking paths: ./framework.sf, ./modules/framework.sf (found)
* resolved.
* import notexisting; (import notexisting class as alias notexisting from module notexisting)
* module notexisting is an UQCN, so add namespace to it to create FQCN: ::notexisting
* ::notexisting is resolved to `notexisting.sf`
* checking paths: ./notexisting.sf, ./modules/notexisting.sf, /usr/share/saffire/modules/notexisting.sf
* cannot be resolved.
* change module "notexisting" UCQN into the fallback module prefix: ::saffire::notexisting
* ::saffire::notexisting is resolved to `saffire/notexisting.sf`
* checking paths: ./saffire/notexisting.sf, ./modules/saffire/notexisting.sf, /usr/share/saffire/modules/saffire/notexisting.sf
* cannot be resolved.
* no more fallbacks. Throw "resolveException"
Directory layout:
./modules/framework.sf
./modules/framework/http.sf
./modules/framework/http/request.sf
./modules/framework/http/response.sf
/wwwroot/main.sf:
---------------------------------------------------------
import framework;
import framework::http;
import framework::http::request;
---------------------------------------------------------
./modules/framework.sf:
---------------------------------------------------------
import http;
import http::request;
---------------------------------------------------------
OR
---------------------------------------------------------
import framework::http;
import framework::http::request;
---------------------------------------------------------
./modules/framework/http.sf:
---------------------------------------------------------
import request;
---------------------------------------------------------
OR
---------------------------------------------------------
import http::request;
---------------------------------------------------------
OR
---------------------------------------------------------
import framework::http::request;
---------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment