Commit Graph

2810 Commits

Author SHA1 Message Date
Gergely Nagy
cbc2eed900
defclass reimagined
defclass now has a new syntax:

 (defclass Name [BaseList]
   [property value
    property value] ;; optional

   (defn method [self]
     self.property))

Anything after the optional property list (which will be translated to a
setv within the class context) will be added to the class body. This
allows one to have side effects and complex expressions within the class
definition.

As a side effect, defining methods is much more friendly now!

Closes #850.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2015-08-04 16:43:07 +02:00
Berker Peksag
9fbd21adba Merge pull request #678 from algernon/f/botsbuildbots-contrib-move
remove botsbuildbots
2015-08-04 13:16:54 +03:00
Gergely Nagy
7db0fcdafb Move Botsbuildbots to contrib
Closes #678.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2015-08-04 11:59:10 +02:00
Tuukka Turto
eaf1a3023a Change xor to binary function
xor with more than two input parameters is not well defined and people
have different expectations on how it should behave. Avoid confusion by
sticking with two parameters only.
2015-08-03 05:37:39 +03:00
Tuukka Turto
ca8b6b4fe5 Add exclusive or logical operator
Added xor to complement and, or, not operators. Standard python
falsey/truthy semantics are followed. This implementation works for
two or more parameters.
2015-08-02 23:57:46 +03:00
Morten Linderud
b38ec6b92d Merge pull request #863 from farhaven/read-str
Add read-str
2015-07-31 23:58:16 +02:00
Morten Linderud
b6c3289bbe Merge pull request #824 from kirbyfan64/short-circuit
Make and/or short-circuit
2015-07-31 23:57:25 +02:00
Gregor Best
3f0aaf591b Remove failing test for now 2015-07-30 16:07:25 +02:00
Gregor Best
98704ddd1a fix typo 2015-07-30 16:07:25 +02:00
Gregor Best
0146cc8e4d Add docs for read-str 2015-07-30 16:07:25 +02:00
Gregor Best
2d7134a1be Add (read-str) 2015-07-30 16:07:25 +02:00
Zack M. Davis
557571cc71 merge branch 'div' 2015-07-29 21:31:56 -07:00
Ryan Gonzalez
016d25d104 Add one-argument division and rationals (closes #825 and #826) 2015-07-29 13:30:24 -05:00
Zack M. Davis
f1c315da24 merge branch 'lex-exception' 2015-07-28 21:29:08 -07:00
Zack M. Davis
1297cce4e2 merge branch 'eval-param-types' 2015-07-28 21:18:02 -07:00
Gregor Best
1de5513e48 Make read read line-wise and don't ignore Lexer Errors
This allows us to react to things like "(foo))" being passed in instead of
looping until kingdom come. Also makes tokenizing things that are not
expressions easier:

    => (read)
    "foo"
    u'foo'
    =>
2015-07-28 16:58:56 +02:00
Gregor Best
48e654596d Type check eval parameters 2015-07-28 16:49:22 +02:00
Gregor Best
0ba620fc73 Explicitly set missing source on LexExceptions
This fixes the following code:

    (import [hy.lex [tokenize]])
    (tokenize "(foo))")
2015-07-28 16:46:26 +02:00
Zack M. Davis
016557deab reader macro #@ for with-decorator
The `with-decorator` special form is not the most ergonomic—this commit
introduces a new builtin `#@` reader macro that expands to an invocation
of `with-decorator`. To support this, `reader_macroexpand` is made to
also look in the default `None` namespace, in imitation of how
regular (non-reader) macros defined in hy.core are looked up. The
docstring of `hy.macros.reader` is also edited slightly for accuracy.

This in the matter of issue #856.
2015-07-26 15:05:38 -07:00
Zack M. Davis
f247056360 merge branch 'setv-pair' 2015-07-26 01:04:07 -07:00
Ryan Gonzalez
e54d4becec Add zero- and one-argument versions of 'and' and 'or' (ref. #835) 2015-07-25 18:44:23 -05:00
Ryan Gonzalez
95cef09c6a Make 'and' and 'or' short-circuit (ref. #233, closes #766) 2015-07-25 18:44:16 -05:00
Ryan Gonzalez
736d7a7991 Let setv take pairs of arguments (ref. #844) 2015-07-25 17:45:34 -05:00
Morten Linderud
d95bfbaa8e Merge pull request #845 from farhaven/flow-doc
Rework `flow' module doc
2015-07-24 09:55:29 +02:00
Gregor Best
4fe67c11a4 Rework `flow' module doc
- Reworded intro a bit
- Cleaned up white space
- Reworded examples
2015-07-24 09:52:33 +02:00
Gergely Nagy
4642625378 Merge pull request #788 from nicolas-p/ap-pipe-ap-compose
Added ap-pipe and ap-compose macros
2015-07-23 15:08:18 +02:00
Morten Linderud
73a29fd377 Merge pull request #781 from zackmdavis/kwonly_connect
keyword-only arguments
2015-07-23 14:12:35 +02:00
Morten Linderud
4ee308c5f2 Merge pull request #761 from larme/fix-replace-hyobject
Add 'replace_hy_obj' to safely replace Hy objects
2015-07-23 14:09:56 +02:00
Morten Linderud
e228245690 Merge pull request #760 from Tritlo/flow
Added flow macros
2015-07-23 14:08:46 +02:00
Zack M. Davis
8a03e922c1 AST test coverage for &kwonly; cant_compile returns exception object
Much like how `can_compile` returns the compilation result, which some
tests make use of, it may be useful for for `cant_compile` to return the
exception object that it caught, for more specific assertions.
2015-07-22 22:06:51 -07:00
Zack M. Davis
4b00a84f9f documentation for &kwonly 2015-07-22 22:06:51 -07:00
Zack M. Davis
ef079d5e08 implement keyword-only arguments
Python 3 supports keyword-only arguments as described in the immortal
PEP 3102. This commit implements keyword-only argument support for Hy
using a `&kwonly` lambda-list-keyword with semantics analogous how
`&optional` arguments are handled: `&kwonly` arguments are either a
symbol, in which case the keyword argument so named is mandatory, or a
two-element list, the first of which is the symbolic name of the keyword
argument and the second of which is its default value if not
supplied. If Hy is running under Python 2, attempting to use `&kwonly`
args will raise a HyTypeError.

This effort is with the aim of resolving #453.
2015-07-22 21:53:06 -07:00
Zack M. Davis
d8abfb3653 merge branch 'additional_unpacking_correctness' 2015-07-22 21:26:38 -07:00
Zhao Shenyang
e2f48e5cde fix a stupid typo 2015-07-23 10:25:32 +08:00
Zhao Shenyang
e2c1d45f21 Make error messages clearer 2015-07-23 10:22:12 +08:00
Paul Tagliamonte
2258bcc2d7 Merge branch 'master' into pr/823 2015-07-22 12:55:27 -04:00
Morten Linderud
d10b1d17cc Merge pull request #843 from paultag/paultag/bugfix/die-python-26-die
Remove 2.6 entirely from test runners
2015-07-22 18:52:44 +02:00
Paul Tagliamonte
1312167fb1 Remove 2.6 entirely from test runners
(But not codepaths, in case someone cares)
2015-07-22 12:37:31 -04:00
Gergely Nagy
adc1cf8829
contrib.walk: Coerce non-list iterables into list form
Expressions can sometimes contain itertools.islice objects, which we can
only walk if we force them into a list. To do this, the walk function
has to be taught that collections that are not instances of list should
be forced into a list.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2015-07-15 16:59:49 +02:00
Berker Peksag
144ee3b2f0 Merge branch 'pr/829' 2015-07-15 00:00:01 +03:00
Ryan Gonzalez
c94c0e8b50 Add set literals (closes #827) 2015-07-14 23:59:29 +03:00
Morten Linderud
c2fe74c4a2 Merge pull request #803 from farhaven/nonlocal-doc
Add documentation for the (nonlocal ...) directive
2015-07-01 15:30:30 +02:00
Morten Linderud
0a2828cd0a Merge pull request #834 from farhaven/kwargs-doc
Expand doc for defn with &kwargs
2015-07-01 15:30:20 +02:00
Gregor Best
b106e3c08d Expand doc for defn with &kwargs 2015-07-01 14:57:53 +02:00
Paul Tagliamonte
4d31af2264 Add @zackmdavis to core 2015-06-29 22:14:10 -04:00
Paul Tagliamonte
920c801733 Fix markup slightly. 2015-06-23 08:33:42 -04:00
Paul‮etnomailgaT‭
aac2bc52f9 Merge pull request #819 from algernon/misc/CoC
Adopt a Code of Conduct
2015-06-23 08:32:56 -04:00
Gergely Nagy
bf16b2ce2f
Adopt a Code of Conduct
Include the text of the Contributor Covenant (1.1.0) in
CONTRIBUTING.rst, and add a link to the document to README.md.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2015-06-23 14:28:56 +02:00
Paul‮etnomailgaT‭
950c1bd41b Merge pull request #719 from unmerged/nonlocal-keyword
Added `nonlocal`. `global` takes multiple args.
2015-06-22 09:55:51 -04:00
Abhishek L
c2006280db Merge pull request #814 from farhaven/clean-defmain
Make (defmain ...) a clean macro
2015-06-21 23:32:42 +05:30