E D R S I H C RSS
ID
Password
Join
통계는 正義를 대신할 수 없다. ―H.C.

잡담 #

  • 아마도 coroutine에 대한 변경이 대부분인 듯 합니다. 뭐, 만드는 사람맘이긴 하지만요. :) (coroutine 안쓰길 잘했당~)
  • 영어로 되어있는 부분은 알아서 읽어주시길... :) 무책임~

개인적으로 추가한 변경점들 #

  • lauxlib.h 에 등록되어있는 함수들 (이 부분은 lauxlib.h의 끝부분에 주석으로 설명되어있음)
    • luaL_check_number -> luaL_checknumber 로 변경
    • luaL_check_lstr -> luaL_checklstring 으로 변경
    • luaL_openlib() 함수가 단순한 함수 추가가 아닌 주어진 이름의 테이블을 만들고 그에 대한 라이브러리를 등록하는 함수로 변경.

5.0 알파와 호환되지 않는 추가 변경들 #

  • weak 테이블에 대한 API가 처음으로 돌아감 : setmode/getmode는 더이상 사용되지 않는다; 메타테이블의 "__mode"로 지정된다.
  • 예상한대로, gettable/settable 메타인덱스가 사라졌다. 이것들은 index/newindex와 통합되었다.
  • 쓰레드(Thread)는 루아의 새로운 데이타 타입이 되었다. (이것은 게비지컬렉션처리되는 coroutine들의 문제를 해결하기위해서 필요했다)
    LUA_API lua_State *lua_newthread (lua_State *L);
    
    위 함수는 스택에 신규 쓰레드를 남겨둔다. 메인을 제외한 모든 쓰레드는 게비지 컬렉션될 수 있다. For coroutines, this is just what we need. (LuaThreads와 같은) 다른 멀티쓰레드 시스템은 예를 들자면 컬렉션을 피하기위해서 레지스트리에 쓰레드들을 저장할 수도 있다.
  • The API for coroutines changed too. "coroutine.create" now returns a coroutine (an object of type "thread"), and not a function. There is an explicit "coroutine.resume" to resume a coroutine. We feel that this API is simpler for most people to understand. The old functionality is still available as "coroutine.wrap", that creates a coroutine and "wraps" it inside a function (closure), that resumes the coroutine each time it is called.
  • "coroutine.resume" can pass parameters to yield. "coroutine.create" (and "coroutine.wrap") now take only one argument, the coroutine body. The fist time you resume it, the extra arguments to "resume" (or the arguments to the closure, when you use "wrap") go as the parameters to the body. Next time you resume again the extra arguments go as the results from "yield". For instance:
    x = coroutine.create(function (a,b,c)
          print(a,b,c)
          print(coroutine.yield())
          print(coroutine.yield())
        end)
    coroutine.resume(x, 1, 2, 3)      --> 1, 2, 3
    coroutine.resume(x, 10)           --> 10
    coroutine.resume(x, 4, 5)         --> 4, 5
    print(coroutine.resume(x))        --> false   cannot resume dead coroutine
    
  • coroutine.resume() 은 pcall과 마찬가지로 "protected mode"로서 동작한다. Its first return is true or false (absence or presence of errors). If true, the other results are the arguments to yield, or the return of the body. If false, the other argument is the error message. (The function returned by "wrap" does not work in protected mode.)
  • the macro LUA_USERSTATE now opens an extra space *before* the area pointed by lua_State.

5.0 알파와 비교해서 추가되는 것들 #

다음은 (5.0알파와 비교했을때의) 5.0 베타내에서의 새로운 것들에 대한 목록이다. 이것들은 "일반적인" 프로그램들상에서는 비호환성을 만들지 않는다.
  • The compiler does not change the order of operands for "commutative" operators. (I don't remember why, but I remember there was quite a discussion about that in the list.) (However, "a>b" is still translated to "b<a", and "a>=b" to "b<=a".)
  • 루아 코드내에서의 precompile 기능이 추가되었다. (stringdump 함수)
  • lua.c의 "-l"옵션은 단순한 dofile 대신 "require"를 수행한다. (그러므로 LUA_PATH를 검색한다)
  • reorganization of object headers plus macros/documentation towards an incremental garbage collector. We plan to have the incremental collector in 5.1 (to be released as soon as possible, but only after 5.0 ;-).
  • support for yields inside line/count hooks.

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2010-10-28 12:42:52
Processing time 0.3987 sec