zeroc-ice / ice

All-in-one solution for creating networked applications with RPC, pub/sub, server deployment, and more.
https://zeroc.com
GNU General Public License v2.0
2.03k stars 592 forks source link

improve loadSlice to work like require_once #141

Closed pepone closed 2 months ago

pepone commented 6 years ago

loadSlice in Ruby and Python parses a file and the generate code that is only executed if the definitions currently not exits

if 'S' not in _M_Test.__dict__:
    _M_Test.S = Ice.createTempClass()
    class S(object):

This works, but I think will be more correct that the extensions keeps track of the list of Slice files already loaded (canonical path), and a second load of the same file will do nothing.

With current code loading two different Slice files that happen to define the same type, the first one will be defined and the second silently ignored.

pepone commented 2 months ago

Python fixed in https://github.com/zeroc-ice/ice/commit/e2afab0e4b2da98288b23aa504fb56d53390b35e

pepone commented 2 months ago

Doing a file path check doesn't work with the --all option, which parses and generates code for all files simultaneously.