How to cut the separate call chain SCOOPING my application

35 views
Skip to first unread message

Gachoud Philippe

unread,
Feb 25, 2020, 12:40:58 PM2/25/20
to Eiffel Users
Hi all,

going through my SCOOP basics I'm actually trying to SCOOP my application which seems to be a big work. 

Into the steps of SCOOPING my app, I have `file_processors` which are going to be `separate file_processor`

1) creating them with `create l_file_processor.make (a_sep_arg)` as far as I understood `a_sep_arg` HAS to be separate, so I have to either change the `make (an_arg: SOME)` to `make (an_arg: separate SOME)` or `make_from_separate (an_arg: separate SOME)` keeping both options. 
Am I right till here?
2) If I refactor my classes to make them able to do that, I'm reaching a point where calling things from libraries like in my case a_json_string.item ("some_json_key") I'm encountering a "Formal argument or tuple field of a separate call should be of a separate type if the actual argument or the source expression is of a reference type." and where the `item_from_separate` function is not defined :-(((

3) Where am I wrong??

4) What are the workarounds?

Thx for your answers
Message has been deleted

Gachoud Philippe

unread,
Feb 26, 2020, 9:59:33 AM2/26/20
to Eiffel Users
My dirty but working workaround is following to avoid inheriting or rewriting libs. I'm still with my questions about that

feature -- Conversion

non_sep_json_o (a_json_o: separate JSON_OBJECT): JSON_OBJECT
do
check
attached {JSON_OBJECT} non_sep_json_value (a_json_o) as l_res
then
Result := l_res
end
ensure
instance_free: Class
end

non_sep_json_value (a_json_v: separate JSON_VALUE): JSON_VALUE
local
l_json_s: JSON_STRING
l_s: STRING
do
-- - JSON_ARRAY: no assertion
-- - JSON_BOOLEAN: no assertion
-- - JSON_NULL: no assertion
-- - JSON_NUMBER: no assertion
-- - JSON_OBJECT: no assertion
-- - JSON_STRING: no assertion
if attached {separate JSON_ARRAY} a_json_v as l_json then
create {JSON_ARRAY} Result.make (l_json.count)
check
attached {JSON_ARRAY} Result as l_res
then
across
l_json as l_item
loop
check
attached {JSON_VALUE} non_sep_json_value (l_item.item) as l_non_sep_json_value
then
l_res.extend (l_non_sep_json_value)
end
end
end
elseif attached {separate JSON_BOOLEAN} a_json_v as l_json then
create {JSON_BOOLEAN} Result.make (l_json.item)
elseif attached {separate JSON_STRING} a_json_v as l_json then
create l_s.make_from_separate (l_json.item)
create {JSON_STRING} Result.make_from_string (l_s)
elseif attached {separate JSON_NULL} a_json_v as l_json then
create {JSON_NULL} Result
elseif attached {separate JSON_NUMBER} a_json_v as l_json then
if l_json.is_integer then
create {JSON_NUMBER} Result.make_integer (l_json.integer_64_item)
elseif l_json.is_real then
create {JSON_NUMBER} Result.make_real (l_json.real_64_item)
elseif l_json.is_natural then
create {JSON_NUMBER} Result.make_natural (l_json.natural_64_item)
else
create {JSON_NUMBER} Result.make_natural (0)
check
invalid_json_number: False
end
end
elseif attached {separate JSON_OBJECT} a_json_v as l_json then
create {JSON_OBJECT} Result.make_with_capacity (l_json.count)
check
attached {JSON_OBJECT} Result as l_res
then
across
l_json as l_item
loop
check
attached {JSON_VALUE} non_sep_json_value (l_item.item) as l_non_sep_json_value
then
create l_s.make_from_separate (l_item.key.item)
create l_json_s.make_from_string (l_s)
l_res.put (l_non_sep_json_value, l_json_s)
end
end
end
else
create {JSON_ARRAY} Result.make_empty
check
not_implemented: False
end
end
ensure
instance_free: Class
end

Larry Rix

unread,
Feb 27, 2020, 1:33:42 PM2/27/20
to Eiffel Users
So far—I have found ways to only pass {separate STRING} objects as arguments. The ability to do:

create  l_my_string.make_from_separate (a_sep_string)

seems to work pretty well after receiving 'a_sep_string: separate STRING' as an argument.

What I am hoping to build is a class (based on a suggestion from Jocelyn) that will serialize and then deserialize passed objects of ANY type, such that I can have a single class on either side of a Region boundary that handles that work.

Gachoud Philippe

unread,
Feb 28, 2020, 1:21:01 PM2/28/20
to Eiffel Users
Did some more digressions about the topic on https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!topic/eiffel-users/ELJkIQ8hMQI hopefully some mecanism in ANY could see the sun...

Larry Rix

unread,
Feb 28, 2020, 3:35:04 PM2/28/20
to Eiffel Users
Turns out that there is a scoop patterns library that has a great deal of solutions and patterns already built, tested, and ready to go with documentation in the Master Thesis paper plus Betrand's SCOOP paper in addition. I have shared links to all of these in other topics.

--
You received this message because you are subscribed to the Google Groups "Eiffel Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eiffel-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/eiffel-users/033c748d-2b1f-42b6-a263-ac5f56debffc%40googlegroups.com.

Gachoud Philippe

unread,
Feb 28, 2020, 7:33:17 PM2/28/20
to eiffel...@googlegroups.com
I would have needed all this at the beginning... not pretending I got everything!

How and where can we bring all that together for posterity?

--
**********************************************
Philippe Gachoud
Puerto Williams 6657
Las Condes
Santiago de Chile
+56  934022210
ph.ga...@gmail.com
**********************************************
   

Reply all
Reply to author
Forward
0 new messages