I am having difficulties finding an answer to the following syntax in reasonml
module A = B;
This is defined at the top of the .re file and I do not know where B is coming from.
EDIT:
When I try to log both A and B, with Js.log I get an error with the compiler saying a constructor cannot be found.
This is a module alias. It binds the name of an existing module referred to by the name B to the name A.
B can refer to any module in scope, and modules can be brought into scope in several ways. A module alias such as this is one way. It could also be a local submodule or a submodule of another module that has been opened. But most modules in scope will typically be toplevel modules, which are created from every source file visible when compiling the current code unit/module. For example, a file named foo.re will create a module named Foo.
See the Reason documentation and OCaml documentation on modules for more details.
Related
I am building a new recipe which contains python.
when doing bitbake foo, it pass without problem.
when building overall image, it shows this error:
nothing provides /bin/env needed by foo
Change the shebang of the python file from '/bin/env python' to the real path (e.g. /usr/bin/python'.
Here is the scenario (newbie to spark scala so kindly bear with me)
1) I have module A and a config file under resources folder. Class C in module A reads this config to get information about the file paths
2) i am trying to call Class C (module A) from Module B (after importing the dependencies of Module A in module B)
3) Issue i am facing is Class C (module) code when invoked from Module B , is using the config from Module B instead of its own config in Module A
Note : code works perfectly when i call with in Module A but once i move this code to Module B its using the resources file in Module B instead of Module A resource file.
both the configs have same name.
From the discussion in regard to my original answer, which assumed Lightbend Config (commonly used in the Scala world), it's been discovered that some sort of config.xml is in src/main/resources for the respective modules. These files both end up on the classpath and each module attempts (by an at this point unspecified means) to load the config.xml resource.
The JVM when asked to load resources always loads the first which matches.
The easiest way in a small set of projects to address this collision is to not collide by giving the configs in each project different names.
An alternative which is viable in a larger set of projects is to use Lightbend Config which allows config file inclusion out of the box, as well as the ability to use environment variables to easily override configurations at runtime.
An elaborate strategy for a larger set of projects, depending on how compatible the XML schemas for the various module's config.xmls are (if they're being read using a schema) is to define a custom Maven build process which embeds config.xmls inside one another so that code in module A and module B can share a config.xml: A only cares about the portion of the config which came from A and B only cares about that from B. I'm not particularly familiar with how one would do this in Maven, but I can't think of a reason why it wouldn't be possible.
I can't recall if this stopped working at some point or has always been this way. When I develop powershell modules I would like to be able to load them explicitly from my local repo directory to make sure everything is working properly. MSDN indicates this should work, however I get the error:
"The specified module .\SomeModule was not loaded because no valid module file was found in any
module directory. FileNotFoundException"
I would expect this is because it can't find the psm1 file in the directory but I can't understand why. I can load the module by referencing the psm1 file directly but this excludes anything being loaded by the manifest. I can also copy the module to one of the standard module paths and it will load correctly. This is what I've been doing as a work around but I'd love to get this figured out. TIA
**Update: Ran process monitor while running the import command. Interesting results. Seems like it may just be a powershell bug.
You can load the module by referencing the module manifest file (.psd1) directly, which will then ensure any dependencies are loaded.
I'm confused as to how PowerShell modules work.
I have downloaded and copied a module from a blogger. I've unblocked and extracted the .zip to %USERPROFILE%\Documents\WindowsPowerShell\Modules\SomeModule
In this folder is a .NET assembly that the module uses, but doesn't not contain compiled CmdLets. Instead, the commands are functions in a .psm1 file and a .psd1 file describes the manifest.
If I open PowerShell, the functions are available and work but I want to add my own function, so I have added it, however I cannot see it. I've restarted all PowerShell instances, removed the module and imported it again.
As a test, I renamed an existing, working function. Interestingly, after remove and import the function disappears instead of adopting its new name. If I rename it back (just a single character change) and remove/import then it appears again.
I use help blahblah to list all commands in a set, since they all have the same prefix. The manifest exports all (*) functions. Clearly I don't understand how these type of script modules work, the functions are all listed even after I run Remove-Module! I've written a compiled module before in C# and that worked as expected.
What's going on? Why does renaming a function cause it to vanish? Thanks.
Found it. This line appears in some stuff I overlooked in the .psm1 file.
Export-ModuleMember X, Y, Z
So, I guess the manifest can overrule this or replace the need for it in a script? Who knows. Anyway, hope this helps someone.
I am using Eclipse Juno CDT for a class I am taking, but it is telling me it can't resolve types found in include files, and these aren't headers I wrote.
The program I wrote compiles and runs exactly as it should if I run it through g++ via the command line. The problem is that I can't debug in Eclipse because it doesn't recognize even basic types like string. Also, no code completion. It finds the include files just fine, I can open those and look at the contents, but it still won't resolve types.
I've seen lots of suggestions for people with similar problems, but those all turned out to be not finding the include files, which isn't my problem. Any suggestions?
Maybe the types are in a namespace and you're not qualifying them (and not using a using declaration).
You likely have included the proper directory for the headers themselves. On my system it is: /usr/include/c++/4.4.6/
However, you probably don't have the directory containing the definition of the macro _GLIBCXX_BEGIN_NAMESPACE. Without this macro definition eclipse does not know that the stl types are in the std namespace. On my system this macro definition is squirreled away beneath the main c++ dir. Try adding the following paths to your include list:
/usr/include/c++/4.4.6/x86_64-redhat-linux
/usr/include/c++/4.4.6/x86_64-redhat-linux/bits
If you're not on redhat look for something similar. You can go to /usr/include and run the following grep to look for the headers with the necessary macro definition:
grep -R -P "define\\s*_GLIBCXX_BEGIN_NAMESPACE\(" .