Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Binary pattern matching and optimization
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Vance Shipley  
View profile  
 More options Nov 24 2008, 1:08 pm
From: Vance Shipley <van...@motivity.ca>
Date: Mon, 24 Nov 2008 13:08:32 -0500
Local: Mon, Nov 24 2008 1:08 pm
Subject: [erlang-questions] Binary pattern matching and optimization
I would like to have a function like this:

        foo(<<_:Offset/binary, Foo:8, _/binary>>, Offset) ->
                bar(Bin, Foo).

Unfortunately that doesn't work:

        Eshell V5.6.5  (abort with ^G)
        1> compile:file(codec).
        ./codec.erl:15: variable 'Offset' is unbound
        error

I don't understand why the first version can't work but
neither do I understand much about writing compilers.

So instead I do this:

        foo(Bin, Offset) ->
                <<_:Offset/binary, Foo:8, _/binary>> = Bin,
                bar(Bin, Foo).

This works fine of course but now I am trying to understand
the meaning of this (optional) compiler warning:

        Warning: INFO: using a matched out sub binary will prevent
        delayed sub binary optimization

How should I interpret this warning?

        -Vance
_______________________________________________
erlang-questions mailing list
erlang-questi...@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-questions


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.