...bumped right into a new problem:

mapping(string:mixed) map = ([]);
string s;
map["test_null"] = s;
_typeof(map["test_null"]);
> zero

which is fine by me, but:

typeof(map["test_null"]);
> mixed

which is not so nice :( and if the variable s has a value:

map["test_null"] = "no_so_null";
typeof(map["test_null"]);
> mixed

but then:
_ typeof(map["test_null"]);
> string

Am I asking something extremely stupid if I'd like to know if it's possible to determine the (original) type of the string in the mapping?

On 13-1-2011 15:21, Bertrand LUPART wrote:
Another problem is that 'string s;' or 'string s=0;' evaluate to 'int' when 
using %t and 'zero_type()' doesn't help either.

Not a problem for pike but for any other language using the generated XML.
As a workaround, have you considered using typeof()/_typeof() ?

----8<----8<----8<----
string s; string t=0; string u=""; string v="foo";
zero_type(s);
(1) Result: 0
zero_type(t);
(2) Result: 0
zero_type(u);
(3) Result: 0
zero_type(v);
(4) Result: 0
typeof(s);
(5) Result: string
typeof(t);
(6) Result: string
typeof(u);
(7) Result: string
typeof(v);
(8) Result: string
_typeof(s);
(9) Result: zero
_typeof(t);
(10) Result: zero
_typeof(u);
(11) Result: string
_typeof(v);
(12) Result: string
---->8---->8---->8----


      • ... Arne Goedeke
        • ... Coen Schalkwijk
          • ... Tobias S. Josefowitz
          • ... Johan Björklund
          • ... H. William Welliver III
          • ... Coen Schalkwijk
          • ... Coen Schalkwijk
          • ... Bertrand LUPART
          • ... Coen Schalkwijk
          • ... Coen Schalkwijk
          • ... Coen Schalkwijk
          • ... Martin Bähr
          • ... Coen Schalkwijk
          • ... Martin Bähr
          • ... Coen Schalkwijk
          • ... Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum
          • ... Martin Bähr
  • Re:... Martin Bähr
    • ... Martin Nilsson (Opera Mini - AFK!) @ Pike (-) developers forum
      • ... Martin Baehr
        • ... Coen Schalkwijk

Reply via email to