r2e doesn't affect Strings
Reported by Philipp Pirozhkov | December 28th, 2008 @ 06:14 PM
Calling: reia_erl:r2e(reia:apply('Ryan',out, [Abs_Path, Method, PathParts, Cookie, Params])).
Ryan.out returns (~redirect, "something.com") in erlang that looks as {tuple,{redirect,{string,<<"something.com">>}}}
after r2e we get {redirect,{string,<<"something.com">>}}
Since r2e uses list comprehension, it'a ok with containing values, but strings are not converted from Reia to Erlang properly, and there's currently no way to work it around when returning values in different formats: (~html, "contents") ~ok (~status, 404) (~content, 'application/pdf', 'PDF/#4...')
i suggest adding: r2e({string, String}) -> String; to reia_erl
Comments and changes to this ticket
-
Philipp Pirozhkov December 28th, 2008 @ 06:48 PM
applying my suggested patch breaks code in many pieces, there should be another solution. I'll work it around until typing system is stable
-
Tony Arcieri December 28th, 2008 @ 07:01 PM
- State changed from new to resolved
Reia calls out into the Erlang environment in several places. Since there's no Erlang equivalent of a string (a collection of characters) as a distinct entity from a list, strings need to be preserved in their internal Reia representation. I plan switching the internal representation of strings to a more iolist-like internal representation, using nested lists of binaries which are lazily flattened when necessary.
As a workaround for interfacing with the Erlang environment, for the time being I'd suggest you have Ryan.out return (~redirect, "something.com".to_list()). In the future you can pretty this up with default arguments and keyword args which let you control what type is returned.
So, consider this closed "by design"
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
Reia a dynamic scripting language for the Erlang virtual machine (BEAM)