I have the following code:
with Util.Serialise;
package body blah is
Reader : Util.Serialize.IO.JSON.Parser;
Mapper : Util.Serialize.Mappers.Processing;
end blah;
So the line where Reader is defined is fine with the compiler, however on the following I get the error Mappers not declared in Serialize.
Both packages are part of the Ada-Util installation, and in fact are in the same directory.
Is this a path issue? Have I used things wrongly? What's going on here?
You need to with Util.Serialize.Mappers; as well, if it's a child package.
You should also need a with Util.Serialize.IO.JSON;, don't know why you didn't get an error there
Probably Reader is considered as correct, because it is hidden by Mapper error.
Generally, in Ada you have to give the full package name if you want to have a package visible. Thus, your first two lines should be:
with Util.Serialize.IO.JSON;
with Util.Serialize.Mappers;
not just
with Util.Serialise;
In that situation, you enable package Utils.Serialize, not the two which you want.
Related
I'm developing a package in RStudio with usethis, trying to make use of best practices. Previously, I had run usethis::use_tidy_eval(). Now, I'm using data.table, and set this up by running usethis::use_data_table(). I get a warning,
Warning message:
replacing previous import ‘data.table:::=’ by ‘rlang:::=’ when loading ‘breakdown’
because the NAMESPACE contains the the two lines:
importFrom(rlang,":=")
importFrom(data.table,":=")
It turns out I no longer need usethis::use_tidy_eval(), so I'd like to revert it and in doing so get rid of the warning.
How can I undo whatever usethis helper functions do? Must I edit the NAMESPACE myself? How do I know what else was modified by usethis::use_tidy_eval()? What about undoing usethis::use_pipe()?
Unless you made a Git commit before and after running that code, there's probably not an extremely easy way. The two options I'd consider would be:
Read the source code of the function. This can require some hopping around to find definitions of helper functions, but use_tidy_eval looks like it:
adds roxygen to Suggests in DESCRIPTION
adds rlang to Imports in DESCRIPTION
adds the template R file tidy-eval.R
asks you to run document() which is what actually updates the NAMESPACE. You can find the lines added by looking for the importFrom roxygen tags in the template file.
To undo this, you should just be able to delete all of the above. However, you need to be a bit careful - e.g. if you import functions from rlang outside of tidy-eval.R, removing it from DESCRIPTION might prevent installation. Hopefully any such issues would be revealed by devtools::check() if they do happen.
The other option would be to get an older version of your package, run use_tidy_eval() and document() and then compare the changes. That will be more comprehensive and might catch things I missed above, but the same caveats about not being able to necessarily just reverse everything still apply.
Same strategy for use_pipe().
Sidenote: there are probably ways to adequately qualify different uses of := so that both can coexist in your package, in case that would be preferable.
Based off this link: https://reactiveui.net/docs/handbook/view-location/extending-iviewfor
Whenever I try to execute the code in the example using the RG.Plugins.Popup nuget I receive the following error: Fody: The Type MyType '1 has a on_PropertyName_Changed method (OnViewModelChanged) which is static.
My Code is exactly like the links code. Not sure why its causing this error to occur.
.... UPDATE....
Damn, So if anyone runs into this issue... my solution was removing the following weaver from the fodyweavers.xml file
<PropertyChanged/> --- REmove this line if added solves the problem!?
Why is this? Why does removing the above line solve the issue?
Below is my FodyWeaver file
<Weavers xmlns:"http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<PropertyChanged/>
<ReactiveUI/>
</Weavers>
I was just going to say. The code in the example is working because I use it. Your error points to ReactiveUI.Fody being the problem.
Can you provide a reproduction of what you had that was different from the sample?
I write
install.packages("geoR")
library(geoR)
.nlmP(f,parameters)
and it returns
Error: could not find function ".nlmP"
What to do?
I did what the first answer suggest, then it said
Error in get(".ind.prof.phi", pos = 1) : object '.ind.prof.phi' not found
Actually I think we're quick to judge here.
https://github.com/cran/geoR/blob/a516861572ad6be3c2452a7b187af946130cf439/inst/CHANGES
The CHANGES file specifies that .nlmP was supposed to be exported in 1.7-2 and looking through the history it was. It wasn't until 1.7-4 or 1.7-5 that it got commented out in the NAMESPACE file. There is a note "changes to fix issues on CRAN reported errors/warnings regarding namespaces and foreign calls" so it might have been a namespace issue but it does seem the author intended for the function to be exported.
It might make sense to contact the maintainer about this.
If you absolutely need this function you could install the latest version that had it exported.
library(devtools)
install_github("cran/geoR", ref = "74feb80")
Note that you won't have any of the changes made to the package after that commit.
With that said I'm fairly sure there are better packages for contstrained non-linear optimization so hopefully somebody comes along with a better answer to get at the actual root of your problem.
You must use geoR:::.nlmP(), because nlmP is not in the exported NAMESPACE for geoR.
As already mentioned I'm using the Atom text editor.
I'm currently working on a project written in c++. Of course it is desirable to jump to the definition of a function (in another project file), or other uses of this function (within the project). As far as I know this can be achieved with the packages I'll mention below. I want the package to display me the definition along with the path to the corresponding file which holds the definition and ideally the line where it occurs.
I'll welcome any comments and suggestions on how to solve the below mentioned problem(s) I have with (one of) the packages. Moreover I'm also thankful about pointers to possible solutions or posts concerning my problem(s), or how I can achieve this with another package.
Here is what I found / tried / did so far.
goto
Currently I'm using this package, although it is rather slow and does not show the arguments of the function as e.g. atom-ctags does, but it's the only package which displays me the files I need to see.
It shows me where the function is defined as well as where it is also used. However it does not show me the path to the file corresponding file it refers to.
atom-ctags
I also tried this package, building the tags is quite fast and moreover it show me the path to the file. But this package only lists the .cc files and not the .h files. It appears to me as if it only shows me the other uses but not the definition, which is obviously a problem.
I also tried generating the ctags myself and changing the command options in the settings of the package, unfortunately without any success.
Atoms built-in symbols-view
In order to get this to work, one needs to generate the symbols. This can be, for example, achieved with the symbol-gen package. However, it shows me some of the definitions, but also no .h files. Moreover, jumping to the definition results in a Selected file does not exist., therefore it is not usable at all.
goto-definition
Just for completeness, there is also this package. It does not work for me, since c++ is not supported but maybe others will find it useful.
symbols-plus
Again, for completeness, this should be a replacement for the atom built-in, but when disabling the build-in it does not show me any jump functionality nor is a short cut mentioned.
So, basically, nothing really works well. I have tried Symbol Tree View but it but barely works.
I'm trying to get package references resolved during a build, using GNAT Programming Suite (hosted on Win XP). In the Builder Results, I get errors like this one:
file "ac_configuration_s.ada" not found
Clicking on the error takes me to a line like this:
with
Ac_Configuration,
Dispense_Timer,
...
The first item (Ac_Configuration) isn't resolved, but the second item (Dispense_Time) is resolved. I have several others that do or don't resolve. All of the files in question (spec and body) are identified as source files.
When I hover my mouse over the line with the error, a popup shows up that offers this:
(Cross-references info not up to date. This is a guess.)
Ac_Configuration
local package declared at D_Ac_Config_S.Ada:85
The guess is correct, but I don't know how to use this. How do I get this to correctly build?
Update
Here is teh call to gcc
gcc -c "-gnatec=C:\Source\build\GNAT-TEMP-000001.TMP" -I- -gnatA
-x ada "-gnatem=C:\Source\build\GNAT-TEMP-000002.TMP" "C:\Source\C_Cbt_Main_B.Ada"
I don't see a reference to teh "miimal" switch.
In this case, there is no corresponding body file file D_Ac_Config_S.Ada. So the is no body file to compile separately.
When I right click on the package reference inside the with, I can goto the declaration of Ac_Configuration and every other package name that is the source of an error. So these lreferences are being resolved somehow.
By the way, I have not used ADA before, so I'm still trying to understand everything.
It looks as though you're using _s.ada as the suffix for specs, and I'm guessing _b.ada for bodies?
GNAT may have difficulty with this naming convention. It's possible, using a GNAT Project file (.gpr), to alter GNAT's default convention ({unit-name}.ads for specs, {unit-name}.adb for bodies) but the rules (see "Spec_Suffix") say "It cannot start with an underscore followed by an alphanumeric character" (I haven't tried this, but you can see that it would confuse the issue if you had a package Foo_S, for example).
LATER: It turns out that GNAT (GPL, 4.7, 4.8) is quite happy with your suffixes!
If the package Ac_Configuration is really a local package declared at line 85 of D_Ac_Config_S.Ada, then there's your problem; you can only with a library unit, which in this case would be D_Ac_Config.
with D_Ac_Config;
...
package Foo is
...
Bar : D_Ac_Config.Ac_Configuration.Baz;
I wonder whether D_Ac_Config_S.Ada (for example) actually contains multiple Ada units? (if so, compiling that file should result in a compilation error such as end of file expected, file can have only one compilation unit). GNAT doesn't support this at compile time, providing instead a utility gnatchop.
Would it be possible to just gnatchop all the source and be done with it?
Hm, I think it sounds like the compiler's got a bad set of objects/ALIs it's working with, hence the cross-reference not up to date error. (Usually the compiler's good about keeping things up to date; but you may want to check to see if the "minimal recompilation" switch is set for the project.)
Have you tried compiling just the ["owning"] file D_Ac_Config_S.Ada? (i.e. if it were a spec, go to the corresponding body and compile that.) That should force its ALI/object files to be updated.
Then try building as normal.
-- PS: you might have to clean first.