1. 4.0 namespace question
- Posted by bernie Apr 06, 2009
- 1003 views
If I use map in a library.
--< lib_number_1 >-- -- I have to use as mm because of get and put in map namespace public include std/map.e as mm --< end of lib number 1 >-- ---------------------------------------------- --< file_number_2 >-- include lib_number_1 -- NOW HOW DO I ACCESS A MAP with mm IN lib_number_1 ? --< end of file number 2 >--
2. Re: 4.0 namespace question
- Posted by jimcbrown (admin) Apr 06, 2009
- 962 views
If I use map in a library.
--< lib_number_1 >-- -- I have to use as mm because of get and put in map namespace public include std/map.e as mm --< end of lib number 1 >-- ---------------------------------------------- --< file_number_2 >-- include lib_number_1 -- NOW HOW DO I ACCESS A MAP with mm IN lib_number_1 ? --< end of file number 2 >--
You can't, you need to include std/map.e in file_number_2
3. Re: 4.0 namespace question
- Posted by mattlewis (admin) Apr 06, 2009
- 974 views
If I use map in a library.
--< lib_number_1 >-- -- I have to use as mm because of get and put in map namespace public include std/map.e as mm --< end of lib number 1 >-- ---------------------------------------------- --< file_number_2 >-- include lib_number_1 -- NOW HOW DO I ACCESS A MAP with mm IN lib_number_1 ? --< end of file number 2 >--
-- lib_number_1 include std/map.e as mm
You do it the same way as in any other file. The 'mm' simply helps to tell euphoria what symbol you're referring to. They'll all use the same code. Nothing is ever included twice.
Matt
4. Re: 4.0 namespace question
- Posted by bernie Apr 06, 2009
- 980 views
If I use map in a library.
--< lib_number_1 >-- -- I have to use as mm because of get and put in map namespace public include std/map.e as mm --< end of lib number 1 >-- ---------------------------------------------- --< file_number_2 >-- include lib_number_1 -- NOW HOW DO I ACCESS A MAP with mm IN lib_number_1 ? --< end of file number 2 >--
-- lib_number_1 include std/map.e as mm
You do it the same way as in any other file. The 'mm' simply helps to tell euphoria what symbol you're referring to. They'll all use the same code. Nothing is ever included twice.
Matt
I don't think that works because I want to access the contents
of a map that has been created and loaded in the first file.
5. Re: 4.0 namespace question
- Posted by bernie Apr 06, 2009
- 992 views
If I use map in a library.
--< lib_number_1 >-- -- I have to use as mm because of get and put in map namespace public include std/map.e as mm --< end of lib number 1 >-- ---------------------------------------------- --< file_number_2 >-- include lib_number_1 -- NOW HOW DO I ACCESS A MAP with mm IN lib_number_1 ? --< end of file number 2 >--
-- lib_number_1 include std/map.e as mm
You do it the same way as in any other file. The 'mm' simply helps to tell euphoria what symbol you're referring to. They'll all use the same code. Nothing is ever included twice.
Matt
I don't think that works because I want to access the contents
of a map that has been created and loaded in the first file.
I just added another function in file 1 to pass the information
to me which i could call from file 2.
6. Re: 4.0 namespace question
- Posted by DerekParnell (admin) Apr 06, 2009
- 984 views
If I use map in a library.
--< lib_number_1 >-- -- I have to use as mm because of get and put in map namespace public include std/map.e as mm --< end of lib number 1 >-- ---------------------------------------------- --< file_number_2 >-- include lib_number_1 -- NOW HOW DO I ACCESS A MAP with mm IN lib_number_1 ? --< end of file number 2 >--
-- lib_number_1 include std/map.e as mm
You do it the same way as in any other file. The 'mm' simply helps to tell euphoria what symbol you're referring to. They'll all use the same code. Nothing is ever included twice.
Matt
I don't think that works because I want to access the contents of a map that has been created and loaded in the first file.
Yes it does work.
--- file1.e ---- include std/map.e as mm public map myMap = mm:new() mm:put(myMap, "one", 1) mm:put(myMap, "two", 2) mm:put(myMap, "three", 3) ---- end of file1.e ---- --- file2.e ---- include file1.e include std/map.e as mm ? mm:get(myMap, "one") ? mm:get(myMap, "two") ? mm:get(myMap, "three") ---- end of file2.e --