1. 4.0 namespace question

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 >--  
 
new topic     » topic index » view message » categorize

2. Re: 4.0 namespace question

bernie said...

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

new topic     » goto parent     » topic index » view message » categorize

3. Re: 4.0 namespace question

bernie said...

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

new topic     » goto parent     » topic index » view message » categorize

4. Re: 4.0 namespace question

mattlewis said...
bernie said...

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.

new topic     » goto parent     » topic index » view message » categorize

5. Re: 4.0 namespace question

bernie said...
mattlewis said...
bernie said...

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.

new topic     » goto parent     » topic index » view message » categorize

6. Re: 4.0 namespace question

bernie said...
mattlewis said...
bernie said...

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 -- 
new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu