Commit Graph

102 Commits

Author SHA1 Message Date
Peter Wagenet 8b5b55d9b0 Update dependencies 2019-07-30 11:25:43 -07:00
Peter Wagenet ed7a3bb730 Bump Bundler version 2019-07-30 10:52:19 -07:00
Godfrey Chan 750be7995d [BREAKING] Allow arbitrary attributes for classes
We no longer automatically derive Clone and Debug on the structs.

Fixes #143
2018-06-16 09:24:04 -04:00
Godfrey Chan a8e1f37362 Allow arbitrary attributes for methods 2018-06-16 09:23:54 -04:00
Terence Lee 088a636192 allow private constructor. also add docopt example
You can do this by setting:

```
def initialize(helix, ...) {
}
```

Right now this only works on the constructor and only unexported is
supported.
2018-06-14 00:09:09 -07:00
Godfrey Chan 6fa52887c9 Add game of life example 2018-06-04 09:22:38 -04:00
Godfrey Chan b6a3e5acc9
Merge pull request #150 from tildeio/safer-strings
Safer string coercions
2018-06-01 17:13:19 -07:00
Godfrey Chan faaa6b1b26 Safer string coercions
Previously, we blindly assume Ruby strings are UTF-8 and turn them
into Rust Strings (which *are* assumed to be UTF-8). This is clearly
unsafe so this commit adds some checks to cofirm that and generate
type errors appropiately.
2018-06-02 08:42:12 +09:00
Godfrey Chan fca1620cf8 Add coercions for tuples 2018-04-26 17:57:56 -07:00
Peter Wagenet 17b0fbb15b Don't lock Gemfiles 2017-10-10 16:16:48 -07:00
Godfrey Chan f4dcbf6ea1 v0.7.2 2017-10-09 22:53:01 -07:00
Godfrey Chan c485529059 Merge pull request #128 from tildeio/consume-self
Allow consuming self in methods
2017-10-09 22:18:30 -07:00
Godfrey Chan 3adc5fd5b7 Allow consuming self in methods
Using the object (calling Rust methods from Ruby) after consuming
would raise a RuntimeError.

Also fixes some parser bugs that previously allowed invalid syntax
through in the arguments position.
2017-10-09 11:20:42 -07:00
Godfrey Chan 0cdd075c22 Add Symbol coercion
The main use case for symbols is to use them as a HashMap key. However,
this introduces a GC problem – we cannot store Ruby values in the heap
without properly marking/registering them, otherwise they might get
GC'ed by Ruby unexpectedly. (In fact, this is already a problem if you
have a `Vec<VALUE>`.)

I tried to avoid introducing additional problems by pinning down any
symbols that goes thought the coercion protocol. This is probably
overly aggressive, as it would cause any dynamic symbols (e.g.
`String#to_sym`) to become un-GC-able. We can revisit this once we
have a more general-purpose system to encode pinning semantics in
the type system.
2017-10-07 19:29:33 -07:00
Godfrey Chan 65a98c65d1 v0.7.1 2017-10-06 15:51:12 -07:00
Godfrey Chan 5ce16e9550 Add hash <-> HashMap coercion 2017-10-06 14:54:11 -07:00
Godfrey Chan 385c9f1441 Port membership example to use new vec coercion 2017-10-05 09:52:27 -07:00
Peter Wagenet ce8f4430bc
Add Array coercions 2017-10-05 00:12:42 -05:00
Terence Lee 73d3258405
update examples lockfiles 2017-10-05 00:12:25 -05:00
Godfrey Chan e6bcbec37b Merge pull request #122 from tildeio/from_ruby
change UncheckedValue::to_checked to FromRuby::from_ruby
2017-09-26 22:45:03 -04:00
Godfrey Chan cfdf0ce1ea Refactor `FromRuby`
- Make `Checked` an associated type. This allows `from_ruby` to carry
  over additional information (useful for `Option` etc)

