Module: Relisp
- Defined in:
- lib/relisp.rb,
lib/relisp/slaves.rb,
lib/relisp/elisp_functions.rb,
lib/relisp/type_conversion.rb,
lib/relisp/type_conversion/editing_types.rb,
lib/relisp/type_conversion/programming_types.rb
Overview
– Copyright © 2009 <[email protected]>
This file is part of Relisp.
Relisp is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Relisp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <www.gnu.org/licenses/>. ++
Straight from the elisp info manual:
Programming Types
Integer Type:: Numbers without fractional parts.
Floating Point Type:: Numbers with fractional parts and with a large range.
Symbol Type:: A multi-use object that refers to a function,
variable, or property list, and has a unique identity.
(Sequence Type):: Both lists and arrays are classified as sequences.
Cons Cell Type:: Cons cells, and lists (which are made from cons cells).
(Array Type):: Arrays include strings and vectors.
String Type:: An (efficient) array of characters.
Vector Type:: One-dimensional arrays.
Hash Table Type:: Super-fast lookup tables.
These are also elisp programming types, but Relisp doesn’t explicitly deal with them. Characters are basically just integers, and functions and macros are cons.
Character Type:: The representation of letters, numbers and
control characters.
Function Type:: A piece of executable code you can call from elsewhere.
Macro Type:: A method of an expression into another
expression, more fundamental but less pretty.
And then these elisp types are ignored completely, at least for now.
Char-Table Type:: One-dimensional sparse arrays indexed by characters.
Bool-Vector Type:: One-dimensional arrays of `t' or `nil'.
Primitive Function Type:: A function written in C, callable from Lisp.
Byte-Code Type:: A function written in Lisp, then compiled.
Autoload Type:: A type used for automatically loading seldom-used
functions.
Every type in the first group obviously matches a ruby class except for ‘Cons’ and ‘Vector’. The types that have an analogous ruby class are mapped directly to that class. ‘Cons’ is a kept in a proxy object in the same way as the editting data types. ‘Vector’ is mapped to a corresponding subclass of Array.
Every ruby class that corresponds to a elisp data type is duplicated inside the Relisp module with the rubyized version of the elisp name; for example, Relisp::Integer is exactly the same as Fixnum and Relisp::HashTable is the same as Hash.
Every class needs to have a from_elisp method that accepts a hash with the object’s string representation, variable name (in the elisp process) and the Slave instance that created the object. The method returns a ruby object analogous to the elisp value.
Every object needs a to_elisp method that creates a string which results in a elisp value equivalent to the ruby object when read and evaluated in elisp (i.e. elisp_eval "(eval (read #{obj.to_elisp}))"). For most objects this basically amounts to a variation on the to_s method. However, for objects that don’t have a string representation (hashes, buffers, frames, …) the to_elisp method actually results in elisp code that, when run, returns the appropriate object.
Defined Under Namespace
Classes: Buffer, Cons, ElispError, ElispSlave, Float, Frame, HashTable, Integer, List, Marker, Overlay, Process, Proxy, RubySlave, Slave, String, Symbol, VariableValue, Vector, Window, WindowConfiguration
Constant Summary collapse
- VERSION =
'1.0.0'
Class Method Summary collapse
Class Method Details
.default_slave ⇒ Object
27 28 29 |
# File 'lib/relisp/slaves.rb', line 27 def self.default_slave @default_slave end |
.default_slave=(slave) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/relisp/slaves.rb', line 31 def self.default_slave=(slave) unless slave.kind_of?(Slave) raise ArgumentError, "#{slave} is not a Slave" end @default_slave = slave end |