mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
doc/limitation.md: remove visibility note
We have implemented visibility in mruby 3.4
This commit is contained in:
@@ -72,75 +72,6 @@ p Liste.new "foobar"
|
||||
|
||||
`ArgumentError` is raised.
|
||||
|
||||
## Method visibility
|
||||
|
||||
For simplicity reasons no method visibility (public/private/protected) is
|
||||
supported. Those methods are defined, but they are dummy methods.
|
||||
|
||||
```ruby
|
||||
class VisibleTest
|
||||
|
||||
def public_method; end
|
||||
|
||||
private
|
||||
def private_method; end
|
||||
|
||||
end
|
||||
|
||||
p VisibleTest.new.respond_to?(:private_method, false)
|
||||
p VisibleTest.new.respond_to?(:private_method, true)
|
||||
```
|
||||
|
||||
#### Ruby [ruby 2.0.0p645 (2015-04-13 revision 50299)]
|
||||
|
||||
```
|
||||
false
|
||||
true
|
||||
```
|
||||
|
||||
#### mruby [3.1.0 (2022-05-12)]
|
||||
|
||||
```
|
||||
true
|
||||
true
|
||||
```
|
||||
|
||||
### Visibility Declaration
|
||||
|
||||
The declaration form of following visibility methods are not implemented.
|
||||
|
||||
- `public`
|
||||
- `private`
|
||||
- `protected`
|
||||
- `module_function`
|
||||
|
||||
Especially, `module_function` method is not dummy, but no declaration form.
|
||||
|
||||
```ruby
|
||||
module TestModule
|
||||
module_function
|
||||
def test_func
|
||||
p 'test_func called'
|
||||
end
|
||||
|
||||
test_func
|
||||
end
|
||||
|
||||
p 'ok'
|
||||
```
|
||||
|
||||
#### Ruby [ruby 2.5.5p157 (2019-03-15 revision 67260)]
|
||||
|
||||
```
|
||||
ok
|
||||
```
|
||||
|
||||
#### mruby [3.1.0 (2022-05-12)]
|
||||
|
||||
```
|
||||
test.rb:8: undefined method 'test_func' (NoMethodError)
|
||||
```
|
||||
|
||||
## `defined?`
|
||||
|
||||
The `defined?` keyword is considered too complex to be fully
|
||||
|
||||
Reference in New Issue
Block a user