- Move `ToRust` into `FromRuby` to ensure both get implemented together
2017-09-26 21:36:28 -04:00
Godfrey Chan 44c790244a Fix membership test 2017-09-26 16:37:37 -04:00
Terence Lee 6d3675c0f8 change UncheckedValue::to_checked to FromRuby::from_ruby
This allows helix gems to create type coercions
2017-09-26 16:35:02 -04:00
Godfrey Chan 9b638ac151 Test new error macros 2017-09-26 12:52:26 -04:00
Godfrey Chan 144157c064 [WIP] Exceptions cleanup 2017-09-26 11:03:39 -04:00
Ashe Connor 41064303ef
Use 'tomlrb' instead of 'toml' gem 2017-09-21 12:38:04 +10:00
Godfrey Chan ab7ba71b6a Allow `to_ruby` to fail
This switches the `to_ruby` trait method to return a `Result`, which
allows the coercion to fail.

The most obvious use case for this is to implement coercion for the
`Result` type in Rust (included in this PR), but there could be other
reasons why a coercion might fail. For example, if we were to implement
a coercion between a Rust and Ruby regular expression, the coercion
could fail if the Rust regular expression uses some Rust-specific
features that are not supported by the Ruby regular expression
implementation.
2017-09-20 18:50:09 +09:00
Godfrey Chan f64727dbea Support #[ruby_name] remapping for classes 2017-09-11 02:01:02 -07:00
Godfrey Chan 856244698f Use cstr-macro crate 2017-09-11 00:57:44 -07:00
Terence Lee 2864f15db3
v0.6.4 2017-09-05 17:03:37 -05:00
Godfrey Chan 5e5f2d9f70 v0.6.3 2017-08-30 21:37:09 -07:00
Godfrey Chan e43599a1bf v0.6.2 2017-08-28 23:10:49 -07:00
Godfrey Chan e47b390d97 Deprecate passing project name to `BuildTask`
Since we already have the `Cargo.toml`, we don't actually need the
user to pass the project name. Further more, the build task doesn't
actually work correctly if you pass any name _other than_ what is
in your `Cargo.toml` (as seen in #92).

Fixes #110.
2017-08-28 23:09:11 -07:00
Yehuda Katz 68b217c16a Improve "implicit coercion" language
Closes #85
2017-05-18 08:53:52 -07:00
Peter Wagenet 1ff02d633c Add compatibility section 2017-05-18 08:50:37 -07:00
Peter Wagenet 0b31b18680 Bump Version 2017-05-03 11:42:57 -07:00
Peter Wagenet a6728ff89d Improve installation for examples 2017-04-28 15:16:03 -07:00
Peter Wagenet 8ec2b122f3 Update example Gemfile.locks 2017-04-26 09:27:20 -07:00
Peter Wagenet a910795d46 Update READMEs to reflect current state 2017-04-24 10:06:26 -07:00
Peter Wagenet c5703eb6b9 Bump version, rename helix crate 2017-04-24 09:31:18 -07:00
Godfrey Chan 067156d9ca Bump version 2017-04-22 16:10:20 -07:00
Yehuda Katz d668a31150 Rename declare_types! to ruby! 2017-04-21 17:54:52 -07:00
Yehuda Katz b72c306cd4 Support #[ruby_name = "blank?"]
Support using attributes to specify the Ruby name for a method.

At the same time, refactor the macro.
2017-04-21 17:53:10 -07:00
Yehuda Katz e1905e670c Fix macros to handle all existing tests 2017-04-21 14:03:14 -07:00
Yehuda Katz cf75b30903 Make console work 2017-04-21 10:44:21 -07:00
Godfrey Chan e799d58dd0 Make multi-class work
This commit overhauls the macro, using a two-pass parse/codegen
approach that makes it easier for us to implement some long-desired
features. This commit adds support for multiple classes in a single
macro.
2017-04-20 18:17:07 -07:00
Godfrey Chan 563b7a7ee6 Add text flipping 2017-04-20 12:37:46 -07:00
Godfrey Chan bd225ddca9 Add text_transform example 2017-04-20 12:01:48 -07:00
Peter Wagenet c9cc2fea3e Update example Gemfile.locks 2017-04-19 15:25:37 -07:00
Peter Wagenet dee69897df Bump version 2017-04-19 12:07:16 -07:00